1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-24 14:38:05 +11:00

forth: Forth-ify "SWAP"

This commit is contained in:
Virgil Dupras 2020-03-30 08:06:11 -04:00
parent cc4700e389
commit d09ec0d757
4 changed files with 12 additions and 15 deletions

Binary file not shown.

View File

@ -928,22 +928,10 @@ DROP:
pop hl
jp next
; ( a b -- b a )
.db "SWAP"
.dw $-DROP
.db 4
SWAP:
.dw nativeWord
pop hl
call chkPS
ex (sp), hl
push hl
jp next
.fill 149
.fill 167
.db "_bend"
.dw $-SWAP
.dw $-DROP
.db 5
; Offset: 06ee
.out $

View File

@ -122,7 +122,7 @@
( Adjust HERE -1 because SCPY copies the null )
HERE @ 1 _c - ( h h' )
_c DUP HERE ! ( h h' )
SWAP _c - ( sz )
_c SWAP _c - ( sz )
( write prev value )
HERE @ CURRENT @ _c - ,
( write size )

View File

@ -39,6 +39,15 @@ CODE DUP
HL PUSHqq, ( A )
;CODE
( a b -- b a )
CODE SWAP
HL POPqq, ( B )
DE POPqq, ( A )
chkPS,
HL PUSHqq, ( B )
DE PUSHqq, ( A )
;CODE
( a b -- a b a )
CODE OVER
HL POPqq, ( B )