better docs
This commit is contained in:
parent
1b2b8e00d7
commit
4b4b2b5ff2
28
math32.tal
28
math32.tal
|
@ -48,17 +48,21 @@
|
||||||
|
|
||||||
( equality )
|
( equality )
|
||||||
|
|
||||||
|
( x == y )
|
||||||
@eq32 ( xhi* xlo* yhi* ylo* -> bool^ )
|
@eq32 ( xhi* xlo* yhi* ylo* -> bool^ )
|
||||||
ROT2 EQU2 STH
|
ROT2 EQU2 STH
|
||||||
EQU2 STHr AND RTN
|
EQU2 STHr AND RTN
|
||||||
|
|
||||||
@is-zero32 ( x** -> bool^ )
|
( x != y )
|
||||||
ORA2 #0000 EQU2 RTN
|
|
||||||
|
|
||||||
@ne32 ( xhi* xlo* yhi* ylo* -> bool^ )
|
@ne32 ( xhi* xlo* yhi* ylo* -> bool^ )
|
||||||
ROT2 NEQ2 STH
|
ROT2 NEQ2 STH
|
||||||
NEQ2 STHr ORA RTN
|
NEQ2 STHr ORA RTN
|
||||||
|
|
||||||
|
( x == 0 )
|
||||||
|
@is-zero32 ( x** -> bool^ )
|
||||||
|
ORA2 #0000 EQU2 RTN
|
||||||
|
|
||||||
|
( x != 0 )
|
||||||
@non-zero32 ( x** -> bool^ )
|
@non-zero32 ( x** -> bool^ )
|
||||||
ORA2 #0000 NEQ2 RTN
|
ORA2 #0000 NEQ2 RTN
|
||||||
|
|
||||||
|
@ -98,15 +102,19 @@
|
||||||
|
|
||||||
( bitwise operations )
|
( bitwise operations )
|
||||||
|
|
||||||
|
( x & y )
|
||||||
@and32 ( xhi* xlo* yhi* ylo* -> xhi|yhi* xlo|ylo* )
|
@and32 ( xhi* xlo* yhi* ylo* -> xhi|yhi* xlo|ylo* )
|
||||||
ROT2 AND2 STH2 AND2 STH2r RTN
|
ROT2 AND2 STH2 AND2 STH2r RTN
|
||||||
|
|
||||||
|
( x | y )
|
||||||
@or32 ( xhi* xlo* yhi* ylo* -> xhi|yhi* xlo|ylo* )
|
@or32 ( xhi* xlo* yhi* ylo* -> xhi|yhi* xlo|ylo* )
|
||||||
ROT2 ORA2 STH2 ORA2 STH2r RTN
|
ROT2 ORA2 STH2 ORA2 STH2r RTN
|
||||||
|
|
||||||
|
( x ^ y )
|
||||||
@xor32 ( xhi* xlo* yhi* ylo* -> xhi|yhi* xlo|ylo* )
|
@xor32 ( xhi* xlo* yhi* ylo* -> xhi|yhi* xlo|ylo* )
|
||||||
ROT2 EOR2 STH2 EOR2 STH2r RTN
|
ROT2 EOR2 STH2 EOR2 STH2r RTN
|
||||||
|
|
||||||
|
( ~x )
|
||||||
@complement32 ( x** -> ~x** )
|
@complement32 ( x** -> ~x** )
|
||||||
COMPLEMENT32 RTN
|
COMPLEMENT32 RTN
|
||||||
|
|
||||||
|
@ -119,7 +127,7 @@
|
||||||
|
|
||||||
( bit shifting )
|
( bit shifting )
|
||||||
|
|
||||||
( shift right, i.e. >> )
|
( x >> n )
|
||||||
@right-shift ( x** n^ -> x<<n )
|
@right-shift ( x** n^ -> x<<n )
|
||||||
DUP #08 LTH ;right-shift0 JCN2 ( x n )
|
DUP #08 LTH ;right-shift0 JCN2 ( x n )
|
||||||
DUP #10 LTH ;right-shift1 JCN2 ( x n )
|
DUP #10 LTH ;right-shift1 JCN2 ( x n )
|
||||||
|
@ -160,7 +168,7 @@
|
||||||
STHr SFT
|
STHr SFT
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
( shift left, i.e. << )
|
( x << n )
|
||||||
@left-shift ( x** n^ -> x<<n )
|
@left-shift ( x** n^ -> x<<n )
|
||||||
DUP #08 LTH ;left-shift0 JCN2 ( x n )
|
DUP #08 LTH ;left-shift0 JCN2 ( x n )
|
||||||
DUP #10 LTH ;left-shift1 JCN2 ( x n )
|
DUP #10 LTH ;left-shift1 JCN2 ( x n )
|
||||||
|
@ -206,7 +214,7 @@
|
||||||
|
|
||||||
( arithmetic )
|
( arithmetic )
|
||||||
|
|
||||||
( addition, i.e. + )
|
( x + y )
|
||||||
@add32 ( xhi* xlo* yhi* ylo* -> zhi* zlo* )
|
@add32 ( xhi* xlo* yhi* ylo* -> zhi* zlo* )
|
||||||
;sh/y2 STA2 ;sh/y0 STA2 ( save ylo, yhi )
|
;sh/y2 STA2 ;sh/y0 STA2 ( save ylo, yhi )
|
||||||
;sh/x2 STA2 ;sh/x0 STA2 ( save xlo, xhi )
|
;sh/x2 STA2 ;sh/x0 STA2 ( save xlo, xhi )
|
||||||
|
@ -231,7 +239,7 @@
|
||||||
;sh/z0 LDA2 ;sh/z2 LDA2
|
;sh/z0 LDA2 ;sh/z2 LDA2
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
( negation, i.e. unary - )
|
( -x )
|
||||||
@negate32 ( x** -> -x** )
|
@negate32 ( x** -> -x** )
|
||||||
COMPLEMENT32
|
COMPLEMENT32
|
||||||
INC2 ( ~xhi -xlo )
|
INC2 ( ~xhi -xlo )
|
||||||
|
@ -241,7 +249,7 @@
|
||||||
&done
|
&done
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
( subtraction, i.e. binary - )
|
( x - y )
|
||||||
@sub32 ( x** y** -> z** )
|
@sub32 ( x** y** -> z** )
|
||||||
;negate32 JSR2 ;add32 JSR2 RTN
|
;negate32 JSR2 ;add32 JSR2 RTN
|
||||||
|
|
||||||
|
@ -270,7 +278,7 @@
|
||||||
;add32 JSR2
|
;add32 JSR2
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
( multiplication, i.e. * )
|
( x * y )
|
||||||
@mul32 ( x** y** -> z** )
|
@mul32 ( x** y** -> z** )
|
||||||
,&y1 STR2 ,&y0 STR2 ( save ylo, yhi )
|
,&y1 STR2 ,&y0 STR2 ( save ylo, yhi )
|
||||||
,&x1 STR2 ,&x0 STR2 ( save xlo, xhi )
|
,&x1 STR2 ,&x0 STR2 ( save xlo, xhi )
|
||||||
|
@ -287,7 +295,7 @@
|
||||||
&y0 $2 &y1 $2
|
&y0 $2 &y1 $2
|
||||||
&z0 $2 &z1 $2 ]
|
&z0 $2 &z1 $2 ]
|
||||||
|
|
||||||
( division, i.e. / )
|
( x / y )
|
||||||
@div32 ( x** y** -> q** )
|
@div32 ( x** y** -> q** )
|
||||||
( store y and x for repeated use )
|
( store y and x for repeated use )
|
||||||
;div32/div1 STA2 ;div32/div0 STA2 ( y -> div )
|
;div32/div1 STA2 ;div32/div0 STA2 ( y -> div )
|
||||||
|
|
Loading…
Reference in New Issue