Kernel 0.9.1 : Math API, bug fix, and L To F conversion

This commit is contained in:
Rémy GIBERT 2017-10-31 16:25:16 +01:00
parent 4cd04a6f2c
commit 698bad1b63
11 changed files with 49 additions and 5 deletions

View File

@ -198,6 +198,13 @@ Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
+ PUSHW = X (*Float)
+ Y,A = Dest (*Float)
# Float
Return return 'floated' long
## In:
+ PUSHW = X (*long)
+ Y,A = Dest (*float)
# LRIntF
Return Float rounded into a long
@ -371,7 +378,7 @@ Return information about a file
## Out :
# MKDirYA
# MKDir.YA
## In:
+ Y,A = DIR name

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -192,7 +192,7 @@ SYS.FDiv .EQ $C6
SYS.FPwr .EQ $C8
* .EQ $CA
SYS.LRIntF .EQ $CC
* .EQ $CE
SYS.Float .EQ $CE
SYS.Log .EQ $D0
SYS.Sqr .EQ $D2

View File

@ -45,7 +45,7 @@ SIGNFLG .EQ $16 COS,SIN,TAN
INDEX .EQ $5E ->$5F
FORPNT .EQ $85 ->$86
FAC .EQ $9D ->$A1
*FAC.SIGN .EQ $A2
FAC.SIGN .EQ $A2
*FAC.EXTENSION .EQ $AC
TXTPTR .EQ $B8
*--------------------------------------

View File

@ -125,7 +125,7 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.FPwr
.DA 0
.DA K.LRIntF
.DA 0
.DA K.Float
.DA K.Log $D0
.DA K.Sqr

View File

@ -48,7 +48,32 @@ 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

View File

@ -86,7 +86,7 @@ K.Stat.DST .DA #S.STAT.P.TYPE
.DA #S.STAT.P.AUXTYPE,#S.STAT.P.AUXTYPE+1
.DA #S.STAT.BLOCKS,#S.STAT.BLOCKS+1
*/-------------------------------------
* # MKDirYA
* # MKDir.YA
* ## In:
* Y,A = DIR name
* ## Out:

View File

@ -37,10 +37,12 @@ L.FLOAT4 .DA FLOAT4
L.FLOAT5 .DA FLOAT5
L.CONST1 .DA CONST1
L.CONST2 .DA CONST2
L.LONG1 .DA LONG1
L.MSG1 .DA MSG1
L.MSG2 .DA MSG2
L.MSG3 .DA MSG3
L.MSG4 .DA MSG4
L.MSG5 .DA MSG5
.DA 0
*--------------------------------------
CS.INIT clc
@ -91,6 +93,14 @@ CS.RUN >PUSHEA.G ENDPTR
>PUSHEA.G MYLONG
>LDYA L.MSG4
>SYSCALL PrintF.YA
*--------------------------------------
>PUSHW L.LONG1
>LEA.G MYFLOAT1
>SYSCALL Float
>PUSHEA.G MYFLOAT1
>LDYA L.MSG5
>SYSCALL PrintF.YA
*--------------------------------------
lda #0
sec
@ -111,9 +121,11 @@ FLOAT4 .HS 8100000000 1
FLOAT5 .HS 9080000000 -32768
CONST1 >CSTR "3.141592653"
CONST2 >CSTR "3"
LONG1 .DA 123456789
MSG2 >CSTR "PI/3=%e\r\n"
MSG3 >CSTR "COS(PI/3)=%e\r\n"
MSG4 >CSTR "Long=%L\r\n"
MSG5 >CSTR "Float=%e\r\n"
*--------------------------------------
.DUMMY
.OR 0