2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2017-10-26 16:01:54 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2017-10-26 16:01:54 +00:00
|
|
|
|
*/--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
* # FAdd,FSub,FMult,FDiv,FPwr
|
|
|
|
|
* Return X+Y, X-Y, X*Y, X/Y, X^Y
|
2017-10-26 16:01:54 +00:00
|
|
|
|
* ## In:
|
|
|
|
|
* PUSHW = X (*Float)
|
|
|
|
|
* PUSHW = Y (*Float)
|
2017-10-27 06:36:46 +00:00
|
|
|
|
* Y,A = Dest (*Float)
|
2017-10-26 16:01:54 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.FAdd ldx #ROM.FADD
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
K.FSub ldx #ROM.FSUB
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
K.FMult ldx #ROM.FMULT
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
K.FDiv ldx #ROM.FDIV
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
K.FPwr ldx #ROM.PWR
|
|
|
|
|
>STYA FORPNT
|
2017-10-26 16:01:54 +00:00
|
|
|
|
phx
|
|
|
|
|
jsr MATH.PullFAC
|
|
|
|
|
jsr MATH.PullARG
|
2017-10-27 14:56:46 +00:00
|
|
|
|
bra MATH.Go
|
2017-10-27 06:36:46 +00:00
|
|
|
|
*/--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
* # Log,Sqr,Exp,Cos,Sin,Tan,ATan
|
|
|
|
|
* Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
|
2017-10-27 06:36:46 +00:00
|
|
|
|
* ## In:
|
|
|
|
|
* PUSHW = X (*Float)
|
|
|
|
|
* Y,A = Dest (*Float)
|
|
|
|
|
*\--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
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
|
2017-10-31 15:25:16 +00:00
|
|
|
|
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
|
2017-10-27 14:56:46 +00:00
|
|
|
|
|
2017-10-31 15:25:16 +00:00
|
|
|
|
.1 lda (INDEX),y
|
|
|
|
|
sta FAC,x
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
stz FAC.SIGN
|
|
|
|
|
lda #$A0
|
|
|
|
|
sta FAC Exp=32
|
|
|
|
|
|
|
|
|
|
ldx #ROM.LTOF
|
|
|
|
|
phx
|
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
MATH.Go plx
|
2017-10-30 16:11:07 +00:00
|
|
|
|
lda SIGNFLG pPs !!!!
|
|
|
|
|
pha
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr A2osX.ROMCALL
|
|
|
|
|
>ROMCALL GETFAC
|
2017-10-30 16:11:07 +00:00
|
|
|
|
pla
|
|
|
|
|
sta SIGNFLG
|
2017-10-27 14:56:46 +00:00
|
|
|
|
clc
|
2017-10-26 16:01:54 +00:00
|
|
|
|
rts
|
2017-10-30 16:11:07 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # 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
|
2017-10-27 14:56:46 +00:00
|
|
|
|
|
2017-10-30 16:11:07 +00:00
|
|
|
|
ldx #1
|
|
|
|
|
ldy #3
|
|
|
|
|
|
|
|
|
|
.1 lda FAC,x
|
|
|
|
|
sta (FORPNT),y
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-10-27 14:56:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MATH.PullFAC >PULLW INDEX
|
|
|
|
|
>ROMCALL SETFAC
|
2017-10-26 16:01:54 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
MATH.PullARG >PULLW INDEX
|
|
|
|
|
>ROMCALL SETARG
|
|
|
|
|
rts
|
2017-10-26 16:01:54 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.MATH
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
|
|
|
|
ASM
|