瀏覽代碼

forth: Forth-ify "!"

pull/95/head
Virgil Dupras 4 年之前
父節點
當前提交
162ff2c5cb
共有 4 個檔案被更改,包括 19 行新增25 行删除
  1. 二進制
      emul/forth/z80c.bin
  2. +2
    -17
      forth/forth.asm
  3. +8
    -8
      forth/icore.fs
  4. +9
    -0
      forth/z80c.fs

二進制
emul/forth/z80c.bin 查看文件


+ 2
- 17
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 $

+ 8
- 8
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
;


+ 9
- 0
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,


Loading…
取消
儲存