Move rotation data to its own segment

This commit is contained in:
Lucas Scharenbroich 2021-07-30 08:01:16 -05:00
parent 1936a0898c
commit 56b5b69efa
7 changed files with 475 additions and 412 deletions

View File

@ -206,17 +206,19 @@ UpdateBG1Rotation
sta angle sta angle
rts rts
x_angles EXT
y_angles EXT
_ApplyAngle _ApplyAngle
lda angle ; debug with angle = 0 lda angle ; debug with angle = 0
asl asl
tax tax
lda x_angles,x ; load the address of addressed for this angle ldal x_angles,x ; load the address of addressed for this angle
tay tay
phx phx
jsr _ApplyBG1XPosAngle jsr _ApplyBG1XPosAngle
plx plx
lda y_angles,x ; load the address of addresses for this angle ldal y_angles,x ; load the address of addresses for this angle
tay tay
jsr _ApplyBG1YPosAngle jsr _ApplyBG1YPosAngle
@ -301,6 +303,8 @@ _DoTimers

View File

@ -239,6 +239,8 @@ Exit
_SetVector _SetVector
:no_interrupts :no_interrupts
_NTPShutDown
PushWord UserId ; Deallocate all of our memory PushWord UserId ; Deallocate all of our memory
_DisposeAll _DisposeAll
@ -1194,7 +1196,9 @@ qtRec adrl $0000
put blitter/Tiles.s put blitter/Tiles.s
put blitter/Vert.s put blitter/Vert.s
put blitter/BG1.s put blitter/BG1.s
put RotData.s ; put RotData.s

View File

@ -1,5 +1,3 @@
REL
DSK TILESEG
tiledata ENT tiledata ENT
hex 0000F000 hex 0000F000
@ -66,3 +64,4 @@ tiledata ENT
hex 89ABCDEF hex 89ABCDEF
tileend tileend

View File

@ -7,11 +7,35 @@
; Segment #1 -- Main execution block ; Segment #1 -- Main execution block
ASM App.Main.s ASM App.Main.s
; SNA Main DS 0 ; Number of bytes of 0's to add at the end of the Segment
KND #$1100 ; Type and Attributes ($11=Static+Bank Relative,$00=Code)
ALI None ; Boundary Alignment (None)
SNA Main
; Segment #2 -- 64KB Tile Memory ; Segment #2 -- 64KB Tile Memory
ASM App.Tile.s ASM App.Tile.s
DS 0
KND #$1001 ; Type and Attributes ($11=Static+Bank Relative,$01=Data)
; ALI BANK
SNA Tiles
;Segment #3 -- Rotation table data
ASM RotData.s
DS 0
KND #$1001 ; Type and Attributes ($11=Static+Bank Relative,$01=Data)
; ALI BANK
SNA RotData

View File

