1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-04 04:48:06 +11:00

forth: Forth-ify "CMP"

forth.asm under 1K lines!
This commit is contained in:
Virgil Dupras 2020-03-28 15:18:25 -04:00
parent 7c9d799d93
commit a2c258afba
4 changed files with 14 additions and 19 deletions

Binary file not shown.

View File

@ -982,25 +982,9 @@ PLUS:
push hl
jp next
.fill 42
; ( n1 n2 -- f )
.db "CMP"
.dw $-PLUS
.db 3
CMP:
.dw nativeWord
pop hl
pop de
call chkPS
or a ; clear carry
sbc hl, de
call flagsToBC
push bc
jp next
.fill 65
.db "_bend"
.dw $-CMP
.dw $-PLUS
.db 5
; Offset: 06ee
.out $

View File

@ -81,7 +81,7 @@
( The NOT is to normalize the negative/positive numbers to 1
or 0. Hadn't we wanted to normalize, we'd have written:
32 CMP 1 - )
: WS? 33 CMP 1 + NOT ;
: WS? 33 _c CMP 1 + NOT ;
: TOWORD
BEGIN

View File

@ -266,3 +266,14 @@ CODE SCMP
BC PUSHqq,
;CODE
CODE CMP
HL POPqq,
DE POPqq,
chkPS,
A ORr, ( clear carry )
DE SBCHLss,
( JTBL+32 == flagsToBC )
JTBL 32 + CALLnn,
BC PUSHqq,
;CODE