mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-10 08:54:51 +00:00
fireworks: more state machine setup
cutting it really close with stars code
This commit is contained in:
parent
73fe06387f
commit
81cd4b18bd
@ -17,6 +17,7 @@ BASH = $29
|
||||
FRAME = $60
|
||||
BLARGH = $69
|
||||
HGR_COLOR = $E4
|
||||
STATE = $ED
|
||||
DRAW_PAGE = $EE
|
||||
LASTKEY = $F1
|
||||
PADDLE_STATUS = $F2
|
||||
@ -47,7 +48,7 @@ HOME = $FC58 ;; Clear the text screen
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
|
||||
|
||||
jsr draw_fireworks
|
||||
; jsr draw_fireworks
|
||||
|
||||
;==================================
|
||||
;==================================
|
||||
@ -67,6 +68,7 @@ setup_background:
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
sta STATE
|
||||
|
||||
;=============================
|
||||
; Load graphic page0
|
||||
@ -230,17 +232,57 @@ bpage1_loop: ; delay 115+(7 loop)+4 (bit)+4(extra)
|
||||
;======================================================
|
||||
; We have 4550 cycles in the vblank, use them wisely
|
||||
;======================================================
|
||||
; do_nothing should be 4550+1 -2-9 -7= 4533
|
||||
; 4550
|
||||
; +1 fallthrough
|
||||
; -2 ldy at entry
|
||||
; -35 call through jumptable
|
||||
; -7 keyboard
|
||||
; -6 jsr
|
||||
; -3 jmp
|
||||
; ========
|
||||
; 4533
|
||||
; 4504
|
||||
;========================
|
||||
; each subunit should take 4504 cycles
|
||||
|
||||
jsr action_stars ; 6
|
||||
firework_state_machine:
|
||||
|
||||
; if killing time, 16+19 = 35
|
||||
; if not, 16+19 = 35
|
||||
|
||||
ldy STATE ; 3
|
||||
inc FRAME ; 5
|
||||
lda FRAME ; 3
|
||||
and #$3 ; 2
|
||||
beq kill_time ; 3
|
||||
;===========
|
||||
; 16
|
||||
|
||||
|
||||
; Set up jump table that runs same speed on 6502 and 65c02
|
||||
;-1
|
||||
lda jump_table+1,y ; 4
|
||||
pha ; 3
|
||||
lda jump_table,y ; 4
|
||||
pha ; 3
|
||||
rts ; 6
|
||||
|
||||
;=============
|
||||
; 19
|
||||
|
||||
kill_time:
|
||||
|
||||
; need 16 cycles nop
|
||||
ldy STATE ; (nop) ; 3
|
||||
ldy STATE ; (nop) ; 3
|
||||
ldy STATE ; (nop) ; 3
|
||||
ldy STATE ; (nop) ; 3
|
||||
nop ; 2
|
||||
nop ; 2
|
||||
jmp action_stars ; 3
|
||||
|
||||
;=============
|
||||
; 19
|
||||
|
||||
check_keyboard:
|
||||
|
||||
lda KEYPRESS ; 4
|
||||
bpl no_keypress ; 3
|
||||
@ -253,6 +295,14 @@ loop_forever:
|
||||
jmp loop_forever
|
||||
|
||||
|
||||
jump_table:
|
||||
.word (action_stars-1)
|
||||
.word (action_stars-1)
|
||||
.word (action_stars-1)
|
||||
.word (action_stars-1)
|
||||
|
||||
|
||||
|
||||
.include "state_machine.s"
|
||||
.include "gr_hline.s"
|
||||
.include "../asm_routines/gr_unrle.s"
|
||||
|
@ -23,7 +23,7 @@ XSIZE = 280
|
||||
MARGIN = 24
|
||||
|
||||
; Zero page addresses
|
||||
STATE = $EE
|
||||
;STATE = $ED
|
||||
OFFSET = $EF
|
||||
COLOR_GROUP = $F0
|
||||
X_VELOCITY = $F1
|
||||
@ -750,6 +750,7 @@ explosion:
|
||||
; 7+ 280X + 5
|
||||
; 16 stars = 4492
|
||||
|
||||
|
||||
.align $100
|
||||
draw_stars:
|
||||
; HCOLOR = 3, white (though they are drawn purple)
|
||||
|
@ -1,49 +1,14 @@
|
||||
;=================================
|
||||
; do nothing
|
||||
;=================================
|
||||
; and take 4533-6 = 4527 cycles to do it
|
||||
do_nothing:
|
||||
|
||||
; Try X=4 Y=174 cycles=4525 R2
|
||||
|
||||
nop ; 2
|
||||
|
||||
ldy #174 ; 2
|
||||
loop1:
|
||||
ldx #4 ; 2
|
||||
loop2:
|
||||
dex ; 2
|
||||
bne loop2 ; 2nt/3
|
||||
|
||||
dey ; 2
|
||||
bne loop1 ; 2nt/3
|
||||
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
;=================================
|
||||
; action_stars
|
||||
;=================================
|
||||
; and take 4533-6 = 4527 cycles to do it
|
||||
; and take 4504 cycles to do it
|
||||
|
||||
; we take 4501, so waste 3
|
||||
action_stars:
|
||||
|
||||
jsr draw_stars ; 6+4492 = 4498
|
||||
; 4527 - 4498 = 29
|
||||
|
||||
; Try X=4 Y=1 cycles=27 R2
|
||||
ldy FRAME ;nop ; 3
|
||||
|
||||
nop
|
||||
jmp check_keyboard ; 3
|
||||
|
||||
ldy #1 ; 2
|
||||
bloop1:
|
||||
ldx #4 ; 2
|
||||
bloop2:
|
||||
dex ; 2
|
||||
bne bloop2 ; 2nt/3
|
||||
|
||||
dey ; 2
|
||||
bne bloop1 ; 2nt/3
|
||||
|
||||
|
||||
rts ; 6
|
||||
|
Loading…
Reference in New Issue
Block a user