double: use pt3 music

should fit in the blank
This commit is contained in:
Vince Weaver 2023-05-13 00:06:46 -04:00
parent fd9cf82d2c
commit 0cdf8b01c8
7 changed files with 2095 additions and 285 deletions

View File

@ -211,10 +211,7 @@ skip_all_checks:
;========================
jsr mockingboard_init
jsr mockingboard_setup_interrupt
zurg:
; jsr mockingboard_setup_interrupt
;============================
; Init the Mockingboard
@ -385,46 +382,35 @@ stringing_done:
sta FULLGR
;==============
; set up music
;==============
lda #0
sta CURRENT_CHUNK
sta DONE_PLAYING
sta BASE_FRAME_L
lda #<fighting_zx02
sta ZX0_src
; set up first song
lda #>fighting_zx02
sta ZX0_src+1
lda #<music_parts_l
sta chunk_l_smc+1
lda #>music_parts_l
sta chunk_l_smc+2
lda #$b0 ; decompress at $b000
lda #<music_parts_h
sta chunk_h_smc+1
lda #>music_parts_h
sta chunk_h_smc+2
jsr full_decomp
lda #$D0
sta CHUNK_NEXT_LOAD ; Load at $D0
jsr load_song_chunk
PT3_LOC = $b000
lda #$D0 ; music starts at $d000
sta CHUNK_NEXT_PLAY
sta BASE_FRAME_H
;==================
; init song
;==================
jsr pt3_init_song
lda #0
sta DONE_PLAYING
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
@ -433,10 +419,7 @@ stringing_done:
double_loop:
jsr load_music
jsr play_music
jsr fake_interrupt
; note, coming out of vblank routines might be
; 8-12 cycles in already
@ -587,9 +570,11 @@ wait_until_keypress:
.include "pt3_lib_detect_model.s"
.include "pt3_lib_mockingboard_detect.s"
.include "pt3_lib_core.s"
.include "pt3_lib_init.s"
.include "pt3_lib_mockingboard_setup.s"
.include "interrupt_handler.s"
.include "pt3_lib_mockingboard_detect.s"
.include "pt3_lib_mockingboard_patch.s"
.include "zx02_optim.s"
@ -629,41 +614,11 @@ config_string:
.include "gr_fast_clear.s"
.include "wait_a_bit.s"
.include "wait.s"
.include "load_music.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"
fighting_zx02:
.incbin "music/fighting.zx02"

View File

@ -18,176 +18,56 @@
; 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
; php ; save status flags
; cld ; clear decimal mode
; pha ; save A ; 3
; A is saved in $45 by firmware
txa
pha ; save X
tya
pha ; save Y
; txa
; pha ; save X
; tya
; pha ; save Y
; inc $0404 ; debug (flashes char onscreen)
inc TIMER_COUNT
pt3_irq_smc1:
bit MOCK_6522_T1CL ; clear 6522 interrupt by reading T1C-L ; 4
.endif
fake_interrupt:
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
;============
; 13
.include "pt3_lib_irq_handler.s"
ym_play_music:
jmp exit_interrupt
; see if need to pre-load next chunk
lda BASE_FRAME_L
cmp #1
bne no_preload_chunk
;=================================
; Finally done with this interrupt
;=================================
lda BASE_FRAME_H
and #1
bne no_preload_chunk
quiet_exit:
stx DONE_PLAYING
jsr clear_ay_both
inc LOAD_NEXT_CHUNK ; defer this until after interrupt
no_preload_chunk:
lda BASE_FRAME_L ; reset frame pointer to beginning
sta CURRENT_FRAME_L
lda BASE_FRAME_H
sta CURRENT_FRAME_H
ldx #0
frame_loop:
ldy #0
lda (CURRENT_FRAME_L),Y
cmp #$ff
bne all_good
cpx #1 ; see if A coarse is $FF
beq go_next_chunk ; if so, end of song, loop
all_good:
jsr update_ay_register ; output to the AY
clc
lda CURRENT_FRAME_H ; next register set is 2 pages away
adc #$2 ; was 4
sta CURRENT_FRAME_H
inx
cpx #12 ; only output 11 regs
bne frame_loop
ldx #$ff ; also mute the channel
stx AY_REGISTERS+7 ; just in case
inc BASE_FRAME_L ; increment frame ptr (16bit)
bne not_oflo
inc BASE_FRAME_H ; wrap to next page
lda BASE_FRAME_H ; if too big, go to next chunk
and #$3
cmp #$2 ; was D4
bne not_oflo
go_next_chunk:
lda CHUNK_NEXT_PLAY ; toggle $D0/$E8
eor #$38
sta CHUNK_NEXT_PLAY
sta BASE_FRAME_H
lda #0
sta BASE_FRAME_L ; in case song ended early
inc CURRENT_CHUNK ; point to next chunk
; inc LOAD_NEXT_CHUNK ; defer this until after interrupt
; jsr load_song_chunk
not_oflo:
exit_interrupt:
rts
.if 0
exit_interrupt:
pla
tay ; restore Y
pla
tax ; restore X
pla ; restore a ; 4
; pla
; tay ; restore Y
; pla
; tax ; restore X
; pla ; restore a ; 4
; on II+/IIe (but not IIc) we need to do this?
interrupt_smc:
lda $45 ; restore A
plp
; lda $45 ; restore A
; plp
rti ; return from interrupt ; 6
; rti ; return from interrupt ; 6
;============
; typical
; ???? cycles
.endif
;=========================
; update ay_register
; reg in X
; value in A
update_ay_register:
pt3_irq_smc2:
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
stx MOCK_6522_ORA2 ; put address on PA2 ; 4
ldy #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
pt3_irq_smc3:
sty MOCK_6522_ORB1 ; latch_address on PB1 ; 4
sty MOCK_6522_ORB2 ; latch_address on PB2 ; 4
ldy #MOCK_AY_INACTIVE ; go inactive ; 2
pt3_irq_smc4:
sty MOCK_6522_ORB1 ; 4
sty MOCK_6522_ORB2 ; 4
; value
pt3_irq_smc5:
sta MOCK_6522_ORA1 ; put value on PA1 ; 4
sta MOCK_6522_ORA2 ; put value on PA2 ; 4
lda #MOCK_AY_WRITE ; ; 2
pt3_irq_smc6:
sta MOCK_6522_ORB1 ; write on PB1 ; 4
sty MOCK_6522_ORB1 ; 4
pt3_irq_smc7:
sta MOCK_6522_ORB2 ; write on PB2 ; 4
sty MOCK_6522_ORB2 ; 4
rts
done_pt3_irq_handler:
disable_music:
; sei
ldx #1
stx DONE_PLAYING
jsr clear_ay_both
; mute the sound
ldx #7
lda #$ff
jsr update_ay_register
rts

