From f6cba4b1cfa086f06c2e0afad8111cca3142fac2 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 30 Mar 2020 08:25:22 -0400 Subject: [PATCH] forth: Forth-ify "QUIT" --- emul/forth/z80c.bin | Bin 1170 -> 1228 bytes forth/forth.asm | 32 +++++--------------------------- forth/icore.fs | 4 +++- forth/z80c.fs | 5 +++++ 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 9b8cb461e5604d18e06726f964651a9cc31107a1..1b87eeb6ccb22a878eecbc196aa3c1ab1d83bf7c 100644 GIT binary patch delta 288 zcmbQld4_X?5tD#MQEG8eu%-Y5yEwyLMTQTP^_k+sKMF78R^{ekc4P_+^$ZbWVBup> zU|?YQ#VWwo%%Q~K=@;S}6cFSZ!cfCv$<_f>=IG=f6r#$&%EwT^@sq=mNuwaKs5n)V zpMjl^!G-lO%Y7ym21U-v`Z-@AMPLI zBEi7M$1sy6k!>?4M57~zuu&(FXJ05ldtUjP6A delta 186 zcmX@ZIf-+F5z}N>rWlDh5k8(t+#Jk~OpZ?eK_S8ntb7aw905#|A25kAJ?EJGgGqsL z{bWgIEfzseAlIE)TV^_k0s|w1I{RT3N2U<}aQ`3|2?jPkhM6phY?YJynB@egaJI1t zut5|-ME5eAF>apxg;`lTn)4#7D%*Wl0X9b_Prne?pnxFP5PJqrK8DScjaWQ{ZMYnn ftYjG)`51n2DlqUda4>J4+{>cK^ni2n1{N6r_EIaw diff --git a/forth/forth.asm b/forth/forth.asm index bbc0764..ce5732c 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -123,7 +123,9 @@ LIT: .dw INITIAL_SP .dw WORDBUF jp flagsToBC +; 35 jp strcmp + .dw RS_ADDR ; *** Code *** forthMain: @@ -174,15 +176,7 @@ forthMain: .bootName: .db "BOOT", 0 -INTERPRET: - .dw compiledWord - .dw LIT - .db "INTERPRET", 0 - .dw FIND_ - .dw DROP - .dw EXECUTE - -.fill 50 +.fill 68 ; STABLE ABI ; Offset: 00cd @@ -632,23 +626,7 @@ EXIT: call popRSIP jp next -; ( R:I -- ) - .db "QUIT" - .dw $-EXIT - .db 4 -QUIT: - .dw compiledWord - .dw NUMBER - .dw 0 - .dw FLAGS_ - .dw STORE - .dw .private - .dw INTERPRET - -.private: - .dw nativeWord - ld ix, RS_ADDR - jp next +.fill 30 abortUnderflow: ld hl, .name @@ -659,7 +637,7 @@ abortUnderflow: .db "(uflw)", 0 .db "(br)" - .dw $-QUIT + .dw $-EXIT .db 4 BR: .dw nativeWord diff --git a/forth/icore.fs b/forth/icore.fs index 1627095..0f31198 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -49,7 +49,9 @@ , ( write! ) ; IMMEDIATE -: ABORT _c (resSP) QUIT ; +: QUIT 0 FLAGS ! _c (resRS) LIT< INTERPRET (find) DROP EXECUTE ; + +: ABORT _c (resSP) _c QUIT ; ( This is only the "early parser" in earlier stages. No need for an abort message ) diff --git a/forth/z80c.fs b/forth/z80c.fs index a9fe873..3846598 100644 --- a/forth/z80c.fs +++ b/forth/z80c.fs @@ -290,6 +290,11 @@ CODE (resSP) SP JTBL 28 + @ LDdd(nn), ;CODE +CODE (resRS) + ( RS_ADDR == JTBL+38 ) + IX JTBL 38 + @ LDddnn, +;CODE + CODE SCMP DE POPqq, HL POPqq,