1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-24 03:18:10 +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 push hl
jp next jp next
.fill 42 .fill 65
; ( 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
.db "_bend" .db "_bend"
.dw $-CMP .dw $-PLUS
.db 5 .db 5
; Offset: 06ee ; Offset: 06ee
.out $ .out $

View File

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

View File

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