mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-09 04:25:12 +00:00
Changed rotate to use 8-bit sine and 8x8 bit multiplication.
This commit is contained in:
15
src/main/fragment/vwsz1=vbsaa_plus_vbuc1.asm
Normal file
15
src/main/fragment/vwsz1=vbsaa_plus_vbuc1.asm
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
sta {z1}
|
||||||
|
// sign-extend the byte
|
||||||
|
ora #$7f
|
||||||
|
bmi !+
|
||||||
|
lda #0
|
||||||
|
!:
|
||||||
|
sta {z1}+1
|
||||||
|
// add the constant
|
||||||
|
lda {z1}
|
||||||
|
clc
|
||||||
|
adc #{c1}
|
||||||
|
sta {z1}
|
||||||
|
lda {z1}+1
|
||||||
|
adc #0
|
||||||
|
sta {z1}+1
|
2
src/main/fragment/vwsz1=vwsz1_rol_1.asm
Normal file
2
src/main/fragment/vwsz1=vwsz1_rol_1.asm
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
asl {z1}
|
||||||
|
rol {z1}+1
|
4
src/main/fragment/vwsz1=vwsz1_rol_2.asm
Normal file
4
src/main/fragment/vwsz1=vwsz1_rol_2.asm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
asl {z1}
|
||||||
|
rol {z1}+1
|
||||||
|
asl {z1}
|
||||||
|
rol {z1}+1
|
6
src/main/fragment/vwsz1=vwsz2_rol_1.asm
Normal file
6
src/main/fragment/vwsz1=vwsz2_rol_1.asm
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
lda {z2}
|
||||||
|
asl
|
||||||
|
sta {z1}
|
||||||
|
lda {z2}+1
|
||||||
|
rol
|
||||||
|
sta {z1}+1
|
@@ -40,18 +40,18 @@ void anim() {
|
|||||||
signed word max = -1000;
|
signed word max = -1000;
|
||||||
|
|
||||||
byte angle = 0;
|
byte angle = 0;
|
||||||
signed word x = 89; // signed fixed[15.0]
|
signed byte x = 89; // signed fixed[7.0]
|
||||||
signed word y = 0;
|
signed byte y = 0;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
while(*RASTER!=$ff) {}
|
while(*RASTER!=$ff) {}
|
||||||
(*BORDERCOL)++;
|
(*BORDERCOL)++;
|
||||||
signed word sin_a = (signed word) { SIN_HI[angle], SIN_LO[angle] }; // signed fixed[0.15]
|
signed byte sin_a = (signed byte) SIN_HI[angle]; // signed fixed[0.7]
|
||||||
signed word cos_a = (signed word) { COS_HI[angle], COS_LO[angle] }; // signed fixed[0.15]
|
signed byte cos_a = (signed byte) COS_HI[angle]; // signed fixed[0.7]
|
||||||
signed dword xr = mulf16s(cos_a, x)<<1 - mulf16s(sin_a, y)<<1; // signed fixed[16.16]
|
signed word xr = mulf8s(cos_a, x)<<1 - mulf8s(sin_a, y)<<1; // signed fixed[8.8]
|
||||||
signed dword yr = mulf16s(cos_a, y)<<1 + mulf16s(sin_a, x)<<1; // signed fixed[16.16]
|
signed word yr = mulf8s(cos_a, y)<<1 + mulf8s(sin_a, x)<<1; // signed fixed[8.8]
|
||||||
signed word xpos = ((signed word) >xr) + 89 + 24 + 60;
|
signed word xpos = ((signed byte) >xr) + 89 + 24 + 60;
|
||||||
signed word ypos = ((signed word) >yr) + 89 + 51;
|
signed word ypos = ((signed byte) >yr) + 89 + 51;
|
||||||
SPRITES_XPOS[0] = <xpos;
|
SPRITES_XPOS[0] = <xpos;
|
||||||
*SPRITES_XMSB = >xpos;
|
*SPRITES_XMSB = >xpos;
|
||||||
SPRITES_YPOS[0] = <ypos;
|
SPRITES_YPOS[0] = <ypos;
|
||||||
|
Reference in New Issue
Block a user