|
Post by mirkosoft on Sept 14, 2021 23:32:14 GMT
Hi!
I have completed relocatable code and I need only finish or tune last thing.
File content:
JMP here+init_offset ; file description ending $00 ; vectors init: ; vector correcting & jump or RTS I need or want to use easiest and smallest way to use of JMP <here+init_offset> $4C LO HI
If anyone can help me, I'll be thankful.
Miro
|
|
|
Post by oziphantom on Sept 15, 2021 9:07:40 GMT
do you know where here is? or do you need to determine it at run time.
|
|
|
Post by mirkosoft on Sept 15, 2021 13:46:49 GMT
Here is file's 4th and 5th byte (LO + HI): Byte $00 LO byte load address (always $ff)\_ $FFFF is ID of relocatable file $01 HI byte load address (always $FF)/ $02 JMP = $4C $03 LO byte of jump $04 HI byte of jump
After loading it is determinated, so I know that easiest way is to use Branch instructions, but file description is not limited and vectors cannot to be limited - and it means that it can be higher value than 127 bytes.
Miro
|
|
|
Post by bjonte on Sept 16, 2021 9:09:12 GMT
Store the address in zero page and jump indirect with
JMP (zpaddr)
Or modify the jump instruction using self modifying code.
|
|
|
Post by bjonte on Sept 16, 2021 9:12:00 GMT
To get the address of <here> do a JSR to the next instruction and pull the return address from the stack (it is offset 1 byte).
jsr next next: pla tax pla
|
|