Code: Select all
ERR_SP .equ $4002
RAMTOP .equ $4004
NEXTLINE .equ $0676
out ($fd),a ; turn off the nmi generator during stack move
ld hl,REQUIRED_RAMTOP_VALUE ** EDIT - to avoid confusion over use of square brackets **
ld (RAMTOP),hl ; save ramtop value in the sytem variable
dec hl ; point to the first byte below ramtop
ld (hl),$3e ; and mark it with 3e
dec hl
ld sp,hl ; load the stack pointer
dec hl
dec hl
ld (ERR_SP),hl ; load the error stack pointer
out ($fe),a ; turn on the nmi generator
jp NEXTLINE ; return to BASIC - we can't RET as there's no return address.