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
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* PUSHF = X (Float)
|
|
|
|
|
* PUSHF = Y (Float)
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **Out:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* On stack (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
|
2018-06-14 15:31:36 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
phx
|
|
|
|
|
jsr MATH.PullFAC
|
|
|
|
|
jsr MATH.PullARG
|
2018-06-14 15:31:36 +00:00
|
|
|
|
|
|
|
|
|
plx
|
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)
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* PUSHF = X (Float)
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **Out:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* On stack (Float)
|
2017-10-27 06:36:46 +00:00
|
|
|
|
*\--------------------------------------
|
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
|
2018-06-14 15:31:36 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
phx
|
|
|
|
|
jsr MATH.PullFAC
|
2018-06-14 15:31:36 +00:00
|
|
|
|
|
|
|
|
|
plx
|
2017-10-31 15:25:16 +00:00
|
|
|
|
bra MATH.Go
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # Float
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* Return 'floated' long
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* PUSHL = X (long)
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **Out:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* On stack (Float)
|
2017-10-31 15:25:16 +00:00
|
|
|
|
*\--------------------------------------
|
2018-06-13 15:18:08 +00:00
|
|
|
|
K.Float >PULLW FAC+1
|
|
|
|
|
>PULLW FAC+3
|
|
|
|
|
|
2017-10-31 15:25:16 +00:00
|
|
|
|
stz FAC.SIGN
|
|
|
|
|
lda #$A0
|
|
|
|
|
sta FAC Exp=32
|
|
|
|
|
|
|
|
|
|
ldx #ROM.LTOF
|
|
|
|
|
|
2018-06-14 15:31:36 +00:00
|
|
|
|
MATH.Go jsr GP.ROMCALL
|
|
|
|
|
|
|
|
|
|
lda pStack
|
|
|
|
|
sec
|
|
|
|
|
sbc #5
|
|
|
|
|
sta pStack
|
|
|
|
|
sta FORPNT
|
|
|
|
|
lda pStack+1
|
|
|
|
|
sta FORPNT+1
|
2018-06-13 15:18:08 +00:00
|
|
|
|
|
|
|
|
|
ldx #ROM.GETFAC
|
|
|
|
|
jsr GP.ROMCALL
|
|
|
|
|
|
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
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* PUSHF = X (Float)
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **Out:**
|
2018-06-13 15:18:08 +00:00
|
|
|
|
* On stack (long)
|
2017-10-30 16:11:07 +00:00
|
|
|
|
*\--------------------------------------
|
2018-06-13 15:18:08 +00:00
|
|
|
|
K.LRIntF jsr MATH.PullFAC
|
|
|
|
|
|
2017-10-30 16:11:07 +00:00
|
|
|
|
ldx #ROM.QINT
|
2018-06-13 15:18:08 +00:00
|
|
|
|
jsr GP.ROMCALL
|
2017-10-27 14:56:46 +00:00
|
|
|
|
|
2018-06-13 15:18:08 +00:00
|
|
|
|
>PUSHW FAC+1
|
|
|
|
|
>PUSHW FAC+3
|
2017-10-30 16:11:07 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-10-27 14:56:46 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-13 15:18:08 +00:00
|
|
|
|
MATH.PullARG ldx #ROM.SETARG
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
MATH.PullFAC ldx #ROM.SETFAC
|
|
|
|
|
|
|
|
|
|
>LDYA pStack
|
|
|
|
|
>STYA INDEX
|
|
|
|
|
jsr GP.ROMCALL
|
|
|
|
|
|
|
|
|
|
lda pStack
|
|
|
|
|
clc
|
|
|
|
|
adc #5
|
|
|
|
|
sta pStack
|
2017-10-27 14:56:46 +00:00
|
|
|
|
rts
|
2017-10-26 16:01:54 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.MATH
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
|
|
|
|
ASM
|