From 84cb41f625e67cfdab3b89df4057eb1cadf5d56e Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 23 Jun 2002 14:02:09 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1328 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/modload.s | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libsrc/common/modload.s b/libsrc/common/modload.s index a42e8eae5..b87b98581 100644 --- a/libsrc/common/modload.s +++ b/libsrc/common/modload.s @@ -68,7 +68,10 @@ Header: .res O65_HDR_SIZE ; The o65 header ; Input InputByte = Header ; Byte read from input -.data +; Relocation +RelocVal = Header + 1 ; Relocation value + +.data Read: jmp $FFFF ; Jump to read routine .rodata @@ -129,7 +132,7 @@ GetReloc: ;------------------------------------------------------------------------------ ; FormatError: Bail out with an o65 format error - + .code FormatError: lda #MLOAD_ERR_FMT @@ -240,8 +243,8 @@ Loop: jsr ReadByte ; Read byte from relocation table @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. @@ -262,7 +265,7 @@ Loop: jsr ReadByte ; Read byte from relocation table RelocLow: ldy #0 clc - lda ptr1 + lda RelocVal bcc AddCommon ; Relocate a high byte @@ -271,9 +274,9 @@ RelocHigh: 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 @@ -284,7 +287,7 @@ AddCommon: RelocWord: ldy #0 clc - lda ptr1 + lda RelocVal adc (TPtr),y sta (TPtr),y iny -- 2.39.5