mirror of
https://github.com/dschmenk/PLASMA.git
synced 2026-04-27 03:18:02 +00:00
Fix sin/cos accuracy
This commit is contained in:
1 parent
73bf667236
commit
1413ddd30a
3 files changed
+35
-4
No files matched your search
@@ -11,6 +11,7 @@ word = $C41B,$C6F3,$C9BB,$CC73,$CF1C,$D1B4,$D43C,$D6B3,$D91A,$DB6F
|
||||
word = $DDB4,$DFE7,$E209,$E419,$E617,$E804,$E9DE,$EBA6,$ED5C,$EEFF
|
||||
word = $F090,$F20E,$F378,$F4D0,$F615,$F747,$F865,$F970,$FA68,$FB4C
|
||||
word = $FC1C,$FCD9,$FD82,$FE18,$FE99,$FF07,$FF60,$FFA6,$FFD8,$FFF6
|
||||
word[2] fprounding = $8000, $0000
|
||||
|
||||
def sin32(deg)#0
|
||||
word[2] i32
|
||||
@@ -27,13 +28,13 @@ def sin32(deg)#0
|
||||
i32[0] = (sin90[180 - deg])
|
||||
i32[1] = 0
|
||||
elsif deg < 270
|
||||
i32[0] = -(sin90[deg - 180])
|
||||
i32[0] = ~(sin90[deg - 180])
|
||||
i32[1] = -1
|
||||
elsif deg == 270
|
||||
i32[0] = 0
|
||||
i32[1] = -1
|
||||
else
|
||||
i32[0] = -(sin90[360 - deg])
|
||||
i32[0] = ~(sin90[360 - deg])
|
||||
i32[1] = -1
|
||||
fin
|
||||
load32(@i32)
|
||||
@@ -43,7 +44,7 @@ export def mulsin(val, deg)
|
||||
word[2] i32
|
||||
sin32(deg)
|
||||
muli16(val)
|
||||
addi16($7FFF) // Round up
|
||||
add32(@fprounding) // Round up
|
||||
store32(@i32)
|
||||
return i32[1]
|
||||
end
|
||||
@@ -52,7 +53,7 @@ export def mulcos(val, deg)
|
||||
word[2] i32
|
||||
sin32(deg + 90)
|
||||
muli16(val)
|
||||
addi16($7FFF) // Round up
|
||||
add32(@fprounding) // Round up
|
||||
store32(@i32)
|
||||
return i32[1]
|
||||
end
|
||||
|
||||
@@ -182,6 +182,7 @@ cp scripts/bounce.4th prodos/bld/scripts/BOUNCE.4TH.TXT
|
||||
cp scripts/dbounce.4th prodos/bld/scripts/DBOUNCE.4TH.TXT
|
||||
cp scripts/hrbounce.4th prodos/bld/scripts/HRBOUNCE.4TH.TXT
|
||||
cp scripts/plot.4th prodos/bld/scripts/PLOT.4TH.TXT
|
||||
cp scripts/grturtle.4th prodos/bld/scripts/GRTURTLE.4TH.TXT
|
||||
cp scripts/hrplot.4th prodos/bld/scripts/HRPLOT.4TH.TXT
|
||||
cp scripts/hrturtle.4th prodos/bld/scripts/HRTURTLE.4TH.TXT
|
||||
cp scripts/gfxplot.4th prodos/bld/scripts/GFXPLOT.4TH.TXT
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
SRC" PLASMA.4TH"
|
||||
SRC" CONIO.4TH"
|
||||
SRC" TURTLE.4TH"
|
||||
" LINES" LOADMOD" "
|
||||
LOOKUP SETLINEPLOT PLASMA SETLINEPLOT
|
||||
PFA PLOT SETLINEPLOT
|
||||
|
||||
: SHOW
|
||||
|
||||
GR
|
||||
40 40 [ LOOKUP LINE ] LITERAL INITTURTLE
|
||||
;
|
||||
|
||||
: SQUARE
|
||||
DUP MOVEFORWARD 90 TURNRIGHT
|
||||
DUP MOVEFORWARD 90 TURNRIGHT
|
||||
DUP MOVEFORWARD 90 TURNRIGHT
|
||||
MOVEFORWARD 90 TURNRIGHT
|
||||
;
|
||||
|
||||
: SPIN
|
||||
361 0 DO
|
||||
I COLOR
|
||||
15 SQUARE
|
||||
I TURNTO
|
||||
10 +LOOP
|
||||
;
|
||||
|
||||
SHOW SPIN
|
||||
Reference in new issue
Block a user