mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
120 lines
2.4 KiB
Plaintext
120 lines
2.4 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*/--------------------------------------
|
||
* # FAdd,FSub,FMult,FDiv,FPwr
|
||
* Return X+Y, X-Y, X*Y, X/Y, X^Y
|
||
* ## In:
|
||
* PUSHW = X (*Float)
|
||
* PUSHW = Y (*Float)
|
||
* Y,A = Dest (*Float)
|
||
*\--------------------------------------
|
||
K.FAdd ldx #ROM.FADD
|
||
.HS 2C BIT ABS
|
||
K.FSub ldx #ROM.FSUB
|
||
.HS 2C BIT ABS
|
||
K.FMult ldx #ROM.FMULT
|
||
.HS 2C BIT ABS
|
||
K.FDiv ldx #ROM.FDIV
|
||
.HS 2C BIT ABS
|
||
K.FPwr ldx #ROM.PWR
|
||
>STYA FORPNT
|
||
phx
|
||
jsr MATH.PullFAC
|
||
jsr MATH.PullARG
|
||
bra MATH.Go
|
||
*/--------------------------------------
|
||
* # Log,Sqr,Exp,Cos,Sin,Tan,ATan
|
||
* Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
|
||
* ## In:
|
||
* PUSHW = X (*Float)
|
||
* Y,A = Dest (*Float)
|
||
*\--------------------------------------
|
||
K.Log ldx #ROM.LOG
|
||
.HS 2C BIT ABS
|
||
K.Sqr ldx #ROM.SQR
|
||
.HS 2C BIT ABS
|
||
K.Exp ldx #ROM.EXP
|
||
.HS 2C BIT ABS
|
||
K.Cos ldx #ROM.COS
|
||
.HS 2C BIT ABS
|
||
K.Sin ldx #ROM.SIN
|
||
.HS 2C BIT ABS
|
||
K.Tan ldx #ROM.TAN
|
||
.HS 2C BIT ABS
|
||
K.ATan ldx #ROM.ATAN
|
||
>STYA FORPNT
|
||
phx
|
||
jsr MATH.PullFAC
|
||
bra MATH.Go
|
||
*/--------------------------------------
|
||
* # Float
|
||
* Return return 'floated' long
|
||
* ## In:
|
||
* PUSHW = X (*long)
|
||
* Y,A = Dest (*float)
|
||
*\--------------------------------------
|
||
K.Float >STYA FORPNT
|
||
>PULLW INDEX
|
||
|
||
ldx #1
|
||
ldy #3
|
||
|
||
.1 lda (INDEX),y
|
||
sta FAC,x
|
||
inx
|
||
dey
|
||
bpl .1
|
||
stz FAC.SIGN
|
||
lda #$A0
|
||
sta FAC Exp=32
|
||
|
||
ldx #ROM.LTOF
|
||
phx
|
||
|
||
MATH.Go plx
|
||
lda SIGNFLG pPs !!!!
|
||
pha
|
||
jsr A2osX.ROMCALL
|
||
>ROMCALL GETFAC
|
||
pla
|
||
sta SIGNFLG
|
||
clc
|
||
rts
|
||
*/--------------------------------------
|
||
* # LRIntF
|
||
* Return Float rounded into a long
|
||
* ## In:
|
||
* PUSHW = X (*Float)
|
||
* Y,A = Dest (*long)
|
||
*\--------------------------------------
|
||
K.LRIntF >STYA FORPNT
|
||
jsr MATH.PullFAC
|
||
ldx #ROM.QINT
|
||
jsr A2osX.ROMCALL
|
||
|
||
ldx #1
|
||
ldy #3
|
||
|
||
.1 lda FAC,x
|
||
sta (FORPNT),y
|
||
inx
|
||
dey
|
||
bpl .1
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
MATH.PullFAC >PULLW INDEX
|
||
>ROMCALL SETFAC
|
||
rts
|
||
*--------------------------------------
|
||
MATH.PullARG >PULLW INDEX
|
||
>ROMCALL SETARG
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.MATH
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|