From a9cf861cfd71ea75ba72d534d57d02a87cb2bf33 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 30 Mar 2020 14:49:20 -0400 Subject: [PATCH] forth: Forth-ify "(parse*)" --- emul/forth/z80c.bin | Bin 1351 -> 1388 bytes forth/forth.asm | 21 +++++---------------- forth/icore.fs | 10 ++++++++-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 8c4ec0e57d3876007d43d182af3d9e72f915163a..ecf78e012944815ac0d55edeb7cc27fa07f6e75c 100644 GIT binary patch delta 245 zcmX@k^@eN1118l55gDEZ+#Jk~Om04o?!m$gtb7a#3>+^UnKTL#i;7dVGzAzqCVyhG zW{jS!$1Kj+JlT!ei+L?)^W@3QA*^3H6WLTIzhRaWwC9@4ww_&qfsw(P9U>~tBFh*z z*^)(>iH&P=9E${yQ_do*?!$S2y@R=)>DGToCMSRY5CaAlJ_aQQh;5n-H7vz!KAh{> zC$D5N^*P7o$mHW0;ui=~bBtAiK>}zx2Q$dER)P$Td<;EY3JiP<9L#ZCH7xg;#26CU b+BohraWH@^U;&EPGjTCMEDW8j#VQK`{>wNo delta 167 zcmaFEb)0L%116yY5gwii+#Jk~Om04o?!m$gtdm)ptr=l}o! diff --git a/forth/forth.asm b/forth/forth.asm index 21a184c..db20979 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -129,6 +129,8 @@ LIT: .dw CINPTR .dw SYSVNXT .dw FLAGS +; 46 + .dw PARSEPTR ; *** Code *** forthMain: @@ -148,10 +150,6 @@ forthMain: ld (CURRENT), hl ld hl, HERE_INITIAL ld (HERE), hl - ; Set up PARSEPTR - ld hl, .parseName - call find - ld (PARSEPTR), de ; Set up SYSVNXT ld hl, SYSVBUF ld (SYSVNXT), hl @@ -160,12 +158,10 @@ forthMain: push de jp EXECUTE+2 -.parseName: - .db "(parse)", 0 .bootName: .db "BOOT", 0 -.fill 89 +.fill 105 ; STABLE ABI ; Offset: 00cd @@ -814,17 +810,10 @@ CURRENT_: .dw sysvarWord .dw CURRENT - .db "(parse*)" - .dw $-CURRENT_ - .db 8 -PARSEPTR_: - .dw sysvarWord - .dw PARSEPTR - -.fill 77 +.fill 92 .db "_bend" - .dw $-PARSEPTR_ + .dw $-CURRENT_ .db 5 ; Offset: 0647 .out $ diff --git a/forth/icore.fs b/forth/icore.fs index 51c0d5c..1461b4a 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -60,6 +60,11 @@ [ JTBL 44 + @ LITN ] ; +: (parse*) + ( JTBL+46 == PARSEPTR ) + [ JTBL 46 + @ LITN ] +; + : QUIT 0 _c FLAGS _c ! _c (resRS) LIT< INTERPRET (find) _c DROP EXECUTE @@ -154,12 +159,13 @@ EXECUTE 0 _c FLAGS _c ! ELSE - (parse*) _c @ EXECUTE + _c (parse*) _c @ EXECUTE THEN AGAIN ; : BOOT + LIT< (parse) (find) _c DROP _c (parse*) _c ! LIT< (c<) (find) NOT IF LIT< KEY (find) _c DROP THEN ( JTBL+40 == CINPTR ) [ JTBL 40 + @ LITN ] _c ! @@ -190,7 +196,7 @@ ( is word ) IF _c DUP _c IMMED? IF EXECUTE ELSE , THEN ( maybe number ) - ELSE (parse*) _c @ EXECUTE _c LITN THEN + ELSE _c (parse*) _c @ EXECUTE _c LITN THEN AGAIN ; IMMEDIATE