forth: Forth-ify "DROP"

This commit is contained in:
Virgil Dupras 2020-03-30 13:57:06 -04:00
parent 49994f09ce
commit f9c3a0444c
4 changed files with 12 additions and 15 deletions

Binary file not shown.

View File

@ -869,18 +869,10 @@ FETCH:
push hl push hl
jp next jp next
; ( a -- ) .fill 13
.db "DROP"
.dw $-FETCH
.db 4
; STABLE ABI
DROP:
.dw nativeWord
pop hl
jp next
.db "_bend" .db "_bend"
.dw $-DROP .dw $-FETCH
.db 5 .db 5
; Offset: 0647 ; Offset: 0647
.out $ .out $

View File

@ -57,7 +57,7 @@
: QUIT : QUIT
0 FLAGS ! _c (resRS) 0 FLAGS ! _c (resRS)
LIT< INTERPRET (find) DROP EXECUTE LIT< INTERPRET (find) _c DROP EXECUTE
; ;
: ABORT _c (resSP) _c QUIT ; : ABORT _c (resSP) _c QUIT ;
@ -101,7 +101,7 @@
: TOWORD : TOWORD
BEGIN BEGIN
_c C< _c DUP _c WS? NOT IF EXIT THEN DROP _c C< _c DUP _c WS? NOT IF EXIT THEN _c DROP
AGAIN AGAIN
; ;
@ -155,10 +155,10 @@
; ;
: BOOT : BOOT
LIT< (c<) (find) NOT IF LIT< KEY (find) DROP THEN LIT< (c<) (find) NOT IF LIT< KEY (find) _c DROP THEN
( JTBL+40 == CINPTR ) ( JTBL+40 == CINPTR )
[ JTBL 40 + @ LITN ] ! [ JTBL 40 + @ LITN ] !
LIT< (c<$) (find) IF EXECUTE ELSE DROP THEN LIT< (c<$) (find) IF EXECUTE ELSE _c DROP THEN
_c INTERPRET _c INTERPRET
; ;
@ -191,7 +191,7 @@
: Y : Y
['] EXIT , ['] EXIT ,
_c R> DROP ( exit : ) _c R> _c DROP ( exit : )
; IMMEDIATE ; IMMEDIATE
( Give ":" and ";" their real name ) ( Give ":" and ";" their real name )

View File

@ -39,6 +39,11 @@ CODE DUP
HL PUSHqq, ( A ) HL PUSHqq, ( A )
;CODE ;CODE
( a -- )
CODE DROP
HL POPqq,
;CODE
( a b -- b a ) ( a b -- b a )
CODE SWAP CODE SWAP
HL POPqq, ( B ) HL POPqq, ( B )