@ -1,6 +1,7 @@
; The BG1 buffer lives at [$1800, $E800] ; The BG1 buffer lives at [$1800, $E800]
; The texture is this range of the BG1 buffer [$4E00, $8200] ; The texture is this range of the BG1 buffer [$4E00, $8200]
x_angles ANGLEBNK ent
x_angles ent
dw :x_a_0 dw :x_a_0
dw :x_a_1 dw :x_a_1
dw :x_a_2 dw :x_a_2
@ -193,7 +194,7 @@ x_angles
dw $48D7,$48D9,$48DB,$48DD,$48DF,$48E1,$47E3,$47E5,$47E7,$47E9,$47EB,$46ED,$46EF,$46F1,$46F3,$46F5,$45F7,$45F9,$45FB,$45FD,$45FF,$4501,$4503,$4505,$4507,$4509,$440B,$440D,$440F,$4411,$4413,$4315,$4317,$4319,$431B,$431D,$421F,$4221,$4223,$4225,$4227,$4229,$4129,$412B,$412D,$412F,$4131,$4033,$4035,$4037,$4039,$403B,$3F3D,$3F3F,$3F41,$3F43,$3F45,$3E47,$3E49,$3E4B,$3E4D,$3E4F,$3D51,$3D53,$3D55,$3D57,$3D59,$3C5B,$3C5D,$3C5F,$3C61,$3C63,$3B65,$3B67,$3B69,$3B6B,$3B6D,$3A6F,$3A71,$3A73,$3A75,$3A77 dw $48D7,$48D9,$48DB,$48DD,$48DF,$48E1,$47E3,$47E5,$47E7,$47E9,$47EB,$46ED,$46EF,$46F1,$46F3,$46F5,$45F7,$45F9,$45FB,$45FD,$45FF,$4501,$4503,$4505,$4507,$4509,$440B,$440D,$440F,$4411,$4413,$4315,$4317,$4319,$431B,$431D,$421F,$4221,$4223,$4225,$4227,$4229,$4129,$412B,$412D,$412F,$4131,$4033,$4035,$4037,$4039,$403B,$3F3D,$3F3F,$3F41,$3F43,$3F45,$3E47,$3E49,$3E4B,$3E4D,$3E4F,$3D51,$3D53,$3D55,$3D57,$3D59,$3C5B,$3C5D,$3C5F,$3C61,$3C63,$3B65,$3B67,$3B69,$3B6B,$3B6D,$3A6F,$3A71,$3A73,$3A75,$3A77
:x_a_63 dw $45D7,$44D9,$44DB,$44DD,$44DF,$44E1,$44E3,$44E5,$44E7,$44E9,$44EB,$43ED,$43EF,$43F1,$43F3,$43F5,$43F7,$43F9,$43FB,$43FD,$43FF,$4301,$4303,$4305,$4307,$4309,$430B,$430D,$430F,$4311,$4313,$4215,$4217,$4219,$421B,$421D,$421F,$4221,$4223,$4225,$4227,$4229,$4129,$412B,$412D,$412F,$4131,$4133,$4135,$4137,$4139,$413B,$403D,$403F,$4041,$4043,$4045,$4047,$4049,$404B,$404D,$404F,$3F51,$3F53,$3F55,$3F57,$3F59,$3F5B,$3F5D,$3F5F,$3F61,$3F63,$3E65,$3E67,$3E69,$3E6B,$3E6D,$3E6F,$3E71,$3E73,$3E75,$3E77 :x_a_63 dw $45D7,$44D9,$44DB,$44DD,$44DF,$44E1,$44E3,$44E5,$44E7,$44E9,$44EB,$43ED,$43EF,$43F1,$43F3,$43F5,$43F7,$43F9,$43FB,$43FD,$43FF,$4301,$4303,$4305,$4307,$4309,$430B,$430D,$430F,$4311,$4313,$4215,$4217,$4219,$421B,$421D,$421F,$4221,$4223,$4225,$4227,$4229,$4129,$412B,$412D,$412F,$4131,$4133,$4135,$4137,$4139,$413B,$403D,$403F,$4041,$4043,$4045,$4047,$4049,$404B,$404D,$404F,$3F51,$3F53,$3F55,$3F57,$3F59,$3F5B,$3F5D,$3F5F,$3F61,$3F63,$3E65,$3E67,$3E69,$3E6B,$3E6D,$3E6F,$3E71,$3E73,$3E75,$3E77
dw $45D7,$44D9,$44DB,$44DD,$44DF,$44E1,$44E3,$44E5,$44E7,$44E9,$44EB,$43ED,$43EF,$43F1,$43F3,$43F5,$43F7,$43F9,$43FB,$43FD,$43FF,$4301,$4303,$4305,$4307,$4309,$430B,$430D,$430F,$4311,$4313,$4215,$4217,$4219,$421B,$421D,$421F,$4221,$4223,$4225,$4227,$4229,$4129,$412B,$412D,$412F,$4131,$4133,$4135,$4137,$4139,$413B,$403D,$403F,$4041,$4043,$4045,$4047,$4049,$404B,$404D,$404F,$3F51,$3F53,$3F55,$3F57,$3F59,$3F5B,$3F5D,$3F5F,$3F61,$3F63,$3E65,$3E67,$3E69,$3E6B,$3E6D,$3E6F,$3E71,$3E73,$3E75,$3E77 dw $45D7,$44D9,$44DB,$44DD,$44DF,$44E1,$44E3,$44E5,$44E7,$44E9,$44EB,$43ED,$43EF,$43F1,$43F3,$43F5,$43F7,$43F9,$43FB,$43FD,$43FF,$4301,$4303,$4305,$4307,$4309,$430B,$430D,$430F,$4311,$4313,$4215,$4217,$4219,$421B,$421D,$421F,$4221,$4223,$4225,$4227,$4229,$4129,$412B,$412D,$412F,$4131,$4133,$4135,$4137,$4139,$413B,$403D,$403F,$4041,$4043,$4045,$4047,$4049,$404B,$404D,$404F,$3F51,$3F53,$3F55,$3F57,$3F59,$3F5B,$3F5D,$3F5F,$3F61,$3F63,$3E65,$3E67,$3E69,$3E6B,$3E6D,$3E6F,$3E71,$3E73,$3E75,$3E77
y_angles y_angles ent
dw :y_a_0 dw :y_a_0
dw :y_a_1 dw :y_a_1
dw :y_a_2 dw :y_a_2
@ -386,3 +387,10 @@ y_angles
dw $241F,$2521,$2621,$2721,$2821,$2921,$2A23,$2B23,$2C23,$2D23,$2E23,$2F25,$3025,$3125,$3225,$3325,$3427,$3527,$3627,$3727,$3827,$3929,$3A29,$3B29,$3C29,$3D29,$3E29,$3E2B,$3F2B,$402B,$412B,$422B,$432D,$442D,$452D,$462D,$472D,$482F,$492F,$4A2F,$4B2F,$4C2F,$4D31,$4E31,$4F31,$5031,$5131,$5233,$5333,$5433,$5533,$5633 dw $241F,$2521,$2621,$2721,$2821,$2921,$2A23,$2B23,$2C23,$2D23,$2E23,$2F25,$3025,$3125,$3225,$3325,$3427,$3527,$3627,$3727,$3827,$3929,$3A29,$3B29,$3C29,$3D29,$3E29,$3E2B,$3F2B,$402B,$412B,$422B,$432D,$442D,$452D,$462D,$472D,$482F,$492F,$4A2F,$4B2F,$4C2F,$4D31,$4E31,$4F31,$5031,$5131,$5233,$5333,$5433,$5533,$5633
:y_a_63 dw $2425,$2525,$2625,$2725,$2825,$2925,$2A27,$2B27,$2C27,$2D27,$2E27,$2F27,$3027,$3127,$3227,$3327,$3429,$3529,$3629,$3729,$3829,$3929,$3A29,$3B29,$3C29,$3D29,$3E29,$3E2B,$3F2B,$402B,$412B,$422B,$432B,$442B,$452B,$462B,$472B,$482D,$492D,$4A2D,$4B2D,$4C2D,$4D2D,$4E2D,$4F2D,$502D,$512D,$522F,$532F,$542F,$552F,$562F :y_a_63 dw $2425,$2525,$2625,$2725,$2825,$2925,$2A27,$2B27,$2C27,$2D27,$2E27,$2F27,$3027,$3127,$3227,$3327,$3429,$3529,$3629,$3729,$3829,$3929,$3A29,$3B29,$3C29,$3D29,$3E29,$3E2B,$3F2B,$402B,$412B,$422B,$432B,$442B,$452B,$462B,$472B,$482D,$492D,$4A2D,$4B2D,$4C2D,$4D2D,$4E2D,$4F2D,$502D,$512D,$522F,$532F,$542F,$552F,$562F
dw $2425,$2525,$2625,$2725,$2825,$2925,$2A27,$2B27,$2C27,$2D27,$2E27,$2F27,$3027,$3127,$3227,$3327,$3429,$3529,$3629,$3729,$3829,$3929,$3A29,$3B29,$3C29,$3D29,$3E29,$3E2B,$3F2B,$402B,$412B,$422B,$432B,$442B,$452B,$462B,$472B,$482D,$492D,$4A2D,$4B2D,$4C2D,$4D2D,$4E2D,$4F2D,$502D,$512D,$522F,$532F,$542F,$552F,$562F dw $2425,$2525,$2625,$2725,$2825,$2925,$2A27,$2B27,$2C27,$2D27,$2E27,$2F27,$3027,$3127,$3227,$3327,$3429,$3529,$3629,$3729,$3829,$3929,$3A29,$3B29,$3C29,$3D29,$3E29,$3E2B,$3F2B,$402B,$412B,$422B,$432B,$442B,$452B,$462B,$472B,$482D,$492D,$4A2D,$4B2D,$4C2D,$4D2D,$4E2D,$4F2D,$502D,$512D,$522F,$532F,$542F,$552F,$562F

