diff --git a/chiptune_player/chiptune_player.s b/chiptune_player/chiptune_player.s index 8910a031..581b04b0 100644 --- a/chiptune_player/chiptune_player.s +++ b/chiptune_player/chiptune_player.s @@ -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 diff --git a/chiptune_player/interrupt_handler.s b/chiptune_player/interrupt_handler.s index 686c0dfb..d66873ef 100644 --- a/chiptune_player/interrupt_handler.s +++ b/chiptune_player/interrupt_handler.s @@ -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