From 3da22c126a26b523ef2bc6f8deb3c610a6e19bc1 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 18 Nov 2019 15:46:12 -0500 Subject: [PATCH] ds: more work on sound slightly better, weird pause :( --- demosplash2019/demosplash.s | 2 +- demosplash2019/loader.s | 20 ++++++++++++++++++++ demosplash2019/pt3_lib_init.s | 4 +++- demosplash2019/pt3_lib_play_frame.s | 14 +++++++------- demosplash2019/pt3_lib_write_frame.s | 26 ++++++++++++-------------- demosplash2019/zp.inc | 3 +++ 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/demosplash2019/demosplash.s b/demosplash2019/demosplash.s index 7964ed5a..1f776baa 100644 --- a/demosplash2019/demosplash.s +++ b/demosplash2019/demosplash.s @@ -12,7 +12,7 @@ demosplash2019: ;================================================== lda #$38 - ldy #$20 + ldy #$0 zp_clear_loop: sta $0,y iny diff --git a/demosplash2019/loader.s b/demosplash2019/loader.s index dc35b7d0..49375da8 100644 --- a/demosplash2019/loader.s +++ b/demosplash2019/loader.s @@ -41,6 +41,26 @@ filbuf = $3D6 ; filbuf: .res 4 ; = bit2tbl+86 start: jsr init ; unhook DOS, init nibble table + + +clear_out_ram: + ldx #$14 + stx OUTH + ldy #0 + sty OUTL + lda #$77 +clear_ram_outer: + ldy #0 +clear_ram_inner: + dey + sta (OUTL),Y + bne clear_ram_inner + + inx + stx OUTH + cpx #$c0 + bne clear_ram_outer + ;====================== which_load_loop: diff --git a/demosplash2019/pt3_lib_init.s b/demosplash2019/pt3_lib_init.s index cd87437d..7d8b4635 100644 --- a/demosplash2019/pt3_lib_init.s +++ b/demosplash2019/pt3_lib_init.s @@ -30,7 +30,7 @@ zero_song_structs_loop: sta pt3_envelope_slide_add_h_smc+1 ; 4 sta pt3_envelope_add_smc+1 ; 4 sta pt3_envelope_type_smc+1 ; 4 - sta pt3_envelope_type_old_smc+1 ; 4 + sta pt3_envelope_type_old_smc+1 ; ok as set_env always ; 4 sta pt3_envelope_delay_smc+1 ; 4 sta pt3_envelope_delay_orig_smc+1 ; 4 @@ -45,6 +45,8 @@ zero_song_structs_loop: sta note_b+NOTE_VOLUME ; 4 sta note_c+NOTE_VOLUME ; 4 + + ; default ornament/sample in A ; X is zero coming in here ;ldx #(NOTE_STRUCT_SIZE*0) ; 2 diff --git a/demosplash2019/pt3_lib_play_frame.s b/demosplash2019/pt3_lib_play_frame.s index bcb960ee..a04e1dd0 100644 --- a/demosplash2019/pt3_lib_play_frame.s +++ b/demosplash2019/pt3_lib_play_frame.s @@ -66,7 +66,7 @@ r4_smc: ; Register 5: C coarse ldx #5 ; 2 -r5_smc: +r13_smc: lda $D400,Y ; 4+ pha ; 3 and #$f ; 2 @@ -81,7 +81,7 @@ r5_smc: lsr ; 2 lsr ; 2 -r13_smc: +r5_smc: ldx $D500,Y ; check for env update ; 4 bmi skip_envelope_write ; 3 ;============ @@ -274,12 +274,12 @@ update_pt3_play: lda music_addr_table+3,Y ; 4 sta r4_smc+2 ; 4 ; D3 - lda music_addr_table+5,Y ; 4 - sta r5_smc+2 ; 4 ; D4 + lda music_addr_table+4,Y ; 4 + sta r13_smc+2 ; 4 ; D4 - lda music_addr_table+4,Y ; 4 ; D5 - sta r6_smc+2 ; 4 - sta r13_smc+2 ; 4 ; D5 + lda music_addr_table+5,Y ; 4 + sta r5_smc+2 ; 4 ; D5 + sta r6_smc+2 ; 4 ; D5 lda music_addr_table+6,Y ; 4 ; D6 sta r7_smc+2 ; 4 diff --git a/demosplash2019/pt3_lib_write_frame.s b/demosplash2019/pt3_lib_write_frame.s index 85833cb9..431deda8 100644 --- a/demosplash2019/pt3_lib_write_frame.s +++ b/demosplash2019/pt3_lib_write_frame.s @@ -55,7 +55,7 @@ r4_wrsmc: ; Register 5: Envelope Shape [top] / C coarse [bottom] lda C_COARSE_TONE and #$f - sta C_COARSE_TONE + sta C_COARSE_TEMP lda ENVELOPE_SHAPE cmp #$ff @@ -67,19 +67,17 @@ yes_envelope: asl asl asl - ora C_COARSE_TONE - sta C_COARSE_TONE + ora C_COARSE_TEMP + sta C_COARSE_TEMP lda #0 - sta ENVELOPE_SHAPE jmp done_envelope no_envelope: lda #$80 - sta ENVELOPE_SHAPE - done_envelope: + sta ENV_SHAPE_TEMP - lda C_COARSE_TONE + lda C_COARSE_TEMP r13_wrsmc: sta $D400,Y @@ -88,7 +86,7 @@ r13_wrsmc: ; Register 6: Noise lda NOISE and #$1f - ora ENVELOPE_SHAPE + ora ENV_SHAPE_TEMP r6_wrsmc: sta $D500,Y @@ -103,19 +101,19 @@ r7_wrsmc: lda A_VOLUME and #$1f - sta A_VOLUME + sta A_VOL_TEMP lda B_VOLUME and #$10 asl - ora A_VOLUME - sta A_VOLUME + ora A_VOL_TEMP + sta A_VOL_TEMP lda C_VOLUME and #$10 asl asl - ora A_VOLUME + ora A_VOL_TEMP r8_wrsmc: sta $D700,Y @@ -124,14 +122,14 @@ r8_wrsmc: lda B_VOLUME and #$f - sta B_VOLUME + sta A_VOL_TEMP lda C_VOLUME asl asl asl asl - ora B_VOLUME + ora A_VOL_TEMP r9_wrsmc: sta $D800,Y diff --git a/demosplash2019/zp.inc b/demosplash2019/zp.inc index a894e5ea..51c44fde 100644 --- a/demosplash2019/zp.inc +++ b/demosplash2019/zp.inc @@ -88,6 +88,9 @@ MB_ADDRH = $87 DONE_PLAYING = $88 DONE_SONG = $89 PT3_TEMP = $8A +ENV_SHAPE_TEMP = $8B +C_COARSE_TEMP = $8C +A_VOL_TEMP = $8D KEYPTRL = $90 KEYPTRH = $91