From 3a57302641556814833868f5ae203eeef0a7c595 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 7 Nov 2019 22:04:25 -0500 Subject: [PATCH] ds: sound on first scene at least --- demosplash/appleII_intro.s | 29 ++++++----- demosplash/demosplash.s | 3 ++ demosplash/pt3_lib_play_frame.s | 87 +++++++++++++++++++++++++-------- demosplash/zp.inc | 2 + 4 files changed, 89 insertions(+), 32 deletions(-) diff --git a/demosplash/appleII_intro.s b/demosplash/appleII_intro.s index 342163fa..c814da61 100644 --- a/demosplash/appleII_intro.s +++ b/demosplash/appleII_intro.s @@ -9,7 +9,7 @@ appleII_intro: ; init screen ; jsr TEXT ; jsr HOME - bit KEYRESET +; bit KEYRESET ;=================== ; init vars @@ -159,9 +159,9 @@ page1_loop: ; delay 115+(7 loop)+4 (bit)+4(extra) ; -1174 ; -7 (keypress) ; -3 (jump) - ; -1186 (play_music) + ; -1239 (play_music) ; ===== - ; 2179 + ; 2126 2179 jsr do_nothing ; 6 @@ -408,13 +408,18 @@ loop29: dex ; 2 ;========================== ;========================== intro_wipe_done: - lda KEYPRESS ; 4 - bpl no_keypress2 ; 3 - jmp appleii_done + lda FRAME_PLAY_PAGE ; 3 + cmp #2 ; 2 + beq appleii_done ; 3 + ; -1 + +; lda KEYPRESS ; 4 +; bpl no_keypress2 ; 3 +; jmp appleii_done no_keypress2: - jsr play_frame_compressed ; 6+1180 + jsr play_frame_compressed ; 6+1233 jmp display_loop ; 3 @@ -426,13 +431,15 @@ appleii_done: ;================================= ; do nothing ;================================= - ; and take 2179-12 = 2167 cycles to do it + ; and take 2126-12 = 2114 cycles to do it do_nothing: + ; Try X=21 Y=19 cycles=2110R4 - ; Try X=71 Y=6 cycles=2167 + nop + nop - ldy #6 ; 2 -loop1: ldx #71 ; 2 + ldy #19 ; 2 +loop1: ldx #21 ; 2 loop2: dex ; 2 bne loop2 ; 2nt/3 dey ; 2 diff --git a/demosplash/demosplash.s b/demosplash/demosplash.s index 1eb58694..7e2a95bb 100644 --- a/demosplash/demosplash.s +++ b/demosplash/demosplash.s @@ -11,6 +11,9 @@ demosplash2019: ;========================= lda #0 sta DONE_PLAYING + sta FRAME_PLAY_OFFSET + sta FRAME_PLAY_PAGE + jsr update_pt3_play jsr mockingboard_init jsr pt3_setup_interrupt diff --git a/demosplash/pt3_lib_play_frame.s b/demosplash/pt3_lib_play_frame.s index 4c34c1ff..8c71b725 100644 --- a/demosplash/pt3_lib_play_frame.s +++ b/demosplash/pt3_lib_play_frame.s @@ -14,11 +14,11 @@ ;DA00 ;a $AE00,$AF00,$B000 = ENV high (r12) ; 3+ 72 + 72 + 83 + 74 + 72 + 77 + 19 + 70 + 74 + 72 + - ; 77 + 18 + 82 + 85 + 72 + 72 + 8 + 72 + 6 = 1180 + ; 77 + 18 + 82 + 85 + 72 + 72 + 10 + 123 + 6 = 1233 /////1180 play_frame_compressed: - ldy FRAME_OFFSET ; 3 + ldy FRAME_PLAY_OFFSET ; 3 ; Register 0: A fine ldx #0 ; 2 @@ -186,33 +186,27 @@ r12_smc: ; wrap to next iny ; 2 - sty FRAME_OFFSET ; 3 + sty FRAME_PLAY_OFFSET ; 3 + cpy #59*3 ; FIXME: song specific ; 2 beq frame_wrap ; 3 ;========== - ; 8 + ; 10 no_frame_wrap: ; -1 - ; delay 72+1-3=70 - lda #43 ; 70-2-25=43 - jsr delay_a + ; delay 123+1-3=121 + lda #94 ; 2 + jsr delay_a ; 121-2-25=94 jmp done_frame_wrap ; 3 frame_wrap: - inc r0_smc+2 ; 6 - inc r1_smc+2 ; 6 - inc r2_smc+2 ; 6 - inc r4_smc+2 ; 6 - inc r5_smc+2 ; 6 - inc r13_smc+2 ; 6 - inc r6_smc+2 ; 6 - inc r7_smc+2 ; 6 - inc r8_smc+2 ; 6 - inc r9_smc+2 ; 6 - inc r11_smc+2 ; 6 - inc r12_smc+2 ; 6 - ;===== - ; 72 + lda #0 ; 2 + sta FRAME_PLAY_OFFSET ; 3 + + inc FRAME_PLAY_PAGE ; 5 + jsr update_pt3_play ; 6+107 + ;===== + ; 123 done_frame_wrap: @@ -253,3 +247,54 @@ play_mb_write: + ;=========================== + ; update the SMC counters + + ; 13+88+6=107 + +update_pt3_play: + lda FRAME_PLAY_PAGE ; 3 + asl ; 2 + asl ; 2 + asl ; 2 + asl ; 2 + tay ; 2 + ;=== + ; 13 + + lda music_addr_table+0,Y ; 4 + sta r0_smc+2 ; 4 + + lda music_addr_table+1,Y ; 4 + sta r1_smc+2 ; 4 + + lda music_addr_table+2,Y ; 4 + sta r2_smc+2 ; 4 + + lda music_addr_table+3,Y ; 4 + sta r4_smc+2 ; 4 + + lda music_addr_table+4,Y ; 4 + sta r13_smc+2 ; 4 + + lda music_addr_table+5,Y ; 4 + sta r6_smc+2 ; 4 + + lda music_addr_table+6,Y ; 4 + sta r7_smc+2 ; 4 + + lda music_addr_table+7,Y ; 4 + sta r8_smc+2 ; 4 + + lda music_addr_table+8,Y ; 4 + sta r9_smc+2 ; 4 + + lda music_addr_table+9,Y ; 4 + sta r11_smc+2 ; 4 + + lda music_addr_table+10,Y ; 4 + sta r12_smc+2 ; 4 + ;========== + ; 11*8 = 88 + + rts ; 6 diff --git a/demosplash/zp.inc b/demosplash/zp.inc index 9f86f847..a8993772 100644 --- a/demosplash/zp.inc +++ b/demosplash/zp.inc @@ -38,6 +38,8 @@ ASTEROID_SPEED = $52 ASTEROID_X = $53 ASTEROID_Y = $54 RANDOM_PTR = $55 +FRAME_PLAY_OFFSET=$56 +FRAME_PLAY_PAGE = $57 FIRE_Y = $5B SPRITE_XPOS = $5C