double: more music

This commit is contained in:
Vince Weaver 2023-05-12 01:21:30 -04:00
parent 5d405c27cd
commit fd9cf82d2c
7 changed files with 201 additions and 40 deletions

View File

@ -28,7 +28,7 @@ double.o: double.s \
zx02_optim.s copy_400.s gr_offsets.s vblank.s \
lc_detect.s text_print.s title.s gr_fast_clear.s \
interrupt_handler.s pt3_lib_mockingboard_patch.s \
wait_a_bit.s wait.s \
wait_a_bit.s wait.s load_music.s \
graphics/sworg_hgr.hgr.zx02 \
graphics/sworg_dhgr.aux.zx02 \
graphics/sworg_dhgr.bin.zx02 \

View File

@ -293,40 +293,6 @@ stringing_smc:
stringing_done:
.if 0
lda a2_string,X
eor #$80
sta $800,X
sta $880+1,X
sta $900+2,X
sta $980+3,X
sta $A00+4,X
sta $A80+5,X
sta $B00+6,X
sta $B80+7,X
sta $828+0,X
sta $8A8+1,X
sta $928+2,X
sta $9A8+3,X
sta $A28+4,X
sta $AA8+5,X
sta $B28+6,X
sta $BA8+7,X
sta $850+0,X
sta $8D0+1,X
sta $950+2,X
sta $9D0+3,X
sta $A50+4,X
sta $AD0+5,X
sta $B50+6,X
sta $BD0+7,X
dex
bpl a24e_loop
.endif
; set 80-store mode
@ -420,6 +386,46 @@ stringing_done:
sta FULLGR
;==============
; set up music
;==============
lda #0
sta CURRENT_CHUNK
sta DONE_PLAYING
sta BASE_FRAME_L
; set up first song
lda #<music_parts_l
sta chunk_l_smc+1
lda #>music_parts_l
sta chunk_l_smc+2
lda #<music_parts_h
sta chunk_h_smc+1
lda #>music_parts_h
sta chunk_h_smc+2
lda #$D0
sta CHUNK_NEXT_LOAD ; Load at $D0
jsr load_song_chunk
lda #$D0 ; music starts at $d000
sta CHUNK_NEXT_PLAY
sta BASE_FRAME_H
lda #1
sta LOOP
; sta CURRENT_CHUNK
sta LOAD_NEXT_CHUNK
; switch in language card
; read/write RAM, $d000 bank 2
lda $C08b
lda $C08b
;=================================
; main static loop
;=================================
@ -427,6 +433,11 @@ stringing_done:
double_loop:
jsr load_music
jsr play_music
; note, coming out of vblank routines might be
; 8-12 cycles in already
@ -618,3 +629,42 @@ config_string:
.include "gr_fast_clear.s"
.include "wait_a_bit.s"
.include "wait.s"
.include "load_music.s"
music_parts_h:
.byte >fighting_part1_zx02,>fighting_part2_zx02,>fighting_part3_zx02
.byte >fighting_part4_zx02,>fighting_part5_zx02,>fighting_part6_zx02
.byte >fighting_part7_zx02,>fighting_part8_zx02,>fighting_part9_zx02
.byte >fighting_part10_zx02
.byte $00
music_parts_l:
.byte <fighting_part1_zx02,<fighting_part2_zx02,<fighting_part3_zx02
.byte <fighting_part4_zx02,<fighting_part5_zx02,<fighting_part6_zx02
.byte <fighting_part7_zx02,<fighting_part8_zx02,<fighting_part9_zx02
.byte <fighting_part10_zx02
fighting_part1_zx02:
.incbin "music/fighting.part1.zx02"
fighting_part2_zx02:
.incbin "music/fighting.part2.zx02"
fighting_part3_zx02:
.incbin "music/fighting.part3.zx02"
fighting_part4_zx02:
.incbin "music/fighting.part4.zx02"
fighting_part5_zx02:
.incbin "music/fighting.part5.zx02"
fighting_part6_zx02:
.incbin "music/fighting.part6.zx02"
fighting_part7_zx02:
.incbin "music/fighting.part7.zx02"
fighting_part8_zx02:
.incbin "music/fighting.part8.zx02"
fighting_part9_zx02:
.incbin "music/fighting.part9.zx02"
fighting_part10_zx02:
.incbin "music/fighting.part10.zx02"

View File

