pt3_player: optimize get_note

This commit is contained in:
Vince Weaver 2019-09-09 01:06:21 -04:00
parent f15bab8a6c
commit 0e2a9ecd06
4 changed files with 47 additions and 14 deletions

View File

@ -1995,7 +1995,7 @@ done_do_frame:
; FIXME: self modify code
; TOTAL = 14 + 14 + 13 = 41
; TOTAL = 14 + 14 + 13 = 41 cycles
GetNoteFreq:

View File

@ -30,6 +30,7 @@ Code Optimization
MoveNoteToZP 2650 ?? 1A.23 26s 171s 15.2%
MinorFixes 2418 + 143 1A.1F 26s 171s 15.2%
FixVibrato 2423 + 143 1A.1F 26s 171s 15.2%
GetNoteSMC 1A.16 26 171s 15.2%
Times: Validated
BH.PT3: 10.0B 16 1:33 93 17.2%

View File

@ -423,10 +423,10 @@ FRAMEH: .byte $00
song_list:
; .asciiz "CR.PT3"
; .asciiz "EA.PT3"
.asciiz "EA.PT3"
; .asciiz "RI.PT3"
; .asciiz "OO.PT3"
.asciiz "DY.PT3"
; .asciiz "DY.PT3"
;=========
;routines

View File

@ -447,6 +447,36 @@ zero_song_structs_loop:
sta pt3_loop_smc+1 ; 4
;========================
; set up note table
lda PT3_LOC+PT3_HEADER_FREQUENCY ; 4
cmp #1 ; 2
bne use_freq_table_2 ; 2/3
use_freq_table_1:
lda #>PT3NoteTable_ST_high ; 4+
sta get_note_smc1+2
lda #<PT3NoteTable_ST_high ; 4+
sta get_note_smc1+1
lda #>PT3NoteTable_ST_low ; 4+
sta get_note_smc2+2
lda #<PT3NoteTable_ST_low ; 4+
jmp done_set_freq_table
use_freq_table_2:
lda #>PT3NoteTable_ASM_34_35_high ; 4+
sta get_note_smc1+2
lda #<PT3NoteTable_ASM_34_35_high ; 4+
sta get_note_smc1+1
lda #>PT3NoteTable_ASM_34_35_low ; 4+
sta get_note_smc2+2
lda #<PT3NoteTable_ASM_34_35_low ; 4+
done_set_freq_table:
sta get_note_smc2+1
;======================
; calculate version
ldx #6 ; 2
@ -2197,14 +2227,16 @@ done_do_frame:
GetNoteFreq:
sty PT3_TEMP ; 3
tay ; 2
lda PT3_LOC+PT3_HEADER_FREQUENCY ; 4
cmp #1 ; 2
bne freq_table_2 ; 2/3
; lda PT3_LOC+PT3_HEADER_FREQUENCY ; 4
; cmp #1 ; 2
; bne freq_table_2 ; 2/3
get_note_smc1:
lda PT3NoteTable_ST_high,Y ; 4+
sta freq_h_smc+1 ; 4
get_note_smc2:
lda PT3NoteTable_ST_low,Y ; 4+
sta freq_l_smc+1 ; 4
@ -2214,14 +2246,14 @@ GetNoteFreq:
; 40
freq_table_2:
lda PT3NoteTable_ASM_34_35_high,Y ; 4+
sta freq_h_smc+1 ; 4
lda PT3NoteTable_ASM_34_35_low,Y ; 4+
sta freq_l_smc+1 ; 4
;freq_table_2:
; lda PT3NoteTable_ASM_34_35_high,Y ; 4+
; sta freq_h_smc+1 ; 4
; lda PT3NoteTable_ASM_34_35_low,Y ; 4+
; sta freq_l_smc+1 ; 4
ldy PT3_TEMP ; 3
rts ; 6
; ldy PT3_TEMP ; 3
; rts ; 6
;===========
; 41