From 1227ee715537a315fddc3c6a6fe2479ab1583b0f Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 28 Mar 2020 10:25:02 -0400 Subject: [PATCH] forth: Forth-ify "EMIT" --- emul/forth/emul.fs | 2 +- emul/forth/z80c.bin | Bin 922 -> 920 bytes forth/forth.asm | 35 ++++++----------------------------- forth/icore.fs | 2 +- 4 files changed, 8 insertions(+), 31 deletions(-) diff --git a/emul/forth/emul.fs b/emul/forth/emul.fs index 16ec637..0f4607b 100644 --- a/emul/forth/emul.fs +++ b/emul/forth/emul.fs @@ -2,7 +2,7 @@ stdio port is 0 ) -CODE (emit) +CODE EMIT HL POPqq, chkPS, A L LDrr, diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index e16eee8ec3080c235f9e2cbb0700cae8c28ab63b..249c1a8baa53ba3619cc146fec39d1731d1bae74 100644 GIT binary patch delta 94 zcmV-k0HOby2bc%2>H!BuO-WP@00fis0VW0Q5|j%ZlO6(V6|D(D0w{1{a&u)VBLD{u z07M1u2APwd0wMxo36sJCC<7S^nUn1TR1;$g(FG+2-vtl`K>|8A0D%qwg_BeRM)C9+ AeEH!HTWo>D6DGvY!lkov21>q8i3lNhW0&5ko2|)rVaA9(DWho;7 z2Mz#41?~o$lbiw~0jG30WeU*+B?jLG5C%a4IyV4;4giOfQUgXo C02+A! diff --git a/forth/forth.asm b/forth/forth.asm index 51f6bf5..e5e5cd5 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -58,8 +58,6 @@ ; interface in Forth, which we plug in during init. If "(c<)" exists in the ; dict, CINPTR is set to it. Otherwise, we set KEY .equ CINPTR @+2 -; Pointer to (emit) word -.equ EMITPTR @+2 .equ WORDBUF @+2 ; Sys Vars are variables with their value living in the system RAM segment. We ; need this mechanisms for core Forth source needing variables. Because core @@ -146,10 +144,6 @@ forthMain: ld hl, .parseName call find ld (PARSEPTR), de - ; Set up EMITPTR - ld hl, .emitName - call find - ld (EMITPTR), de ; Set up CINPTR ; do we have a (c<) impl? ld hl, .cinName @@ -172,8 +166,6 @@ forthMain: .db "(parse)", 0 .cinName: .db "(c<)", 0 -.emitName: - .db "(emit)", 0 .keyName: .db "KEY", 0 .bootName: @@ -187,8 +179,11 @@ INTERPRET: .dw DROP .dw EXECUTE -.fill 41 +.fill 58 +; STABLE ABI +; Offset: 00cd +.out $ ; *** Collapse OS lib copy *** ; In the process of Forth-ifying Collapse OS, apps will be slowly rewritten to ; Forth and the concept of ASM libs will become obsolete. To facilitate this @@ -660,28 +655,10 @@ abortUnderflow: .name: .db "(uflw)", 0 -.fill 50 - -; STABLE ABI -; Offset: 02aa -.out $ -; ( c -- ) - .db "EMIT" - .dw $-QUIT - .db 4 -EMIT: - .dw compiledWord - .dw NUMBER - .dw EMITPTR - .dw FETCH - .dw EXECUTE - .dw EXIT - - -.fill 71 +.fill 140 .db "," - .dw $-EMIT + .dw $-QUIT .db 1 WR: .dw nativeWord diff --git a/forth/icore.fs b/forth/icore.fs index 8da528c..8891ca8 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -83,7 +83,7 @@ _c C@ ( a c ) ( exit if null ) DUP NOT IF DROP DROP EXIT THEN - EMIT ( a ) + _c EMIT ( a ) 1 + ( a+1 ) AGAIN ;