pt3: add looping support

This commit is contained in:
Vince Weaver 2019-05-17 13:19:04 -04:00
parent a15706fb81
commit eded3c0908
5 changed files with 57 additions and 4 deletions

View File

@ -51,11 +51,12 @@ Using the PT3_PLAYER
Right/Left arrow Switch songs
Spacebar Pause playback.
M Switch from 1MHz to 1.77MHz mode
L Enables looping in the song
FUTURE FEATURES:
Key to disable visualization
Key to skip ahead/back in pattern list
L to enable looping in the song
ZX Compatability:
~~~~~~~~~~~~~~~~~

View File

@ -42,6 +42,19 @@ pt3_play_music:
lda DONE_SONG
beq mb_write_frame
lda LOOP ; see if looping
beq move_to_next
lda pt3_loop
sta current_pattern
lda #$0
sta current_line
sta current_subframe
sta DONE_SONG
jmp done_interrupt
move_to_next:
; same as "press right"
lda #$40
jmp quiet_exit
@ -197,7 +210,7 @@ lowbar:
key_M:
cmp #'M'
bne key_left
bne key_L
lda convert_177
eor #$1
@ -218,6 +231,34 @@ at_1MHz:
jmp done_key
;===========================
; L enables loop mode
key_L:
cmp #'L'
bne key_left
lda LOOP
eor #$1
sta LOOP
beq music_looping
; update text on screen
lda #'L'+$80
sta $7D0+18
sta $BD0+18
jmp done_key
music_looping:
lda #'/'+$80
sta $7D0+18
sta $BD0+18
jmp done_key
;======================
; left key, to next song
@ -250,6 +291,9 @@ quiet_exit:
sta DONE_PLAYING
jsr clear_ay_both
lda #$ff ; also mute the channel
sta REGISTER_DUMP+7 ; just in case
exit_interrupt:
; pla ; restore a ; 4

View File

@ -192,7 +192,7 @@ note_c:
pt3_version: .byte $0
pt3_frequency_table: .byte $0
pt3_speed: .byte $0
pt3_num_patterns: .byte $0
;pt3_num_patterns: .byte $0
pt3_loop: .byte $0
pt3_noise_period: .byte $0
@ -227,6 +227,7 @@ convert_177: .byte $1
PT3_VERSION = $D
PT3_HEADER_FREQUENCY = $63
PT3_SPEED = $64
PT3_LOOP = $66
PT3_PATTERN_LOC_L = $67
PT3_PATTERN_LOC_H = $68
PT3_SAMPLE_LOC_L = $69
@ -444,6 +445,12 @@ not_ascii_number:
lda PT3_LOC+PT3_SPEED
sta pt3_speed
;=======================
; load default speed
lda PT3_LOC+PT3_LOOP
sta pt3_loop
rts

View File

@ -54,6 +54,7 @@ apple_iie:
sta DRAW_PAGE
sta DONE_PLAYING
sta WHICH_FILE
sta LOOP
;=======================
; Detect mockingboard

View File

@ -110,7 +110,7 @@ WHICH_FILE EQU $98
COLOR_MASK EQU $99
RASTERBARS_ON EQU $9A
RANDOM_POINTER EQU $9B
;FRAME_COUNT EQU $9C
LOOP EQU $9C
MB_VALUE EQU $9D
;MB_CHUNK EQU $9E
MB_ADDRL EQU $9F