[cc65] DA65 Selfmodification

From: Stefan <stefan-physik1gmx.net>
Date: 2008-07-24 23:22:28
Dear CC65 coders,

i tried to reassemble a selfmodifiing code using DA65.
The resulting code was unexpected not usable with CA65.
For simplifying i wrote a small democode which
i first assembled and linked using
> ca65 -tc64 test.s
> ld65 -tnone -S$0801 test.o -o test

and then disassembled again with
> da65 -itest.inf -S $0801 .

When i try CA65 on the diassembled code then i get following error:
> ca65 testrec.s
testrec.s(14): Error: Unexpected trailing garbage characters

Am i doing something wrong? How can i fix it?
Thank you in advance for help!


The testcode is the following

 ldy #0
 ldx #0
 txa
l0: sta $2000,x
 inx
 bne l0
 inc l0+2
 dey
 bne l0
 rts

The "test.inf" is the following:

        GLOBAL {
            OUTPUTNAME      "testrec.s";
            INPUTNAME       "test";
            STARTADDR       $0801;
            PAGELENGTH      0;                  # No paging
            CPU             "6502";
            COMMENTS    4;
        };

        RANGE {START $0801; END $0900; TYPE CODE;};

The resulting not CA65 usable, disassembled code looked like this:

; da65 V2.12.0 - (C) Copyright 2000-2005,  Ullrich von Bassewitz
; Created:    2008-07-24 23:08:34
; Input file: test
; Page:       1


        .setcpu "6502"

; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
        ldy     #$00                            ; 0801 A0 00 
..
        ldx     #$00                            ; 0803 A2 00 
..
        txa                                     ; 0805 8A 
.
L0806:L0806     := * + 0
L0808           := * + 2
        sta     $2000,x                         ; 0806 9D 00 20 
..
        inx                                     ; 0809 E8 
.
        bne     L0806                           ; 080A D0 FA 
..
        inc     L0808                           ; 080C EE 08 08 
...
        dey                                     ; 080F 88 
.
        bne     L0806                           ; 0810 D0 F4 
..
        rts                                     ; 0812 60 
`
; ----------------------------------------------------------------------------


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jul 24 23:22:32 2008

This archive was generated by hypermail 2.1.8 : 2008-07-24 23:22:34 CEST