View File

@ -1,55 +1,16 @@
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
all: fighting.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
###
fighting.zx02: fighting.pt3
$(ZX02) fighting.pt3 fighting.zx02
####
clean:
rm -f *.zx02 *.part1 *.part2 *.part3 *.part4 *.part5 *.part6 *.part7 *.part8 *.part9 *.part10
clean:
rm -f *~ *.o *.lst *.zx02

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -20,24 +20,45 @@ BASH = $29
V2 = $2D
COLOR = $30
; ym player
CURRENT_FRAME_L = $70
CURRENT_FRAME_H = $71
BASE_FRAME_L = $72
BASE_FRAME_H = $73
CURRENT_CHUNK = $74
TIME_MINUTES = $75
TIME_SECONDS = $76
CURSOR_X = $77
; pt3 player
DRAW_PAGE = $7A
ORNAMENT_L = $60
ORNAMENT_H = $61
SAMPLE_L = $62
SAMPLE_H = $63
CHUNK_NEXT_LOAD = $7D
CHUNK_NEXT_PLAY = $7E
LOAD_NEXT_CHUNK = $7F
TIMER_COUNT = $81
LOOP = $64
MB_ADDR_L = $65
MB_ADDR_H = $66
MB_VALUE = $67
DONE_PLAYING = $68
DONE_SONG = $69
PT3_TEMP = $6A
APPLEII_MODEL = $6B
APPLEII_MODEL = $8B
AY_REGISTERS = $70
A_FINE_TONE = $70
A_COARSE_TONE = $71
B_FINE_TONE = $72
B_COARSE_TONE = $73
C_FINE_TONE = $74
C_COARSE_TONE = $75
NOISE = $76
ENABLE = $77
PT3_MIXER_VAL = $77
A_VOLUME = $78
B_VOLUME = $79
C_VOLUME = $7A
ENVELOPE_FINE = $7B
ENVELOPE_COARSE = $7C
ENVELOPE_SHAPE = $7D
PATTERN_L = $7E
PATTERN_H = $7F
DRAW_PAGE = $8A
SOUND_STATUS = $DE
SOUND_DISABLED = $80
@ -55,12 +76,12 @@ TEMPY = $F0
XX = $F1
; rest of pt3_player
LOOP = $F4
MB_VALUE = $F5
MB_ADDR_L = $F6
MB_ADDR_H = $F7
DONE_PLAYING = $F8
DONE_SONG = $F9
;LOOP = $F4
;MB_VALUE = $F5
;MB_ADDR_L = $F6
;MB_ADDR_H = $F7
;DONE_PLAYING = $F8
;DONE_SONG = $F9
YPOS = $FA