diff --git a/megademo/SIZE b/megademo/SIZE index 7d20d499..0a724d70 100644 --- a/megademo/SIZE +++ b/megademo/SIZE @@ -33,6 +33,7 @@ 30378 -- update the e-mail text 30633 -- with all the music added in 31323 -- finish takeoff + 31607 -- space-bars auto-driving Further ideas to reduce: + Optimize all the .align calls diff --git a/megademo/megademo.s b/megademo/megademo.s index 6f8c93cb..734642e4 100644 --- a/megademo/megademo.s +++ b/megademo/megademo.s @@ -44,7 +44,7 @@ apple_iie: ;=================== jsr HOME -; jsr mode7_flying +; jsr space_bars ; C64 Opening Sequence diff --git a/megademo/mode7_sprites.inc b/megademo/mode7_sprites.inc index 19da08a1..8ac08603 100644 --- a/megademo/mode7_sprites.inc +++ b/megademo/mode7_sprites.inc @@ -33,7 +33,7 @@ shadow_left: .byte $aa,$00,$a0 .byte $a0,$0a,$00 -.align 100 +.align $100 .assert >ship_forward = >ship_forward_end, error, "ship_forward crosses page" diff --git a/megademo/space_bars.s b/megademo/space_bars.s index a8038f7e..e48ef33d 100644 --- a/megademo/space_bars.s +++ b/megademo/space_bars.s @@ -272,13 +272,29 @@ sbloopF:dex ; 2 ; -3470 draw_framebuffer ; -533 setup framebuffer ; -21 frame count + ; -16 auto-move ; -7 timeout ; -34 keypress ; -1 adjust center mark back ; =========== - ; 484 + ; 468 + + ;==================== + ; Auto-move ship + ;==================== + ; look it up in lookup table? + + lda FRAMEH ; 3 + lsr ; 2 + and #$1f ; 2 + tax ; 2 + lda sb_x_lookup,X ; 4 + sta XPOS ; 3 + ;======= + ; 16 + ;===================== ; timeout ;===================== @@ -290,9 +306,12 @@ sbloopF:dex ; 2 ; Try X=11 Y=8 cycles=489 R2 ; Try X=31 Y=3 cycles=484 + ; Try X=22 Y=4 cycles=465 R3 - ldy #3 ; 2 -sbloop1:ldx #31 ; 2 + lda $0 + + ldy #4 ; 2 +sbloop1:ldx #22 ; 2 sbloop2:dex ; 2 bne sbloop2 ; 2nt/3 dey ; 2 @@ -512,6 +531,10 @@ offset_lookup: .byte 29,24,20,16,13,10,8,6,4,3,2,1,0,0 +sb_x_lookup: + .byte 15,14,13,12,11,10, 9, 8, 8, 9,10,11,12,13,14,15 + .byte 15,16,17,18,19,20,21,22, 22,21,20,19,18,17,16,15 + ;.align $100 ; 2 + 40*13 + 5 = 527