Browse Source

forth: Forth-ify "@"

pull/95/head
Virgil Dupras 4 years ago
parent
commit
8ef9e7d0da
5 changed files with 22 additions and 23 deletions
  1. BIN
      emul/forth/z80c.bin
  2. +2
    -14
      forth/forth.asm
  3. +9
    -9
      forth/icore.fs
  4. +1
    -0
      forth/z80a.fs
  5. +10
    -0
      forth/z80c.fs

BIN
emul/forth/z80c.bin View File


+ 2
- 14
forth/forth.asm View File

@@ -857,22 +857,10 @@ STORE:
ld (iy+1), h
jp next

; ( a -- n )
.db "@"
.dw $-STORE
.db 1
FETCH:
.dw nativeWord
pop hl
call chkPS
call intoHL
push hl
jp next

.fill 13
.fill 30

.db "_bend"
.dw $-FETCH
.dw $-STORE
.db 5
; Offset: 0647
.out $

+ 9
- 9
forth/icore.fs View File

@@ -86,12 +86,12 @@

: C<
( JTBL+40 == CINPTR )
[ JTBL 40 + @ LITN ] @ EXECUTE
[ JTBL 40 + @ LITN ] _c @ EXECUTE
;

: C,
HERE @ _c C!
HERE @ 1 _c + HERE !
HERE _c @ _c C!
HERE _c @ 1 _c + HERE !
;

( The NOT is to normalize the negative/positive numbers to 1
@@ -126,18 +126,18 @@
;

: (entry)
HERE @ ( h )
HERE _c @ ( h )
_c WORD ( h s )
SCPY ( h )
( Adjust HERE -1 because SCPY copies the null )
HERE @ 1 _c - ( h h' )
HERE _c @ 1 _c - ( h h' )
_c DUP HERE ! ( h h' )
_c SWAP _c - ( sz )
( write prev value )
HERE @ CURRENT @ _c - ,
HERE _c @ CURRENT _c @ _c - ,
( write size )
_c C,
HERE @ CURRENT !
HERE _c @ CURRENT !
;

: INTERPRET
@@ -149,7 +149,7 @@
EXECUTE
0 FLAGS !
ELSE
(parse*) @ EXECUTE
(parse*) _c @ EXECUTE
THEN
AGAIN
;
@@ -185,7 +185,7 @@
( is word )
IF _c DUP _c IMMED? IF EXECUTE ELSE , THEN
( maybe number )
ELSE (parse*) @ EXECUTE _c LITN THEN
ELSE (parse*) _c @ EXECUTE _c LITN THEN
AGAIN
; IMMEDIATE



+ 1
- 0
forth/z80a.fs View File

@@ -37,6 +37,7 @@

( -- )
: OP1 CREATE C, DOES> C@ A, ;
0xeb OP1 EXDEHL,
0x76 OP1 HALT,
0xc9 OP1 RET,
0x17 OP1 RLA,


+ 10
- 0
forth/z80c.fs View File

@@ -213,6 +213,16 @@ CODE /MOD
BC PUSHqq,
;CODE

CODE @
HL POPqq,
chkPS,
E (HL) LDrr,
HL INCss,
D (HL) LDrr,
EXDEHL,
HL PUSHqq,
;CODE

CODE C!
HL POPqq,
DE POPqq,


Loading…
Cancel
Save