megademo: spacebars auto-drive

This commit is contained in:
Vince Weaver 2018-10-29 17:09:02 -04:00
parent 8aa31b7d47
commit 8ec257cde9
4 changed files with 29 additions and 5 deletions

View File

@ -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

View File

@ -44,7 +44,7 @@ apple_iie:
;===================
jsr HOME
; jsr mode7_flying
; jsr space_bars
; C64 Opening Sequence

View File

@ -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"

View File

@ -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