1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 14:58:06 +11:00

Make (find) 2-layered, the lower layer having CURRENT as a param

This commit is contained in:
Virgil Dupras 2020-04-09 11:20:54 -04:00
parent 66dc621919
commit 1b6286dcfe
5 changed files with 13 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@ -123,14 +123,16 @@ PC ORG @ 1 + ! ( main )
0x08 LDHL(nn), 0x08 LDHL(nn),
RAMSTART 0x02 + LD(nn)HL, ( RAM+02 == CURRENT ) RAMSTART 0x02 + LD(nn)HL, ( RAM+02 == CURRENT )
RAMSTART 0x04 + LD(nn)HL, ( RAM+04 == HERE ) RAMSTART 0x04 + LD(nn)HL, ( RAM+04 == HERE )
EXDEHL,
HL L1 @ LDddnn, HL L1 @ LDddnn,
0x03 CALLnn, ( 03 == find ) 0x03 CALLnn, ( 03 == find )
DE PUSHqq, DE PUSHqq,
L2 @ 2 + JPnn, L2 @ 2 + JPnn,
PC ORG @ 4 + ! ( find ) PC ORG @ 4 + ! ( find )
( Find the entry corresponding to word where (HL) points to ( Find the entry corresponding to word name where (HL) points
and sets DE to point to that entry. Z if found, NZ if not. to in dictionary having its tip at DE and sets DE to point
to that entry. Z if found, NZ if not.
) )
BC PUSHqq, BC PUSHqq,
@ -154,7 +156,6 @@ PC ORG @ 4 + ! ( find )
adjust. Because the compare loop pre-decrements, instead adjust. Because the compare loop pre-decrements, instead
of DECing HL twice, we DEC it once. ) of DECing HL twice, we DEC it once. )
HL DECss, HL DECss,
DE RAMSTART 0x02 + LDdd(nn), ( RAM+02 == CURRENT )
L3 BSET ( inner ) L3 BSET ( inner )
( DE is a wordref, first step, do our len correspond? ) ( DE is a wordref, first step, do our len correspond? )
HL PUSHqq, ( --> lvl 1 ) HL PUSHqq, ( --> lvl 1 )
@ -241,6 +242,7 @@ PC ORG @ 0x15 + ! ( popRS )
'(' A, 'u' A, 'f' A, 'l' A, 'w' A, ')' A, 0 A, '(' A, 'u' A, 'f' A, 'l' A, 'w' A, ')' A, 0 A,
L1 BSET ( abortUnderflow ) L1 BSET ( abortUnderflow )
HL PC 7 - LDddnn, HL PC 7 - LDddnn,
DE RAMSTART 0x02 + LDdd(nn), ( RAM+02 == CURRENT )
0x03 CALLnn, ( find ) 0x03 CALLnn, ( find )
DE PUSHqq, DE PUSHqq,
L2 @ 2 + JPnn, ( EXECUTE, skip nativeWord ) L2 @ 2 + JPnn, ( EXECUTE, skip nativeWord )
@ -366,7 +368,7 @@ PC ORG @ 0x22 + ! ( litWord )
JPNEXT, JPNEXT,
( filler ) ( filler )
NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
( DICT HOOK ) ( DICT HOOK )
( This dummy dictionary entry serves two purposes: ( This dummy dictionary entry serves two purposes:

View File

@ -37,6 +37,9 @@
: HERE 0x04 RAM+ ; : HERE 0x04 RAM+ ;
: CURRENT 0x02 RAM+ ; : CURRENT 0x02 RAM+ ;
( w -- a f )
: (find) CURRENT @ SWAP _find ;
: QUIT : QUIT
0 FLAGS ! (resRS) 0 FLAGS ! (resRS)
LIT< INTERPRET (find) DROP EXECUTE LIT< INTERPRET (find) DROP EXECUTE

View File

@ -354,8 +354,10 @@ CODE CMP
BC PUSHqq, BC PUSHqq,
;CODE ;CODE
CODE (find) ( cur w -- a f )
HL POPqq, CODE _find
HL POPqq, ( w )
DE POPqq, ( cur )
chkPS, chkPS,
( 3 == find ) ( 3 == find )
3 CALLnn, 3 CALLnn,