mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-24 14:28:06 +11:00
forth: Forth-ify "+"
This commit is contained in:
parent
a2c258afba
commit
9cfddea940
Binary file not shown.
@ -967,24 +967,10 @@ OVER:
|
||||
jp next
|
||||
|
||||
|
||||
.fill 31
|
||||
.fill 112
|
||||
|
||||
; ( a b -- c ) A + B
|
||||
.db "+"
|
||||
.dw $-OVER
|
||||
.db 1
|
||||
PLUS:
|
||||
.dw nativeWord
|
||||
pop hl
|
||||
pop de
|
||||
call chkPS
|
||||
add hl, de
|
||||
push hl
|
||||
jp next
|
||||
|
||||
.fill 65
|
||||
.db "_bend"
|
||||
.dw $-PLUS
|
||||
.dw $-OVER
|
||||
.db 5
|
||||
; Offset: 06ee
|
||||
.out $
|
||||
|
@ -65,7 +65,7 @@
|
||||
( exit if null )
|
||||
DUP NOT IF DROP DROP EXIT THEN
|
||||
_c EMIT ( a )
|
||||
1 + ( a+1 )
|
||||
1 _c + ( a+1 )
|
||||
AGAIN
|
||||
;
|
||||
|
||||
@ -75,13 +75,13 @@
|
||||
|
||||
: C,
|
||||
HERE @ _c C!
|
||||
HERE @ 1 + HERE !
|
||||
HERE @ 1 _c + HERE !
|
||||
;
|
||||
|
||||
( 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 _c CMP 1 + NOT ;
|
||||
: WS? 33 _c CMP 1 _c + NOT ;
|
||||
|
||||
: TOWORD
|
||||
BEGIN
|
||||
@ -99,7 +99,7 @@
|
||||
( We take advantage of the fact that char MSB is
|
||||
always zero to pre-write our null-termination )
|
||||
OVER ! ( a )
|
||||
1 + ( a+1 )
|
||||
1 _c + ( a+1 )
|
||||
C< ( a c )
|
||||
DUP _c WS?
|
||||
UNTIL
|
||||
@ -111,7 +111,7 @@
|
||||
|
||||
: LITN
|
||||
( JTBL+24 == NUMBER )
|
||||
JTBL 24 + ,
|
||||
JTBL 24 _c + ,
|
||||
,
|
||||
;
|
||||
|
||||
|
@ -111,6 +111,14 @@ CODE XOR
|
||||
HL PUSHqq,
|
||||
;CODE
|
||||
|
||||
CODE +
|
||||
HL POPqq,
|
||||
DE POPqq,
|
||||
chkPS,
|
||||
DE ADDHLss,
|
||||
HL PUSHqq,
|
||||
;CODE
|
||||
|
||||
CODE -
|
||||
DE POPqq,
|
||||
HL POPqq,
|
||||
|
Loading…
Reference in New Issue
Block a user