Re: Return to BASIC
Posted: Fri Sep 16, 2016 3:46 pm
Code: Select all
LD HL,(ERR_SP)
LD SP,HL
RET
___________________________________________________________________________
Code: Select all
RST 08H
DEFB 0xFF
Discussion forums for users of the Sinclair 8-bit range of computers - ZX80, ZX81, ZX Spectrum, Z88, clones...
https://sinclairzxworld.com/
Code: Select all
LD HL,(ERR_SP)
LD SP,HL
RET
Code: Select all
RST 08H
DEFB 0xFF
This occur because Toddy Forth modifies the system stack (SP) so in a return to BASIC the system references are lost.mrtinb wrote:Result in a cold start of Toddy Forth only.Code: Select all
LD HL,(ERR_SP) LD SP,HL RET
Has this picture for a while, and the resets the ZX81 and return to [K] and empty LIST.Code: Select all
RST 08H DEFB 0xFF
Code: Select all
: BYE 0 EXECUTE ;
The system variables are not changed, but the stack contents are overwrited by the forth return stack. To return to BASIC with RST $08 the stack contents should be restored.PokeMon wrote:I guess that the basic context (system variables) are more or less destroyed when starting Toddy Forth.
If just the stack point would be modified, RST $8, DEFB 0xFF should work to switch back.
It just set the stack new and restart BASIC but doesn't restore all system variables.
Try this:mrtinb wrote:I had hoped the program was still in BASIC, so I could jump back to Forth with a RUN or GOTO.
Code: Select all
ld hl,($4004)
dec hl
ld (hl),$3e
dec hl
ld sp,hl
ld hl,$0676
push hl
rst 08H ; ERROR-1
defb $0C ; Error Report: BREAK - CONT repeats