From 0680a8336018646a3fbf68b1247ea6bf046e340d Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 11 Sep 2018 19:51:25 -0400 Subject: [PATCH] fireworks: stage 1 works --- fireworks/fireworks.s | 2 +- fireworks/fw.s | 13 +++++++------ fireworks/state_machine.s | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/fireworks/fireworks.s b/fireworks/fireworks.s index d5671537..9092fe27 100644 --- a/fireworks/fireworks.s +++ b/fireworks/fireworks.s @@ -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) diff --git a/fireworks/fw.s b/fireworks/fw.s index 26d9306c..fef250f6 100644 --- a/fireworks/fw.s +++ b/fireworks/fw.s @@ -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 diff --git a/fireworks/state_machine.s b/fireworks/state_machine.s index 429ba686..687db50f 100644 --- a/fireworks/state_machine.s +++ b/fireworks/state_machine.s @@ -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 +