mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-05 21:34:30 +00:00
second: more work on timing
This commit is contained in:
parent
5ba0e97c13
commit
162d2b07f5
@ -1,4 +1,67 @@
|
||||
; wait A * 1 50Hz tick
|
||||
;============================
|
||||
; wait for music pattern
|
||||
; also check for keypress
|
||||
;============================
|
||||
; pattern # in A
|
||||
wait_for_pattern:
|
||||
cmp current_pattern_smc+1
|
||||
beq done_check_pattern_done
|
||||
|
||||
lda KEYPRESS
|
||||
bpl done_check_pattern_notdone
|
||||
bit KEYRESET
|
||||
jmp done_check_pattern_done
|
||||
|
||||
;============================
|
||||
; setup timeout of A seconds
|
||||
;============================
|
||||
setup_timeout:
|
||||
sta SECOND_COUNTDOWN
|
||||
lda #0
|
||||
sta IRQ_COUNTDOWN
|
||||
rts
|
||||
|
||||
;===========================
|
||||
; countodown second timeout
|
||||
; also check for keypress
|
||||
;===========================
|
||||
; carry set = done
|
||||
check_timeout:
|
||||
; check keyboard first
|
||||
lda KEYPRESS
|
||||
bpl timeout_not_keypress
|
||||
bit KEYRESET
|
||||
; lda #0 ; reset, is this necessary?
|
||||
; sta IRQ_COUNTDOWN
|
||||
; sta SECOND_COUNTDOWN
|
||||
jmp done_check_timeout_done
|
||||
|
||||
timeout_not_keypress:
|
||||
lda IRQ_COUNTDOWN
|
||||
bne done_check_timeout_notdone
|
||||
irq_countdown_zero:
|
||||
lda SECOND_COUNTDOWN
|
||||
beq done_check_timeout_done
|
||||
|
||||
; otherwise we need to decrement and update
|
||||
dec SECOND_COUNTDOWN
|
||||
lda #50
|
||||
sta IRQ_COUNTDOWN
|
||||
|
||||
done_check_pattern_notdone:
|
||||
done_check_timeout_notdone:
|
||||
clc
|
||||
rts
|
||||
|
||||
done_check_pattern_done:
|
||||
done_check_timeout_done:
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
;==========================
|
||||
; busy wait A * 1 50Hz tick
|
||||
;==========================
|
||||
wait_ticks:
|
||||
sta IRQ_COUNTDOWN
|
||||
wait_tick_loop:
|
||||
@ -8,6 +71,11 @@ wait_tick_done:
|
||||
rts
|
||||
|
||||
|
||||
;====================
|
||||
; busy wait A seconds
|
||||
;====================
|
||||
; exit early if key pressed
|
||||
|
||||
wait_seconds:
|
||||
tax
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
.include "../zp.inc"
|
||||
.include "../hardware.inc"
|
||||
.include "../qload.inc"
|
||||
.include "../music.inc"
|
||||
|
||||
mod7_table = $1c00
|
||||
div7_table = $1d00
|
||||
|
@ -8,6 +8,7 @@
|
||||
.include "../zp.inc"
|
||||
.include "../hardware.inc"
|
||||
.include "../qload.inc"
|
||||
.include "../music.inc"
|
||||
|
||||
mod7_table = $1c00
|
||||
div7_table = $1d00
|
||||
@ -19,20 +20,36 @@ chess_start:
|
||||
; initializations
|
||||
;=====================
|
||||
|
||||
;===================
|
||||
; Load graphics
|
||||
;===================
|
||||
; some of this not necessary as we come in in HGR
|
||||
|
||||
bit SET_GR
|
||||
bit HIRES
|
||||
bit FULLGR
|
||||
bit PAGE1
|
||||
bit KEYRESET
|
||||
|
||||
lda #$FF
|
||||
jsr hgr_page1_clearscreen
|
||||
lda #$00
|
||||
jsr hgr_page2_clearscreen
|
||||
|
||||
;===================
|
||||
; Load graphics
|
||||
;===================
|
||||
|
||||
; wait until pattern1
|
||||
;pattern1_loop:
|
||||
; lda #1
|
||||
; jsr wait_for_pattern
|
||||
; bcc pattern2_loop
|
||||
|
||||
; technically the above, but we're not fast enough
|
||||
|
||||
lda #175
|
||||
jsr wait_ticks
|
||||
|
||||
; lda #$FF
|
||||
; jsr hgr_page1_clearscreen
|
||||
|
||||
|
||||
;==========================
|
||||
; Falling board animation
|
||||
;==========================
|
||||
@ -93,7 +110,7 @@ compact_inner_loop:
|
||||
dey
|
||||
bpl compact_inner_loop
|
||||
|
||||
lda #50
|
||||
lda #30
|
||||
jsr wait
|
||||
|
||||
inx
|
||||
@ -108,6 +125,9 @@ compact_inner_loop:
|
||||
; Bouncing on board animation
|
||||
;=============================
|
||||
|
||||
lda #10
|
||||
jsr setup_timeout
|
||||
|
||||
bit PAGE2
|
||||
|
||||
; load image offscreen $6000
|
||||
@ -131,8 +151,8 @@ chess_bounce_loop:
|
||||
ldx COUNT
|
||||
|
||||
lda object_coords_x,X
|
||||
cmp #$FF
|
||||
beq done_orange_loop
|
||||
; cmp #$FF
|
||||
; beq done_orange_loop
|
||||
|
||||
sta SPRITE_X
|
||||
lda object_coords_y,X
|
||||
@ -156,11 +176,11 @@ chess_bounce_loop:
|
||||
|
||||
no_chess_bounce_oflo:
|
||||
|
||||
lda KEYPRESS
|
||||
bpl chess_bounce_loop
|
||||
jsr check_timeout
|
||||
bcc chess_bounce_loop ; clear if not timed out
|
||||
|
||||
done_chess_bounce_loop:
|
||||
|
||||
done_chess_bount_loop:
|
||||
bit KEYRESET
|
||||
|
||||
;=============================
|
||||
; Orange Blob Animation
|
||||
@ -187,8 +207,8 @@ orange_loop:
|
||||
ldx COUNT
|
||||
|
||||
lda object_coords_x,X
|
||||
cmp #$FF
|
||||
beq done_orange_loop
|
||||
; cmp #$FF ; needed?
|
||||
; beq done_orange_loop
|
||||
|
||||
sta SPRITE_X
|
||||
lda object_coords_y,X
|
||||
@ -212,11 +232,16 @@ orange_loop:
|
||||
|
||||
no_orange_oflo:
|
||||
|
||||
lda KEYPRESS
|
||||
bpl orange_loop
|
||||
; finish at music pattern #10 or keypress
|
||||
lda #10
|
||||
jsr wait_for_pattern
|
||||
bcc orange_loop
|
||||
|
||||
done_orange_loop:
|
||||
bit KEYRESET
|
||||
; lda KEYPRESS
|
||||
; bpl orange_loop
|
||||
|
||||
;done_orange_loop:
|
||||
; bit KEYRESET
|
||||
|
||||
chess_done:
|
||||
|
||||
@ -300,6 +325,7 @@ main_interference_done:
|
||||
.include "../hgr_clear_screen.s"
|
||||
.include "../hgr_copy_fast.s"
|
||||
.include "../hgr_sprite_big.s"
|
||||
.include "../irq_wait.s"
|
||||
|
||||
.include "interference.s"
|
||||
.include "circles.s"
|
||||
|
Loading…
x
Reference in New Issue
Block a user