mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 05:08:05 +11:00
Stop LOADing on ABORT
This is done by adding a "C<* override" layer that is reset to 0 on ABORT. The problem was that when ABORT happened during a LOAD, we had a resetted RSP and started from a clean INTERPRET, but LOAD didn't have the opportunity to restore C<*, which caused it to continue interpreting from the faulty BLK. With a C<* override, we don't need to *restore* C<*, we just need to clear the override.
This commit is contained in:
parent
af39b37dd1
commit
816563e2e3
2
blk/081
2
blk/081
@ -3,7 +3,7 @@ RAMSTART INITIAL_SP +53 readln's variables
|
||||
+02 CURRENT +55 adev's variables
|
||||
+04 HERE +57 blk's variables
|
||||
+06 C<?* +59 z80a's variables
|
||||
+08 FUTURE USES +5b FUTURE USES
|
||||
+08 C<* override +5b FUTURE USES
|
||||
+0a PARSEPTR +70 DRIVERS
|
||||
+0c C<* +80 RAMEND
|
||||
+0e WORDBUF
|
||||
|
4
blk/082
4
blk/082
@ -9,8 +9,8 @@ IP is the Interpreter Pointer
|
||||
|
||||
PARSEPTR holds routine address called on (parse)
|
||||
|
||||
C<* holds routine address called on C<
|
||||
|
||||
C<* holds routine address called on C<. If the C<* override
|
||||
at 0x08 is nonzero, this routine is called instead.
|
||||
|
||||
|
||||
(cont.)
|
||||
|
6
blk/393
6
blk/393
@ -7,5 +7,9 @@
|
||||
( w -- a f )
|
||||
: (find) CURRENT @ SWAP _find ;
|
||||
|
||||
: QUIT (resRS) LIT< INTERPRET (find) DROP EXECUTE ;
|
||||
: QUIT
|
||||
(resRS)
|
||||
0 0x08 RAM+ ! ( 08 == C<* override )
|
||||
LIT< INTERPRET (find) DROP EXECUTE
|
||||
;
|
||||
394 407 LOADR
|
||||
|
6
blk/398
6
blk/398
@ -3,7 +3,11 @@
|
||||
: (parse) (parsed) NOT IF ABORT THEN ;
|
||||
|
||||
: C<? 0x06 RAM+ @ DUP 2 > IF EXECUTE THEN ( 06 == C<?* ) ;
|
||||
: C< 0x0c RAM+ @ EXECUTE ( 0c == C<* ) ;
|
||||
: C<
|
||||
0x08 RAM+ @ ( 08 == C<* override )
|
||||
DUP NOT IF DROP 0x0c RAM+ @ THEN ( 0c == C<* )
|
||||
EXECUTE
|
||||
;
|
||||
|
||||
: , HERE @ ! HERE @ 2+ HERE ! ;
|
||||
|
||||
|
1
blk/405
1
blk/405
@ -3,6 +3,7 @@
|
||||
LIT< (parse) (find) DROP (parse*) !
|
||||
( 2e == SYSTEM SCRATCHPAD )
|
||||
CURRENT @ 0x2e RAM+ !
|
||||
0 0x08 RAM+ ! ( 08 == C<* override )
|
||||
( 0c == C<* )
|
||||
LIT< (boot<) (find) DROP 0x0c RAM+ !
|
||||
( boot< always has a char waiting. 06 == C<?* )
|
||||
|
Binary file not shown.
16
forth/blk.fs
16
forth/blk.fs
@ -61,28 +61,28 @@
|
||||
;
|
||||
|
||||
: LOAD
|
||||
( save BLK>, CINPTR and boot< ptr to RSP )
|
||||
( save BLK>, C<* override and boot< ptr to RSP )
|
||||
BLK> @ >R
|
||||
0x0c RAM+ @ >R
|
||||
0x08 RAM+ @ >R
|
||||
0x2e RAM+ @ >R
|
||||
BLK@
|
||||
( Point to beginning of BLK )
|
||||
BLK( 0x2e RAM+ !
|
||||
( 0c == CINPTR )
|
||||
['] _ 0x0c RAM+ !
|
||||
( 08 == C<* override )
|
||||
['] _ 0x08 RAM+ !
|
||||
INTERPRET
|
||||
R> 0x2e RAM+ !
|
||||
( Before we restore CINPTR, are we restoring it to "_"?
|
||||
( Before we restore C<* are we restoring it to "_"?
|
||||
if yes, it means we're in a nested LOAD which means we
|
||||
should also load back the saved BLK>. Otherwise, we can
|
||||
ignore the BLK> from RSP. )
|
||||
I 0x0c RAM+ @ = IF
|
||||
I 0x08 RAM+ @ = IF
|
||||
( nested load )
|
||||
R> DROP ( CINPTR )
|
||||
R> DROP ( C<* )
|
||||
R> BLK@
|
||||
ELSE
|
||||
( not nested )
|
||||
R> 0x0c RAM+ !
|
||||
R> 0x08 RAM+ !
|
||||
R> DROP ( BLK> )
|
||||
THEN
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user