From: MagerValp (MagerValp_at_cling.gu.se)
Date: 2003-10-31 10:40:16
>>>>> "TE" == Todd Elliott <eyeth_at_videocam.net.au> writes:
TE> How do I add code that is destined for an another address?
"Please note that you do not need this command in most cases. Placing
code at a specific address is the job of the linker, not the
assembler, so there is usually no reason to assemble code to a
specific address."
Define a segment with a different load and run address:
RELOC: load = ROM, run = FLASH, type = rw, define = yes;
Place the code to be relocated in .segment "RELOC", and relocate the
code:
.zeropage
src: .res 2
dest: .res 2
.code
relocate:
ldax __RELOC_LOAD__
stax src
ldax __RELOC_RUN__
stax dest
ldy #0
ldx #>__RELOC_SIZE__
beq @donehi
: lda (src),y
sta (dest),y
iny
bne :-
inc src+1
inc dest+1
dex
bne :-
@donehi:
ldx #<__RELOC_SIZE__
beq @donelo
: lda (src),y
sta (dest),y
iny
dex
bne :-
@donelo:
rts
--
___ . . . . . + . . o
_|___|_ + . + . + . Per Olofsson, arkadspelare
o-o . . . o + MagerValp_at_cling.gu.se
- + + . http://www.cling.gu.se/~cl3polof/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-10-31 10:43:20 CET