diff --git a/linker.notes b/linker.notes index dbd56c6..8ff8c4f 100644 --- a/linker.notes +++ b/linker.notes @@ -13,6 +13,11 @@ Updated 2022 3. Fixed bug that caused EQU or GEQU expressions with non-constant operands to be evaluated incorrectly. + 4. The numeric value in an ORG record is now treated as a signed + offset from the current location, consistent with its + definition in the GS/OS Reference. However, negative offset + values are not supported and will produce an error. + 2.0.6 1. The linker could give a spurious error about the relative address calculation for a BRL instruction if it branched forward or backward more than 32 KB. Since the address @@ -69,7 +74,9 @@ Updated 2022 -- Documentation Update ----------------------------------------------------- -No changes. +ORCA/M Manual, p. 492 + +The operand in an ORG record is a signed offset from the current location, not an absolute address. (This is consistent with the definition in the GS/OS Reference, and with the behavior of ORCA/M and other assemblers and linkers.) -- Changes introduced in ORCA/Linker 2.1.0 ---------------------------------- diff --git a/pass1.asm b/pass1.asm index b18a290..24a5a34 100644 --- a/pass1.asm +++ b/pass1.asm @@ -137,13 +137,12 @@ DoOrg private sta r0 ldy #3 lda [sp],Y - sta r2+2 + sta r2 add4 sp,#5 - sub4 r0,loadOrg get the disp from the segment start - cmpl pc,r0 - bge lb1 if the disp is greater than the pc then - move4 r0,pc update the pc + lda r2 + bmi lb1 if the disp is positive + add4 pc,r0 update the pc lb1 anop rts end diff --git a/pass2.asm b/pass2.asm index 07ad2ff..bae0513 100644 --- a/pass2.asm +++ b/pass2.asm @@ -643,13 +643,12 @@ DoOrg private ldy #1 get the value lda [sp],Y - sta r4 + sta r0 ldy #3 lda [sp],Y - sta r6 + sta r2 add4 sp,#5 skip the op code & operand - sub4 pc,r4,r0 calculate the space to insert - lda r2 if space < 0 then + lda r2 if disp < 0 then bpl lb1 ph4 #0 Error(NULL,3) ph2 #3