dialer/logic.jrt

212 lines
2.2 KiB
Plaintext
Raw Permalink Normal View History

dbg" math"
:ASM +
POP AX POP BX
ADD AX BX
PUSH AX
NEXT
:ASM 1+
POP AX INC AX PUSH AX
NEXT
:ASM -
POP BX POP AX
SUB AX BX
PUSH AX
NEXT
:ASM 1-
POP AX DEC AX PUSH AX
NEXT
:ASM *
POP BX POP AX
IMUL BX
PUSH AX
NEXT
:ASM /mod ( n1 n2 -- quotient remainder )
POP BX POP AX
XOR DX DX
IDIV BX
PUSH AX
PUSH DX
NEXT
:t / /mod drop ;
:t % /mod swap drop ;
:ASM abs ( n -- n )
POP AX
OR AX AX
JNS 0 @>
NEG AX
0 <:
PUSH AX
NEXT
dbg" comparisons"
L: TRUE 0xffff w>t
L: FALSE 0 w>t
L: RETTRUE
PUSH TRUE
NEXT
L: RETFALSE
PUSH FALSE
NEXT
:ASM not
POP AX
OR AX AX
JZ RETTRUE
JMP RETFALSE
:ASM =
POP AX
POP BX
CMP AX BX
JZ RETTRUE
JMP RETFALSE
:ASM <
POP AX
POP BX
CMP BX AX
JL RETTRUE
JMP RETFALSE
:ASM >
POP AX
POP BX
CMP BX AX
JG RETTRUE
JMP RETFALSE
:ASM and
POP AX
POP BX
OR AX AX
JZ RETFALSE
OR BX BX
JZ RETFALSE
JMP RETTRUE
:ASM or
POP AX
POP BX
OR AX BX
JZ RETFALSE
JMP RETTRUE
:t != = not ;
:t <= > not ;
:t >= < not ;
dbg" bitwise"
:ASM &
POP AX
POP BX
AND AX BX
PUSH AX
NEXT
:ASM |
POP AX
POP BX
OR AX BX
PUSH AX
NEXT
:ASM ^
POP AX
POP BX
XOR AX BX
PUSH AX
NEXT
:ASM << ( val count )
POP CX
POP AX
SHL AX CL
PUSH AX
NEXT
:ASM >> ( val count )
POP CX
POP AX
SHR AX CL
PUSH AX
NEXT
:ASM 2*
POP AX
SHL AX 1 #
PUSH AX
NEXT
:ASM 2/
POP AX
SHR AX 1 #
PUSH AX
NEXT
dbg" mem"
:ASM @
POP BX
PUSH @[ BX]
NEXT
:ASM b@
POP BX
MOV AL @[ BX]
CBW
PUSH AX
NEXT
:ASM ub@
POP BX
MOV AL @[ BX]
XOR AH AH
PUSH AX
NEXT
:ASM @far
POP ES POP BX
PUSH @[ ES: BX]
NEXT
:ASM b@far
POP ES POP BX
MOV AL @[ ES: BX]
CBW
PUSH AX
NEXT
:ASM !
POP BX
POP @[ BX]
NEXT
:ASM b!
POP BX POP AX
MOV @[ BX] AL
NEXT
:ASM !far
POP ES POP BX
POP @[ ES: BX]
NEXT
:ASM b!far
POP ES POP BX POP AX
MOV @[ ES: BX] AL
NEXT
:ASM +!
POP BX
POP AX
ADD AX @[ BX]
MOV @[ BX] AX
NEXT