tebe6502/Mad-Assembler

.ds inside .rept does not work

ivop opened this issue · 0 comments

ivop commented

Hi,

It seems that the labels are not correctly assigned when I use .ds inside a repeat loop. Short program to demonstrate the problem:

Code:

    org $1000

    lda #$e5

    .rept 8,#+1
        sta foo:1
    .endr

    .rept 8,#+1
        sta bar:1
    .endr

    jmp *

; works

    .rept 8,#+1
foo:1 dta 0
    .endr

; does not work

    .rept 8,#+1
bar:1 .ds 0
    .endr

Output:

1000: A9 E5     LDA #$E5
1002: 8D 35 10  STA $1035
1005: 8D 36 10  STA $1036
1008: 8D 37 10  STA $1037
100B: 8D 38 10  STA $1038
100E: 8D 39 10  STA $1039
1011: 8D 3A 10  STA $103A
1014: 8D 3B 10  STA $103B
1017: 8D 3C 10  STA $103C
101A: 8D 3D 10  STA $103D    <---- and all below are the same address
101D: 8D 3D 10  STA $103D
1020: 8D 3D 10  STA $103D
1023: 8D 3D 10  STA $103D
1026: 8D 3D 10  STA $103D
1029: 8D 3D 10  STA $103D
102C: 8D 3D 10  STA $103D
102F: 8D 3D 10  STA $103D
1032: 4C 32 10  JMP $1032

Regards,
Ivo