Mad-Assembler icon indicating copy to clipboard operation
Mad-Assembler copied to clipboard

.ds directive breaks .adr operator

Open phaeron1024 opened this issue 1 year ago • 1 comments

Labels declared with separate load and run addresses via the ORG directive no longer have the correct aliased address after a .ds directive, breaking the .adr operator on those labels.

Repro code:

        org     $2000

        lda     r1
        lda     r2
        lda     r3
        lda     .adr r1
        lda     .adr r2
        lda     .adr r3

        org     0,$4000
r1:
        nop
r2:
        .ds     1
r3:

Listing output:

mads 2.1.5 build 3 (21 Feb 22)
Source: ds.s
     1                                  org     $2000
     2
     3 FFFF> 2000-200D> A5 00           lda     r1
     4 2002 A5 01                       lda     r2
     5 2004 A5 02                       lda     r3
     6 2006 AD 00 40                    lda     .adr r1
     7 2009 AD 01 40                    lda     .adr r2
     8 200C A5 02                       lda     .adr r3
     9
    10 200E                             org     0,$4000
    11 0000                     r1:
    12 4000-4000> EA                    nop
    13 0001                     r2:
    14 = 0001                           .ds     1
    15 0002                     r3:

After the .ds directive, r3 and .adr r3 have the same address. This is apparently because .ds resets both ORG addresses to be the same instead of maintaining the offset.

phaeron1024 avatar Jun 18 '23 07:06 phaeron1024

after changing the assembly address of the .PROC, .LOCAL block, it is not possible to use the .DS directive

mads.pas, listing line: 10969

tebe6502 avatar Aug 07 '23 19:08 tebe6502