Change C<? mechanic
It's now a simple flag updated by the C< implementation. No more routine pointer. The goal is to avoid tons of "ok" during a LOAD operation.
This commit is contained in:
parent
4160c8ebbf
commit
389b23fe1a
6
blk/083
6
blk/083
@ -1,5 +1,6 @@
|
||||
C<?* is a pointer to a word being called by C<?. If 0 or 1,
|
||||
will return that value as-is.
|
||||
C<? is a flag indicating whether a character is waiting in the
|
||||
input stream. 1 means yes, 0 means no. It is the responsibility
|
||||
of C<* to update that flag.
|
||||
|
||||
WORDBUF is the buffer used by WORD
|
||||
|
||||
@ -12,5 +13,4 @@ jump to this address. If you use one of those slots for an
|
||||
interrupt, write a jump to the appropriate offset in that RAM
|
||||
location.
|
||||
|
||||
|
||||
(cont.)
|
||||
|
2
blk/398
2
blk/398
@ -2,7 +2,7 @@
|
||||
for an abort message )
|
||||
: (parse) (parsed) NOT IF ABORT THEN ;
|
||||
|
||||
: C<? 0x06 RAM+ @ DUP 2 > IF EXECUTE THEN ( 06 == C<?* ) ;
|
||||
: C<? 0x06 RAM+ @ ;
|
||||
: C<
|
||||
0x08 RAM+ @ ( 08 == C<* override )
|
||||
DUP NOT IF DROP 0x0c RAM+ @ THEN ( 0c == C<* )
|
||||
|
BIN
emul/z80c.bin
BIN
emul/z80c.bin
Binary file not shown.
@ -61,17 +61,21 @@
|
||||
;
|
||||
|
||||
: LOAD
|
||||
( save BLK>, C<* override and boot< ptr to RSP )
|
||||
( save restorable variables to RSP )
|
||||
BLK> @ >R
|
||||
0x08 RAM+ @ >R
|
||||
0x2e RAM+ @ >R
|
||||
0x06 RAM+ @ >R ( C<? )
|
||||
0x2e RAM+ @ >R ( boot ptr )
|
||||
BLK@
|
||||
( Point to beginning of BLK )
|
||||
BLK( 0x2e RAM+ !
|
||||
( 08 == C<* override )
|
||||
['] _ 0x08 RAM+ !
|
||||
( While we interpret, don't print "ok" after every word )
|
||||
1 0x06 RAM+ ! ( 06 == C<? )
|
||||
INTERPRET
|
||||
R> 0x2e RAM+ !
|
||||
R> 0x06 RAM+ !
|
||||
( 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
|
||||
|
@ -59,15 +59,18 @@
|
||||
LF IN( IN> !
|
||||
;
|
||||
|
||||
: RDLN<? IN> @ C@ ;
|
||||
|
||||
( And finally, implement a replacement for the (c<) routine )
|
||||
( And finally, implement C<* )
|
||||
: RDLN<
|
||||
RDLN<? ( c )
|
||||
( not EOL? good, inc and return )
|
||||
DUP IF 1 IN> +! EXIT THEN ( c )
|
||||
( EOL ? readline. we still return typed char though )
|
||||
(rdln) ( c )
|
||||
IN> @ C@
|
||||
DUP IF
|
||||
( not EOL? good, inc and return )
|
||||
1 IN> +!
|
||||
ELSE
|
||||
( EOL ? readline. we still return null though )
|
||||
(rdln)
|
||||
THEN
|
||||
( update C<? flag )
|
||||
IN> @ C@ 0 > 0x06 RAM+ ! ( 06 == C<? )
|
||||
;
|
||||
|
||||
( Initializes the readln subsystem )
|
||||
@ -78,7 +81,7 @@
|
||||
the last typed 0x0a and one for the following NULL. )
|
||||
INBUFSZ 4 + ALLOT
|
||||
(infl)
|
||||
['] RDLN<? 0x06 RAM+ !
|
||||
['] RDLN< 0x0c RAM+ !
|
||||
1 0x06 RAM+ ! ( 06 == C<? )
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user