forth: Forth-ify "LITN"

This commit is contained in:
Virgil Dupras 2020-03-28 10:38:05 -04:00
parent 1227ee7155
commit 758ec025dc
3 changed files with 12 additions and 20 deletions

Binary file not shown.

View File

@ -714,25 +714,10 @@ DOES:
jp EXIT+2
.fill 51
; ( n -- )
.db "LITN"
.dw $-DOES
.db 4
LITN:
.dw nativeWord
ld hl, (HERE)
ld de, NUMBER
call DEinHL
pop de ; number from stack
call chkPS
call DEinHL
ld (HERE), hl
jp next
.fill 82
.db "SCPY"
.dw $-LITN
.dw $-DOES
.db 4
SCPY:
.dw nativeWord

View File

@ -97,6 +97,12 @@
HERE @ 1 + HERE !
;
: LITN
( JTBL+24 == NUMBER )
JTBL 24 + ,
,
;
: (entry)
HERE @ ( h )
WORD ( h s )
@ -118,15 +124,16 @@
: X
_c (entry)
( JTBL+6 == compiledWord )
[ JTBL 6 + LITN ] ,
( We cannot use LITN as IMMEDIATE because of bootstrapping
issues. JTBL+24 == NUMBER JTBL+6 == compiledWord )
[ JTBL 24 + , JTBL 6 + , ] ,
BEGIN
WORD
(find)
( is word )
IF DUP _c IMMED? IF EXECUTE ELSE , THEN
( maybe number )
ELSE (parse*) @ EXECUTE LITN THEN
ELSE (parse*) @ EXECUTE _c LITN THEN
AGAIN
; IMMEDIATE