interlace: fix some bugs, audio more or less right again

This commit is contained in:
Vince Weaver 2019-09-16 23:07:53 -04:00
parent a2fd3f42b3
commit d5f92ae451
4 changed files with 77 additions and 42 deletions

View File

@ -47,7 +47,8 @@ rasterbars_sound.o: rasterbars_sound.s gr_copy.s \
rasterbars_screen.s rasterbars_table.s movement_table.s rb_bg.inc \
pt3_lib_core.s pt3_lib_init.s pt3_lib_mockingboard.s \
pt3_lib_sample_ornament.s pt3_write_frame.s pt3_lib_calculate_note.s \
pt3_lib_decode_note.s pt3_lib_make_frame.s pt3_lib_do_frame.s
pt3_lib_decode_note.s pt3_lib_make_frame.s pt3_lib_do_frame.s \
pt3_lib_set_pattern.s
ca65 -o rasterbars_sound.o rasterbars_sound.s -l rasterbars_sound.lst

View File

@ -119,10 +119,12 @@ note_command_smc:
decode_jump_table:
.word decode_case_0X,decode_case_1X,decode_case_2X,decode_case_3X
.word decode_case_4X,decode_case_5X,decode_case_6X,decode_case_7X
.word decode_case_8X,decode_case_9X,decode_case_AX,decode_case_BX
.word decode_case_CX,decode_case_DX,decode_case_EX,decode_case_FX
.word decode_case_0X-1,decode_case_1X-1,decode_case_2X-1
.word decode_case_3X-1,decode_case_4X-1,decode_case_5X-1
.word decode_case_6X-1,decode_case_7X-1,decode_case_8X-1
.word decode_case_9X-1,decode_case_AX-1,decode_case_BX-1
.word decode_case_CX-1,decode_case_DX-1,decode_case_EX-1
.word decode_case_FX-1
decode_case_0X:
;==============================
@ -241,6 +243,7 @@ decode_case_BX:
lda note_command_bottom_smc+1 ; 4
beq decode_case_b0 ; 3
; -1
sec
sbc #1 ; envelope_type=(current_val&0xf)-1; ; 2
bne decode_case_bx_higher ; 3

View File

@ -56,8 +56,30 @@ pt3_new_line:
pt3_pattern_done_smc:
lda #$d1 ; 2
beq early_end ; 2/3
bne line_good ; 2/3
;==========================
; pattern done early!
early_end:
; A is pattern_done which is zero at this point
inc current_pattern_smc+1 ; increment pattern ; 6
sta current_line_smc+1 ; 4
sta current_subframe_smc+1 ; 4
; always goes to set_pattern here?
jmp set_pattern ; 3
check_subframe:
lda current_subframe_smc+1 ; 4
bne pattern_good ; 2/3
set_pattern:
; load a new pattern in
jsr pt3_set_pattern ;6+?
jmp pt3_new_line ; 3
;=============================
; State D

View File

@ -6,6 +6,11 @@
; Set Pattern
;=====================================
; set pattern: 11 + 12 + 22 + 22 + 22 + 19 + 18 = 126
; set_pattern_end: 11 + 16 + ...
pt3_set_pattern:
; Lookup current pattern in pattern table
@ -15,15 +20,33 @@ current_pattern_smc:
; if value is $FF we are at the end of the song
cmp #$ff ; 2
bne not_done ; 3
bne not_done_delay_16 ; 3
;===========
; 11
is_done:
; -1
; for cycle counted version let's set DONE_SONG
; but also set to loop forever
; done with song, set it to non-zero
sta DONE_SONG ; 3
rts ; 6
ldy PT3_LOC+PT3_LOOP ; 3
sty current_pattern_smc+1 ; 4
lda PT3_LOC+PT3_PATTERN_TABLE,Y ; 4+
jmp not_done ; 3
;============
; 20 if end
; 16
not_done_delay_16:
inc CYCLE_WASTE ; 5
inc CYCLE_WASTE ; 5
nop
nop
nop
not_done:
@ -40,69 +63,55 @@ not_done:
lda PT3_LOC+PT3_PATTERN_LOC_H ; 4
adc #>PT3_LOC ; assume page boundary ; 2
sta PATTERN_H ; 3
;===========
; 22
; First 16-bits points to the Channel A address
lda (PATTERN_L),Y ; 5+
sta note_a+NOTE_ADDR_L ; 4
sta note_a+NOTE_ADDR_L ; 3
iny ; 2
lda (PATTERN_L),Y ; 5+
adc #>PT3_LOC ; assume page boundary ; 2
sta note_a+NOTE_ADDR_H ; 4
sta note_a+NOTE_ADDR_H ; 3
iny ; 2
;===========
; 22
; Next 16-bits points to the Channel B address
lda (PATTERN_L),Y ; 5+
sta note_b+NOTE_ADDR_L ; 4
sta note_b+NOTE_ADDR_L ; 3
iny ; 2
lda (PATTERN_L),Y ; 5+
adc #>PT3_LOC ; assume page boundary ; 2
sta note_b+NOTE_ADDR_H ; 4
sta note_b+NOTE_ADDR_H ; 3
iny ; 2
;===========
; 22
; Next 16-bits points to the Channel C address
lda (PATTERN_L),Y ; 5+
sta note_c+NOTE_ADDR_L ; 4
sta note_c+NOTE_ADDR_L ; 3
iny ; 2
lda (PATTERN_L),Y ; 5+
adc #>PT3_LOC ; assume page boundary ; 2
sta note_c+NOTE_ADDR_H ; 4
sta note_c+NOTE_ADDR_H ; 2
;===========
; 19
; clear out the noise channel
lda #0 ; 2
sta pt3_noise_period_smc+1 ; 4
; Set all three channels as active
; FIXME: num_channels, may need to be 6 if doing 6-channel pt3?
lda #3 ; 2
sta pt3_pattern_done_smc+1 ; 4
rts ; 6
;==========================
; pattern done early!
early_end:
; A is pattern_done which is zero at this point
inc current_pattern_smc+1 ; increment pattern ; 6
sta current_line_smc+1 ; 4
sta current_subframe_smc+1 ; 4
; always goes to set_pattern here?
jmp set_pattern ; 3
check_subframe:
lda current_subframe_smc+1 ; 4
bne pattern_good ; 2/3
set_pattern:
; load a new pattern in
jsr pt3_set_pattern ;6+?
lda DONE_SONG ; 3
beq pt3_new_line ; 2/3
rts ; 6
;============
; 18