Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Potential bug in impl of LOAD "..." CODE
#4
The sequence shown in your screenshot is, indeed, this one:
Code:
    ld hl, 0
    add hl, sp
    ld (TMP_SP), hl   ;; Stores current SP for later
    ld bc, -18
    add hl, sp
    ld sp, hl         ;; Reserves 18 bytes in the stack (like doing PUSH HL 9 times)

LOAD_CONT3:
    ld (TMP_HEADER), hl   ;; Stores current SP Value in TMP_HEADER
    push hl
    pop ix            ;; Make IX to point to this stack space

;; LD-LOOK-H --- RIPPED FROM ROM at 0x767
LD_LOOK_H:
    push ix           
Yes, this looks like a bug in LOAD "" CODE, since it shoud be add hl, bc!
Will send you a fixed version.

Remeber the stack grows down, as you probably already know, and must be set *below* your program. If you compile with
-taB
a BASIC loader will be generated. This BASIC loader will set SP (with CLEAR) correctly. For example, is your programs is at 32768 (the default), there will be a CLEAR 32767 (so the stack will start below this position and never overlap with your compiled code).
Reply


Messages In This Thread
RE: Potential bug in impl of LOAD "..." CODE - by boriel - 03-16-2021, 09:55 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)