Return to BASIC

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Return to BASIC

Post by mrtinb »

Code: Select all

LD HL,(ERR_SP)
LD SP,HL
RET
Result in a cold start of Toddy Forth only.
2016_09_16_15_37_47_Clipboard.gif
2016_09_16_15_37_47_Clipboard.gif (26.8 KiB) Viewed 4257 times
___________________________________________________________________________

Code: Select all

RST 08H
DEFB 0xFF
Has this picture for a while, and the resets the ZX81 and return to [K] and empty LIST.
2016_09_16_15_40_38_Clipboard.gif
2016_09_16_15_40_38_Clipboard.gif (36.96 KiB) Viewed 4257 times
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Return to BASIC

Post by PokeMon »

Toddy Forth has some special modifications - so I think you couldn't use BASIC context here.
Not sure what you really want to do.
You could try to contact Kelly Murta, his name here is kmurta (for private message for example).
Sometimes he is online - from time to time but think will answer on messages. ;)
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Return to BASIC

Post by kmurta »

mrtinb wrote:

Code: Select all

LD HL,(ERR_SP)
LD SP,HL
RET
Result in a cold start of Toddy Forth only.

Code: Select all

RST 08H
DEFB 0xFF
Has this picture for a while, and the resets the ZX81 and return to [K] and empty LIST.
This occur because Toddy Forth modifies the system stack (SP) so in a return to BASIC the system references are lost.

I do not know exactly what you want to do, but I think that a good definition for the word BYE can be this:

Code: Select all

: BYE 0 EXECUTE ;
or you can simply type 0 EXECUTE in interpret mode to restart the BASIC

Is not this your intention?
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Return to BASIC

Post by mrtinb »

I had hoped the program was still in BASIC, so I could jump back to Forth with a RUN or GOTO.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Return to BASIC

Post by PokeMon »

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.
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Return to BASIC

Post by kmurta »

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.
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.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Return to BASIC

Post by kmurta »

mrtinb wrote:I had hoped the program was still in BASIC, so I could jump back to Forth with a RUN or GOTO.
Try this:

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
2016-09-22.png
2016-09-22.png (71.25 KiB) Viewed 4157 times
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Return to BASIC

Post by mrtinb »

Tada! 8-) Wow! :shock: Thank you! :D
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Post Reply