diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index cdba5f0..03f9ff6 100644 Binary files a/emul/forth/z80c.bin and b/emul/forth/z80c.bin differ diff --git a/forth/forth.asm b/forth/forth.asm index 6b323d9..96ae17e 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -107,7 +107,10 @@ ; comment indicating what that number refers to. ; We're at 0 here jp forthMain -.fill 0x08-$ +; 3 + jp find + .dw 0 ; unused +; 8 jp sysvarWord jp cellWord jp compiledWord @@ -721,32 +724,10 @@ SCPY: jp next - .db "(find)" - .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 +.fill 460 .db "_bend" - .dw $-FIND_ + .dw $-SCPY .db 5 ; Offset: 0647 .out $ diff --git a/forth/icore.fs b/forth/icore.fs index a6f5589..a8d53b2 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -77,7 +77,7 @@ : QUIT 0 _c FLAGS _c ! _c (resRS) - LIT< INTERPRET (find) _c DROP EXECUTE + LIT< INTERPRET _c (find) _c DROP EXECUTE ; : ABORT _c (resSP) _c QUIT ; @@ -163,7 +163,7 @@ : INTERPRET BEGIN _c WORD - (find) + _c (find) IF 1 _c FLAGS _c ! EXECUTE @@ -175,11 +175,12 @@ ; : BOOT - LIT< (parse) (find) _c DROP _c (parse*) _c ! - LIT< (c<) (find) _c NOT IF LIT< KEY (find) _c DROP THEN + LIT< (parse) _c (find) _c DROP _c (parse*) _c ! + LIT< (c<) _c (find) _c + NOT IF LIT< KEY _c (find) _c DROP THEN ( 48 == CINPTR ) [ 48 @ LITN ] _c ! - LIT< (c<$) (find) IF EXECUTE ELSE _c DROP THEN + LIT< (c<$) _c (find) IF EXECUTE ELSE _c DROP THEN _c INTERPRET ; @@ -201,7 +202,7 @@ [ 32 , 14 , ] , BEGIN _c WORD - (find) + _c (find) ( is word ) IF _c DUP _c IMMED? IF EXECUTE ELSE , THEN ( maybe number ) diff --git a/forth/z80c.fs b/forth/z80c.fs index ca4f799..0f30aed 100644 --- a/forth/z80c.fs +++ b/forth/z80c.fs @@ -376,3 +376,19 @@ CODE (parsed) DE 1 LDddnn, DE PUSHqq, ;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