From 8aa831782c1951acfb8e98ec4d5af62e02c69bef Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 19 Jun 2019 00:40:10 -0400 Subject: [PATCH] pt3: pt3_mixer_val is copied direct to AY_regs, so make same var --- pt3_player/OPTIMIZATION.txt | 1 + pt3_player/pt3_lib.s | 21 ++++++++++----------- pt3_player/zp.inc | 29 +++++++++++++++-------------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/pt3_player/OPTIMIZATION.txt b/pt3_player/OPTIMIZATION.txt index 025f0127..279d50f5 100644 --- a/pt3_player/OPTIMIZATION.txt +++ b/pt3_player/OPTIMIZATION.txt @@ -28,6 +28,7 @@ Code Optimization Fixes,zero init 2776 ?? 1C.10 28s 171s 16.3% Qkumba-SuperSMC 2739 ?? 1B.15 27s 171s 15.8% MoveNoteToZP 2650 ?? 1A.23 26s 171s 15.2% + MinorFixes 2418 + 143 1A.1F 26s 171s 15.2% Times: Validated BH.PT3: 10.0B 16 1:33 93 17.2% diff --git a/pt3_player/pt3_lib.s b/pt3_player/pt3_lib.s index 8fd33284..504c060a 100644 --- a/pt3_player/pt3_lib.s +++ b/pt3_player/pt3_lib.s @@ -409,7 +409,7 @@ zero_song_structs_loop: sta pt3_envelope_delay_smc+1 ; 4 sta pt3_envelope_delay_orig_smc+1 ; 4 - sta pt3_mixer_value_smc+1 ; 4 + sta PT3_MIXER_VAL ; 3 sta current_pattern_smc+1 ; 4 sta current_line_smc+1 ; 4 @@ -986,9 +986,9 @@ noise_slide_done: lda sample_b1_smc+1 ; pt3->mixer_value = ((b1 >>1) & 0x48) | pt3->mixer_value; lsr and #$48 -pt3_mixer_value_smc: - ora #$d1 - sta pt3_mixer_value_smc+1 + + ora PT3_MIXER_VAL ; 3 + sta PT3_MIXER_VAL ; 3 ;======================== @@ -1024,7 +1024,7 @@ done_note: ; set mixer value ; this is a bit complex (from original code) ; after 3 calls it is set up properly - lsr pt3_mixer_value_smc+1 + lsr PT3_MIXER_VAL handle_onoff: ldy note_a+NOTE_ONOFF,X ;if (a->onoff>0) { @@ -1890,7 +1890,7 @@ do_frame: ; R14/R15 = I/O (ignored) ldx #0 ; needed ; 2 - stx pt3_mixer_value_smc+1 ; 4 + stx PT3_MIXER_VAL ; 3 stx pt3_envelope_add_smc+1 ; 4 ;;ldx #(NOTE_STRUCT_SIZE*0) ; Note A ; 2 @@ -2067,17 +2067,16 @@ no_scale_n: ;======================= ; Mixer - lda pt3_mixer_value_smc+1 ; 4 - sta AY_REGISTERS+7 ; 3 + ; PT3_MIXER_VAL is already in AY_REGISTERS+7 ;======================= ; Amplitudes - lda note_a+NOTE_AMPLITUDE ; 4 + lda note_a+NOTE_AMPLITUDE ; 3 sta AY_REGISTERS+8 ; 3 - lda note_b+NOTE_AMPLITUDE ; 4 + lda note_b+NOTE_AMPLITUDE ; 3 sta AY_REGISTERS+9 ; 3 - lda note_c+NOTE_AMPLITUDE ; 4 + lda note_c+NOTE_AMPLITUDE ; 3 sta AY_REGISTERS+10 ; 3 ;====================================== diff --git a/pt3_player/zp.inc b/pt3_player/zp.inc index a2211113..6450b2ea 100644 --- a/pt3_player/zp.inc +++ b/pt3_player/zp.inc @@ -45,20 +45,21 @@ SEEDH = $4F ;FILEMH = $65 AY_REGISTERS = $50 -A_FINE_TONE = $50 -A_COARSE_TONE = $51 -B_FINE_TONE = $52 -B_COARSE_TONE = $53 -C_FINE_TONE = $54 -C_COARSE_TONE = $55 -NOISE = $56 -ENABLE = $57 -A_VOLUME = $58 -B_VOLUME = $59 -C_VOLUME = $5A -ENVELOPE_FINE = $5B -ENVELOPE_COARSE = $5C -ENVELOPE_SHAPE = $5D + A_FINE_TONE = $50 + A_COARSE_TONE = $51 + B_FINE_TONE = $52 + B_COARSE_TONE = $53 + C_FINE_TONE = $54 + C_COARSE_TONE = $55 + NOISE = $56 + ENABLE = $57 + PT3_MIXER_VAL = $57 + A_VOLUME = $58 + B_VOLUME = $59 + C_VOLUME = $5A + ENVELOPE_FINE = $5B + ENVELOPE_COARSE = $5C + ENVELOPE_SHAPE = $5D PATTERN_L = $00 PATTERN_H = $01