Return to BASIC

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

Re: Return to BASIC

Post by mrtinb » Fri Sep 16, 2016 3:46 pm

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 1931 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 1931 times
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

User avatar
PokeMon
Posts: 2225
Joined: Sat Sep 17, 2011 6:48 pm

Re: Return to BASIC

Post by PokeMon » Fri Sep 16, 2016 7:17 pm

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: 147
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Return to BASIC

Post by kmurta » Wed Sep 21, 2016 10:04 pm

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 Ringo R470, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org

User avatar
mrtinb
Posts: 1067
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Return to BASIC

Post by mrtinb » Thu Sep 22, 2016 7:04 am

I had hoped the program was still in BASIC, so I could jump back to Forth with a RUN or GOTO.
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

User avatar
PokeMon
Posts: 2225
Joined: Sat Sep 17, 2011 6:48 pm

Re: Return to BASIC

Post by PokeMon » Thu Sep 22, 2016 1:50 pm

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: 147
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Return to BASIC

Post by kmurta » Fri Sep 23, 2016 4:25 am

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 Ringo R470, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org

User avatar
kmurta
Posts: 147
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Return to BASIC

Post by kmurta » Fri Sep 23, 2016 4:40 am

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 1831 times
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Ringo R470, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org

User avatar
mrtinb
Posts: 1067
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Return to BASIC

Post by mrtinb » Fri Sep 23, 2016 6:49 am

Tada! 8-) Wow! :shock: Thank you! :D
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

Post Reply