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 jp EXIT+2
.fill 51 .fill 82
; ( 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
.db "SCPY" .db "SCPY"
.dw $-LITN .dw $-DOES
.db 4 .db 4
SCPY: SCPY:
.dw nativeWord .dw nativeWord

View File

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