The sequence shown in your screenshot is, indeed, this one:
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
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
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
-taBa 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).