; Input
InputByte = Header ; Byte read from input
-.data
+; Relocation
+RelocVal = Header + 1 ; Relocation value
+
+.data
Read: jmp $FFFF ; Jump to read routine
.rodata
;------------------------------------------------------------------------------
; FormatError: Bail out with an o65 format error
-
+
.code
FormatError:
lda #MLOAD_ERR_FMT
@L2: jsr ReadByte
and #O65_SEGID_MASK
jsr GetReloc
- sta ptr1
- stx ptr1+1
+ sta RelocVal
+ stx RelocVal+1
; Get the relocation byte again, this time extract the relocation type.
RelocLow:
ldy #0
clc
- lda ptr1
+ lda RelocVal
bcc AddCommon
; Relocate a high byte
jsr ReadByte ; Read low byte from relocation table
ldy #0
clc
- adc ptr1 ; We just need the carry
+ adc RelocVal ; We just need the carry
AddHigh:
- lda ptr1+1
+ lda RelocVal+1
AddCommon:
adc (TPtr),y
sta (TPtr),y
RelocWord:
ldy #0
clc
- lda ptr1
+ lda RelocVal
adc (TPtr),y
sta (TPtr),y
iny