This commit is contained in:
Irmen de Jong 2021-04-06 00:15:43 +02:00
parent d9eccd4fba
commit 123473dfc8
5 changed files with 19 additions and 18 deletions

View File

@ -83,7 +83,7 @@ romsub $bc58 = ABS() ; fac1 = ABS(fac1)
romsub $bf71 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1)
romsub $bf74 = SQRA() clobbers(A,X,Y) ; fac1 = SQRT(fac2)
romsub $bfed = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1)
romsub $bfb4 = NEGOP() clobbers(A) ; switch the sign of fac1
romsub $bfb4 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1)
romsub $e097 = RND() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator
romsub $e264 = COS() clobbers(A,X,Y) ; fac1 = COS(fac1)
romsub $e26b = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1)

View File

@ -42,7 +42,6 @@ romsub $fe12 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt valu
romsub $fe15 = FADDT() clobbers(A,X,Y) ; fac1 += fac2
romsub $fe1b = ZEROFC() clobbers(A,X,Y) ; fac1 = 0
romsub $fe1e = NORMAL() clobbers(A,X,Y) ; normalize fac1 (?)
romsub $fe21 = NEGFAC() clobbers(A,X,Y) ; fac1 = -fac1
romsub $fe24 = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log)
romsub $fe27 = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y
romsub $fe2a = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2
@ -67,7 +66,7 @@ romsub $fe78 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += sign
romsub $fe7b = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY
romsub $fe81 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1)
romsub $fe84 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1
romsub $fe8a = NEGOP() clobbers(A,X,Y) ; fac1 = -fac1-1
romsub $fe8a = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1)
romsub $fe8d = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1)
romsub $fe96 = RND() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator
romsub $fe99 = COS() clobbers(A,X,Y) ; fac1 = COS(fac1)

View File

@ -214,7 +214,7 @@ private fun determineCompilationOptions(program: Program, compTarget: ICompilati
}
if (zpType==ZeropageType.FLOATSAFE && compTarget.name == Cx16Target.name) {
System.err.println("Warning: cx16 target must use zp option basicsafe instead of floatsafe")
System.err.println("Warning: zp option floatsafe changed to basicsafe for cx16 target")
zpType = ZeropageType.BASICSAFE
}

View File

@ -2,8 +2,6 @@
TODO
====
- check use of float NEGOP vs NEGFAC for cx16
- allow inlining of subroutines with params
- optimize several inner loops in gfx2
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)

View File

@ -5,26 +5,30 @@
main {
sub start() {
;cx16.rombank(4)
float f1 = 9.9999
float f2 = 8.8888
float f3 = 0.1111
f3=cos(f3)
uword fs
floats.print_f(f1)
txt.nl()
floats.print_f(f2)
txt.nl()
floats.print_f(f3)
txt.nl()
f3 = cos(f3)
floats.print_f(f3)
%asm {{
phx
lda #<f1
ldy #>f1
jsr floats.MOVFM
jsr floats.NEGOP
jsr floats.FOUT
sta fs
sty fs+1
plx
}}
;cx16.rombank(0)
txt.print_uwhex(fs,1)
txt.nl()
txt.print(fs)
txt.nl()
txt.print("ok!\n")
sys.wait(2*60)
}
}