Closed shazz closed 3 years ago
This is definitely a bug. EDIT no wait, it isn't. But perhaps the assembler could warn about symbol shadowing.
This type of thing is legal in c64jasm and can sometimes be even useful:
!let data = 0
!if (1) {
lda #data ; `data` from outer scope
!let data = 4 ; `data` from current scope
lda #data
}
lda #data
Produces:
0801: A9 00 LDA #$00
0803: A9 04 LDA #$04
0805: A9 00 LDA #$00
It's similar to how this is valid C:
#include <stdio.h>
int main() {
int a = 0;
if (1) {
int a = 1;
printf("a=%d\n", a);
}
printf("a=%d\n", a);
}
The following is an error in c64jasm:
!let data = 0
data: !byte 0 ; Symbol 'data' already defined
Looks like variables prevail:
Result: