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 $bf71 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1)
romsub $bf74 = SQRA() clobbers(A,X,Y) ; fac1 = SQRT(fac2) romsub $bf74 = SQRA() clobbers(A,X,Y) ; fac1 = SQRT(fac2)
romsub $bfed = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) 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 $e097 = RND() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator
romsub $e264 = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) romsub $e264 = COS() clobbers(A,X,Y) ; fac1 = COS(fac1)
romsub $e26b = SIN() clobbers(A,X,Y) ; fac1 = SIN(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 $fe15 = FADDT() clobbers(A,X,Y) ; fac1 += fac2
romsub $fe1b = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 romsub $fe1b = ZEROFC() clobbers(A,X,Y) ; fac1 = 0
romsub $fe1e = NORMAL() clobbers(A,X,Y) ; normalize fac1 (?) 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 $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 $fe27 = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y
romsub $fe2a = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 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 $fe7b = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY
romsub $fe81 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) romsub $fe81 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1)
romsub $fe84 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** 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 $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 $fe96 = RND() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator
romsub $fe99 = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) 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) { 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 zpType = ZeropageType.BASICSAFE
} }

View File

@ -2,8 +2,6 @@
TODO TODO
==== ====
- check use of float NEGOP vs NEGFAC for cx16
- allow inlining of subroutines with params - allow inlining of subroutines with params
- optimize several inner loops in gfx2 - 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) - 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 { main {
sub start() { sub start() {
;cx16.rombank(4)
float f1 = 9.9999 float f1 = 9.9999
float f2 = 8.8888 float f2 = 8.8888
float f3 = 0.1111 float f3 = 0.1111
f3=cos(f3) uword fs
floats.print_f(f1) %asm {{
txt.nl() phx
floats.print_f(f2) lda #<f1
txt.nl() ldy #>f1
floats.print_f(f3) jsr floats.MOVFM
txt.nl() jsr floats.NEGOP
f3 = cos(f3) jsr floats.FOUT
floats.print_f(f3) 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") txt.print("ok!\n")
sys.wait(2*60) sys.wait(2*60)
} }
} }