1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 12:58:09 +11:00

forth: Forth-ify "OVER"

This commit is contained in:
Virgil Dupras 2020-03-30 07:58:16 -04:00
parent 9cfddea940
commit 09cd25df29
4 changed files with 13 additions and 18 deletions

Binary file not shown.

View File

@ -952,25 +952,10 @@ DUP:
push hl push hl
jp next jp next
; ( a b -- a b a ) .fill 132
.db "OVER"
.dw $-DUP
.db 4
OVER:
.dw nativeWord
pop hl ; B
pop de ; A
call chkPS
push de
push hl
push de
jp next
.fill 112
.db "_bend" .db "_bend"
.dw $-OVER .dw $-DUP
.db 5 .db 5
; Offset: 06ee ; Offset: 06ee
.out $ .out $

View File

@ -98,7 +98,7 @@
BEGIN BEGIN
( We take advantage of the fact that char MSB is ( We take advantage of the fact that char MSB is
always zero to pre-write our null-termination ) always zero to pre-write our null-termination )
OVER ! ( a ) _c OVER ! ( a )
1 _c + ( a+1 ) 1 _c + ( a+1 )
C< ( a c ) C< ( a c )
DUP _c WS? DUP _c WS?

View File

@ -31,6 +31,16 @@ CODE ROT
BC PUSHqq, ( A ) BC PUSHqq, ( A )
;CODE ;CODE
( a b -- a b a )
CODE OVER
HL POPqq, ( B )
DE POPqq, ( A )
chkPS,
DE PUSHqq, ( A )
HL PUSHqq, ( B )
DE PUSHqq, ( A )
;CODE
( a b -- a b a b ) ( a b -- a b a b )
CODE 2DUP CODE 2DUP
HL POPqq, ( B ) HL POPqq, ( B )