View File

@ -79,6 +79,7 @@ _ApplyBG1XPos
pld pld
rts rts
ANGLEBNK ext
_ApplyBG1XPosAngle _ApplyBG1XPosAngle
; phy ; phy
@ -107,11 +108,13 @@ _ApplyBG1XPosAngle
lda BlitterDP ; blitter direct page space and fill in the addresses lda BlitterDP ; blitter direct page space and fill in the addresses
tcd tcd
sty $fe ; Store in the new direct page lda #^ANGLEBNK
sta $fe
sty $fc ; Store in the new direct page
ldy #162 ldy #162
tyx tyx
:loop :loop
lda ($fe),y lda [$fc],y
sta 00,x ; store the value sta 00,x ; store the value
dey dey
dey dey
@ -193,6 +196,8 @@ _ApplyBG1YPosAngle
asl asl
clc clc
adc :angle_tbl adc :angle_tbl
sec
sbc #ANGLEBNK
jsr CopyAngleYTableToBG1Addr ; or CopyBG1YTableToBG1Addr2 jsr CopyAngleYTableToBG1Addr ; or CopyBG1YTableToBG1Addr2
lda :virt_line ; advance to the virtual line after the segment we just lda :virt_line ; advance to the virtual line after the segment we just
@ -403,37 +408,37 @@ SaveBG1AngleValues
:do08 tax :do08 tax
bra :x08 bra :x08
:do16 tax :do16 tax
lda: 06,x ldal ANGLEBNK+06,x
sta BG1YCache+30 sta BG1YCache+30
:x15 lda: 06,x :x15 ldal ANGLEBNK+06,x
sta BG1YCache+28 sta BG1YCache+28
:x14 lda: 06,x :x14 ldal ANGLEBNK+06,x
sta BG1YCache+26 sta BG1YCache+26
:x13 lda: 06,x :x13 ldal ANGLEBNK+06,x
sta BG1YCache+24 sta BG1YCache+24
:x12 lda: 04,x :x12 ldal ANGLEBNK+04,x
sta BG1YCache+22 sta BG1YCache+22
:x11 lda: 04,x :x11 ldal ANGLEBNK+04,x
sta BG1YCache+20 sta BG1YCache+20
:x10 lda: 04,x :x10 ldal ANGLEBNK+04,x
sta BG1YCache+18 sta BG1YCache+18
:x09 lda: 04,x :x09 ldal ANGLEBNK+04,x
sta BG1YCache+16 sta BG1YCache+16
:x08 lda: 02,x :x08 ldal ANGLEBNK+02,x
sta BG1YCache+14 sta BG1YCache+14
:x07 lda: 02,x :x07 ldal ANGLEBNK+02,x
sta BG1YCache+12 sta BG1YCache+12
:x06 lda: 02,x :x06 ldal ANGLEBNK+02,x
sta BG1YCache+10 sta BG1YCache+10
:x05 lda: 02,x :x05 ldal ANGLEBNK+02,x
sta BG1YCache+08 sta BG1YCache+08
:x04 lda: 00,x :x04 ldal ANGLEBNK+00,x
sta BG1YCache+06 sta BG1YCache+06
:x03 lda: 00,x :x03 ldal ANGLEBNK+00,x
sta BG1YCache+04 sta BG1YCache+04
:x02 lda: 00,x :x02 ldal ANGLEBNK+00,x
sta BG1YCache+02 sta BG1YCache+02
:x01 lda: 00,x :x01 ldal ANGLEBNK+00,x
sta BG1YCache+00 sta BG1YCache+00
:none rts :none rts
:do07 tax :do07 tax
@ -625,6 +630,24 @@ BG1YCache ds 32

View File

@ -115,7 +115,8 @@ async function main(argv) {
// Now generate the tables to stdout as merlin source code // Now generate the tables to stdout as merlin source code
const _ = console.log; const _ = console.log;
_("x_angles\t"); _("ANGLEBNK\tENT");
_("x_angles\tENT");
for (let a = 0; a < NUM_ANGLES; a += 1) { for (let a = 0; a < NUM_ANGLES; a += 1) {
_(`\tdw\t:x_a_${a}`); _(`\tdw\t:x_a_${a}`);
} }
@ -133,7 +134,7 @@ async function main(argv) {
_(`\tdw\t${arr}`); _(`\tdw\t${arr}`);
} }
_("y_angles\t"); _("y_angles\tENT");
for (let a = 0; a < NUM_ANGLES; a += 1) { for (let a = 0; a < NUM_ANGLES; a += 1) {
_(`\tdw\t:y_a_${a}`); _(`\tdw\t:y_a_${a}`);
} }