fireworks: stage 1 works

This commit is contained in:
Vince Weaver 2018-09-11 19:51:25 -04:00
parent 0b93528b36
commit 0680a83360
3 changed files with 30 additions and 7 deletions

View File

@ -296,7 +296,7 @@ loop_forever:
jump_table:
.word (action_stars-1)
.word (action_launch_firework-1)
.word (action_stars-1)
.word (action_stars-1)
.word (action_stars-1)

View File

@ -12,9 +12,9 @@
STATE_LAUNCH_ROCKET = 0
STATE_MOVE_ROCKET = 1
STATE_START_EXPLOSION = 2
STATE_CONTINUE_EXPLOSION = 3
STATE_MOVE_ROCKET = 2
STATE_START_EXPLOSION = 4
STATE_CONTINUE_EXPLOSION = 6
; Constants
NUMSTARS = 16
@ -87,7 +87,7 @@ done_fireworks:
;===========================
; LAUNCH_FIREWORK
;===========================
; cycles= 54+60+67+60+56+56+15+8+21+11 = 408
; cycles= 56+60+67+60+56+56+15+8+21+11 = 410
launch_firework:
@ -96,7 +96,7 @@ launch_firework:
and #$4 ; 2
sta COLOR_GROUP ; HGR color group (0 PG or 4 BO) ; 3
;============
; 54
; 56
jsr random16 ; 6+42
lda SEEDL ; 3
@ -188,7 +188,8 @@ done_hill:
;===========
; 21
lda #STATE_MOVE_ROCKET ; 2
; lda #STATE_MOVE_ROCKET ; 2
lda #STATE_LAUNCH_ROCKET ; 2
sta STATE ; move to launch ; 3
rts ; 6

View File

@ -12,3 +12,25 @@ action_stars:
jmp check_keyboard ; 3
;=================================
; action_launch_firework
;=================================
; and take 4504 cycles to do it
; we take 419 so waste 4085
action_launch_firework:
; Try X=203 Y=4 cycles=405
ldy #4 ; 2
Xloop1: ldx #203 ; 2
Xloop2: dex ; 2
bne Xloop2 ; 2nt/3
dey ; 2
bne Xloop1 ; 2nt/3
jsr launch_firework ; 6+410 = 416
jmp check_keyboard ; 3