chiptune: have arrow keys and pause working

This commit is contained in:
Vince Weaver 2018-02-26 11:10:31 -05:00
parent 3afa7d2ee5
commit 2ac79fa80a
2 changed files with 24 additions and 15 deletions

View File

@ -200,26 +200,31 @@ check_done:
bit DONE_PLAYING
beq main_loop ; if was all zeros, loop
bmi main_loop ; if high bit set, paused
bvs minus_song ; if bit 6 set, then left pressed
; else, either song finished or
; right pressed
plus_song:
sei ; disable interrupts
jsr increment_file
jmp done_play
minus_song:
sei ; disable interrupts
jsr decrement_file
done_play:
; ; FIXME: disable timer on 6522
; ; FIXME: unhook interrupt handler
;
sei ; disable interrupts
lda #0
sta DONE_PLAYING
jsr clear_ay_both
lda #0
sta CH
jsr clear_bottoms
jsr increment_file
jsr new_song
cli ; re-enable interrupts

View File

@ -92,7 +92,6 @@ mb_write_loop:
bne mb_not_done ; 3/2nt
lda #1 ; set done playing ; 2
sta DONE_PLAYING ; 3
jmp quiet_exit ; 3
@ -283,25 +282,30 @@ check_keyboard:
key_space:
lda #$80
eor DONE_PLAYING
sta DONE_PLAYING
bne quiet_exit
jmp quiet_exit
key_left:
cmp #'D'
cmp #'A'
bne key_right
lda #$40
bne quiet_exit
key_right:
cmp #'A'
cmp #'D'
bne done_key
lda #$20
bne quiet_exit
done_key:
jmp exit_interrupt
quiet_exit:
sta DONE_PLAYING
jsr clear_ay_both
exit_interrupt:
exit_interrupt:
pla ; restore a ; 4