mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:18:07 +11:00
forth: Forth-ify "(find)"
This commit is contained in:
parent
de3da19333
commit
5b01f797fc
Binary file not shown.
@ -107,7 +107,10 @@
|
|||||||
; comment indicating what that number refers to.
|
; comment indicating what that number refers to.
|
||||||
; We're at 0 here
|
; We're at 0 here
|
||||||
jp forthMain
|
jp forthMain
|
||||||
.fill 0x08-$
|
; 3
|
||||||
|
jp find
|
||||||
|
.dw 0 ; unused
|
||||||
|
; 8
|
||||||
jp sysvarWord
|
jp sysvarWord
|
||||||
jp cellWord
|
jp cellWord
|
||||||
jp compiledWord
|
jp compiledWord
|
||||||
@ -721,32 +724,10 @@ SCPY:
|
|||||||
jp next
|
jp next
|
||||||
|
|
||||||
|
|
||||||
.db "(find)"
|
.fill 460
|
||||||
.dw $-SCPY
|
|
||||||
.db 6
|
|
||||||
; STABLE ABI
|
|
||||||
; Offset: 047c
|
|
||||||
.out $
|
|
||||||
FIND_:
|
|
||||||
.dw nativeWord
|
|
||||||
pop hl
|
|
||||||
call find
|
|
||||||
jr z, .found
|
|
||||||
; not found
|
|
||||||
push hl
|
|
||||||
ld de, 0
|
|
||||||
push de
|
|
||||||
jp next
|
|
||||||
.found:
|
|
||||||
push de
|
|
||||||
ld de, 1
|
|
||||||
push de
|
|
||||||
jp next
|
|
||||||
|
|
||||||
.fill 427
|
|
||||||
|
|
||||||
.db "_bend"
|
.db "_bend"
|
||||||
.dw $-FIND_
|
.dw $-SCPY
|
||||||
.db 5
|
.db 5
|
||||||
; Offset: 0647
|
; Offset: 0647
|
||||||
.out $
|
.out $
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
: QUIT
|
: QUIT
|
||||||
0 _c FLAGS _c ! _c (resRS)
|
0 _c FLAGS _c ! _c (resRS)
|
||||||
LIT< INTERPRET (find) _c DROP EXECUTE
|
LIT< INTERPRET _c (find) _c DROP EXECUTE
|
||||||
;
|
;
|
||||||
|
|
||||||
: ABORT _c (resSP) _c QUIT ;
|
: ABORT _c (resSP) _c QUIT ;
|
||||||
@ -163,7 +163,7 @@
|
|||||||
: INTERPRET
|
: INTERPRET
|
||||||
BEGIN
|
BEGIN
|
||||||
_c WORD
|
_c WORD
|
||||||
(find)
|
_c (find)
|
||||||
IF
|
IF
|
||||||
1 _c FLAGS _c !
|
1 _c FLAGS _c !
|
||||||
EXECUTE
|
EXECUTE
|
||||||
@ -175,11 +175,12 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
: BOOT
|
: BOOT
|
||||||
LIT< (parse) (find) _c DROP _c (parse*) _c !
|
LIT< (parse) _c (find) _c DROP _c (parse*) _c !
|
||||||
LIT< (c<) (find) _c NOT IF LIT< KEY (find) _c DROP THEN
|
LIT< (c<) _c (find) _c
|
||||||
|
NOT IF LIT< KEY _c (find) _c DROP THEN
|
||||||
( 48 == CINPTR )
|
( 48 == CINPTR )
|
||||||
[ 48 @ LITN ] _c !
|
[ 48 @ LITN ] _c !
|
||||||
LIT< (c<$) (find) IF EXECUTE ELSE _c DROP THEN
|
LIT< (c<$) _c (find) IF EXECUTE ELSE _c DROP THEN
|
||||||
_c INTERPRET
|
_c INTERPRET
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -201,7 +202,7 @@
|
|||||||
[ 32 , 14 , ] ,
|
[ 32 , 14 , ] ,
|
||||||
BEGIN
|
BEGIN
|
||||||
_c WORD
|
_c WORD
|
||||||
(find)
|
_c (find)
|
||||||
( is word )
|
( is word )
|
||||||
IF _c DUP _c IMMED? IF EXECUTE ELSE , THEN
|
IF _c DUP _c IMMED? IF EXECUTE ELSE , THEN
|
||||||
( maybe number )
|
( maybe number )
|
||||||
|
@ -376,3 +376,19 @@ CODE (parsed)
|
|||||||
DE 1 LDddnn,
|
DE 1 LDddnn,
|
||||||
DE PUSHqq,
|
DE PUSHqq,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
|
CODE (find)
|
||||||
|
HL POPqq,
|
||||||
|
( 3 == find )
|
||||||
|
3 CALLnn,
|
||||||
|
10 JRZe, ( found )
|
||||||
|
( not found )
|
||||||
|
HL PUSHqq,
|
||||||
|
DE 0 LDddnn,
|
||||||
|
DE PUSHqq,
|
||||||
|
JPNEXT,
|
||||||
|
( found )
|
||||||
|
DE PUSHqq,
|
||||||
|
DE 1 LDddnn,
|
||||||
|
DE PUSHqq,
|
||||||
|
;CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user