@ -18,6 +18,7 @@
; to be sure status flag and accumulator set properly
interrupt_handler:
.if 0
php ; save status flags
cld ; clear decimal mode
pha ; save A ; 3
@ -33,7 +34,9 @@ interrupt_handler:
pt3_irq_smc1:
bit MOCK_6522_T1CL ; clear 6522 interrupt by reading T1C-L ; 4
.endif
play_music:
lda DONE_PLAYING ; 3
beq ym_play_music ; if song done, don't play music ; 3/2nt
jmp done_pt3_irq_handler ; 3
@ -108,6 +111,9 @@ go_next_chunk:
not_oflo:
rts
.if 0
exit_interrupt:
pla
@ -127,7 +133,7 @@ interrupt_smc:
; typical
; ???? cycles
.endif
@ -172,7 +178,7 @@ done_pt3_irq_handler:
disable_music:
sei
; sei
ldx #1
stx DONE_PLAYING

View File

@ -0,0 +1,50 @@
load_music:
lda LOAD_NEXT_CHUNK ; see if we need to load next chunk
beq no_load_chunk ; outside IRQ to avoid glitch in music
jsr load_song_chunk
lda #0 ; reset
sta LOAD_NEXT_CHUNK
no_load_chunk:
rts
;========================
; load song chunk
; CURRENT_CHUNK is which one, 0..N
; CHUNK_DEST is $D0 or $E8
load_song_chunk:
ldx CURRENT_CHUNK
chunk_l_smc:
lda $DDDD,X
sta ZX0_src
chunk_h_smc:
lda $DDDD,X
sta ZX0_src+1
bne load_song_chunk_good
; $00 in chunk table means we are off the end, so wrap
; lda #$00
sta CURRENT_CHUNK ; reset chunk to 0
beq load_song_chunk ; try again
load_song_chunk_good:
lda CHUNK_NEXT_LOAD ; decompress to $D0 or $E8
jsr full_decomp
lda CHUNK_NEXT_LOAD ; point to next location
eor #$38
sta CHUNK_NEXT_LOAD
rts

View File

@ -0,0 +1,55 @@
YM5_TO_RAW = ~/research/vmw-meter.git/ay-3-8910/conversion_tools/ym5_to_raw
YM_TO_YM5 = ~/research/vmw-meter.git/ay-3-8910/conversion_tools/ym_to_ym5
RAW_INTERLEAVE = ~/research/vmw-meter.git/ay-3-8910/conversion_tools/raw_interleave
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
all: fighting.part1.zx02 fighting.part2.zx02 fighting.part3.zx02 \
fighting.part4.zx02 fighting.part5.zx02 fighting.part6.zx02 \
fighting.part7.zx02 fighting.part8.zx02 fighting.part9.zx02 \
fighting.part10.zx02
fighting.raw: fighting.ym
$(YM5_TO_RAW) ./fighting.ym > fighting.raw
####
fighting.part1: fighting.raw
$(RAW_INTERLEAVE) -m 11 -c 512 ./fighting
fighting.part1.zx02: fighting.part1
$(ZX02) fighting.part1 fighting.part1.zx02
fighting.part2.zx02: fighting.part2
$(ZX02) fighting.part2 fighting.part2.zx02
fighting.part3.zx02: fighting.part3
$(ZX02) fighting.part3 fighting.part3.zx02
fighting.part4.zx02: fighting.part4
$(ZX02) fighting.part4 fighting.part4.zx02
fighting.part5.zx02: fighting.part5
$(ZX02) fighting.part5 fighting.part5.zx02
fighting.part6.zx02: fighting.part6
$(ZX02) fighting.part6 fighting.part6.zx02
fighting.part7.zx02: fighting.part7
$(ZX02) fighting.part7 fighting.part7.zx02
fighting.part8.zx02: fighting.part8
$(ZX02) fighting.part8 fighting.part8.zx02
fighting.part9.zx02: fighting.part9
$(ZX02) fighting.part9 fighting.part9.zx02
fighting.part10.zx02: fighting.part10
$(ZX02) fighting.part10 fighting.part10.zx02
####
clean:
rm -f *.zx02 *.part1 *.part2 *.part3 *.part4 *.part5 *.part6 *.part7 *.part8 *.part9 *.part10

Binary file not shown.

View File

@ -182,9 +182,9 @@ mockingboard_setup_interrupt:
; nop out the "lda $45" since we are bypassing the ROM irq handler
; that puts A in $45
lda #$EA
sta interrupt_smc
sta interrupt_smc+1
; lda #$EA
; sta interrupt_smc
; sta interrupt_smc+1
;=========================