From 162ff2c5cb026ac865de03ef0f966b5299494b64 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 30 Mar 2020 14:09:39 -0400 Subject: [PATCH] forth: Forth-ify "!" --- emul/forth/z80c.bin | Bin 1318 -> 1335 bytes forth/forth.asm | 19 ++----------------- forth/icore.fs | 16 ++++++++-------- forth/z80c.fs | 9 +++++++++ 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index e46633f426d96222f609a7b0fad7825c4ef66c1d..56f627d934f161ee166335c896d6f2b0438a9c27 100644 GIT binary patch delta 382 zcmZ3+wVi823Zt;15(A?+!^4YbWf_W-kibRO1MHXCL8Jl$BZD)LwVvIPDLmL-nt>UlT#@1Bj_2hjl3c{IO3JiP<9Lx~2#DGE4Hu)oquoB423f%Qf cxBfdaS(`F6f_&!4#K9cPQ49>Iczy;(07(2?!2kdN delta 379 zcmdnawTx>+3L}$)(&lo;CProfwvChjFv&B|<4~V0$1JYo&*{jdQBahbSE4D(z|O~z z$aaZ6k?kh-oXqM(BT6KTx4C( zeuy1JDljlII0IP%K&|1y_RM9mzJpnTfdR~_XX0RZ$GU!UJBz-g0GkqnMzW2HCId({2SW#QJrfH< zG25)k=UEgyBDfS7_!u~tA!dmIgQS!Lp^5{jmJ4JOFaY?u>zQu-cVx0QWoQKX(~*gT O*@vST==XSj21WoH@l`(n diff --git a/forth/forth.asm b/forth/forth.asm index d3aad8c..3a89e98 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -841,26 +841,11 @@ SYSVNXT_: .dw sysvarWord .dw SYSVNXT -; ( n a -- ) - .db "!" - .dw $-SYSVNXT_ - .db 1 -; STABLE ABI -; Offset: 0610 -.out $ -STORE: - .dw nativeWord - pop iy - pop hl - call chkPS - ld (iy), l - ld (iy+1), h - jp next -.fill 30 +.fill 51 .db "_bend" - .dw $-STORE + .dw $-SYSVNXT_ .db 5 ; Offset: 0647 .out $ diff --git a/forth/icore.fs b/forth/icore.fs index 6be7318..bfc7c76 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -56,7 +56,7 @@ ; IMMEDIATE : QUIT - 0 FLAGS ! _c (resRS) + 0 FLAGS _c ! _c (resRS) LIT< INTERPRET (find) _c DROP EXECUTE ; @@ -91,7 +91,7 @@ : C, HERE _c @ _c C! - HERE _c @ 1 _c + HERE ! + HERE _c @ 1 _c + HERE _c ! ; ( The NOT is to normalize the negative/positive numbers to 1 @@ -114,7 +114,7 @@ BEGIN ( We take advantage of the fact that char MSB is always zero to pre-write our null-termination ) - _c OVER ! ( a ) + _c OVER _c ! ( a ) 1 _c + ( a+1 ) _c C< ( a c ) _c DUP _c WS? @@ -131,13 +131,13 @@ SCPY ( h ) ( Adjust HERE -1 because SCPY copies the null ) HERE _c @ 1 _c - ( h h' ) - _c DUP HERE ! ( h h' ) + _c DUP HERE _c ! ( h h' ) _c SWAP _c - ( sz ) ( write prev value ) HERE _c @ CURRENT _c @ _c - , ( write size ) _c C, - HERE _c @ CURRENT ! + HERE _c @ CURRENT _c ! ; : INTERPRET @@ -145,9 +145,9 @@ _c WORD (find) IF - 1 FLAGS ! + 1 FLAGS _c ! EXECUTE - 0 FLAGS ! + 0 FLAGS _c ! ELSE (parse*) _c @ EXECUTE THEN @@ -157,7 +157,7 @@ : BOOT LIT< (c<) (find) NOT IF LIT< KEY (find) _c DROP THEN ( JTBL+40 == CINPTR ) - [ JTBL 40 + @ LITN ] ! + [ JTBL 40 + @ LITN ] _c ! LIT< (c<$) (find) IF EXECUTE ELSE _c DROP THEN _c INTERPRET ; diff --git a/forth/z80c.fs b/forth/z80c.fs index 49b5cdc..ed16604 100644 --- a/forth/z80c.fs +++ b/forth/z80c.fs @@ -213,6 +213,15 @@ CODE /MOD BC PUSHqq, ;CODE +CODE ! + HL POPqq, + DE POPqq, + chkPS, + (HL) E LDrr, + HL INCss, + (HL) D LDrr, +;CODE + CODE @ HL POPqq, chkPS,