pt3_lib: fix issue where vibrato was broken

backed out a qkumba optimization that in retrospect I am not sure
what it was doing but it was broken subtly in at least 2 places

could probabl be re-optimized again, especially the pt3_lib version
This commit is contained in:
Vince Weaver 2019-08-31 01:34:01 -04:00
parent 077a84baa5
commit 5c07480333
8 changed files with 37 additions and 30 deletions

View File

@ -21,7 +21,7 @@
; + 2817 bytes -- eliminate pt3_version. Slighly faster but also bigger
; + 2828 bytes -- fix some correctness issues
; + 2776 bytes -- init vars with loop (slower, but more correct and smaller)
; + 2783 bytes -- fix vibrato code to work again
; TODO
; move some of these flags to be bits rather than bytes?
@ -1064,23 +1064,24 @@ done_note:
lsr pt3_mixer_value
handle_onoff:
lda note_a+NOTE_ONOFF,X ;if (a->onoff>0) {
ldy note_a+NOTE_ONOFF,X ;if (a->onoff>0) {
beq done_onoff
dec note_a+NOTE_ONOFF,X ; a->onoff--;
dey ; a->onoff--;
bne done_onoff ; if (a->onoff==0) {
bne put_offon ; if (a->onoff==0) {
lda note_a+NOTE_ENABLED,X
eor #$1 ; toggle
sta note_a+NOTE_ENABLED,X
.byte $a9 ;mask do_onoff
beq do_offon
do_onoff:
dex ; select ONOFF
;lda note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
ldy note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
jmp put_offon
do_offon:
lda note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
ldy note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
put_offon:
tya
sta note_a+NOTE_ONOFF,X
done_onoff:

View File

@ -21,7 +21,7 @@
; + 2817 bytes -- eliminate pt3_version. Slighly faster but also bigger
; + 2828 bytes -- fix some correctness issues
; + 2776 bytes -- init vars with loop (slower, but more correct and smaller)
; + 2783 bytes -- fix vibrato code to work again
; TODO
; move some of these flags to be bits rather than bytes?
@ -1064,23 +1064,24 @@ done_note:
lsr pt3_mixer_value
handle_onoff:
lda note_a+NOTE_ONOFF,X ;if (a->onoff>0) {
ldy note_a+NOTE_ONOFF,X ;if (a->onoff>0) {
beq done_onoff
dec note_a+NOTE_ONOFF,X ; a->onoff--;
dey ; a->onoff--;
bne done_onoff ; if (a->onoff==0) {
bne put_offon ; if (a->onoff==0) {
lda note_a+NOTE_ENABLED,X
eor #$1 ; toggle
sta note_a+NOTE_ENABLED,X
.byte $a9 ;mask do_onoff
beq do_offon
do_onoff:
dex ; select ONOFF
;lda note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
ldy note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
jmp put_offon
do_offon:
lda note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
ldy note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
put_offon:
tya
sta note_a+NOTE_ONOFF,X
done_onoff:

View File

@ -21,7 +21,7 @@
; + 2817 bytes -- eliminate pt3_version. Slighly faster but also bigger
; + 2828 bytes -- fix some correctness issues
; + 2776 bytes -- init vars with loop (slower, but more correct and smaller)
; + 2783 bytes -- fix vibrato code to work again
; TODO
; move some of these flags to be bits rather than bytes?
@ -1064,23 +1064,24 @@ done_note:
lsr pt3_mixer_value
handle_onoff:
lda note_a+NOTE_ONOFF,X ;if (a->onoff>0) {
ldy note_a+NOTE_ONOFF,X ;if (a->onoff>0) {
beq done_onoff
dec note_a+NOTE_ONOFF,X ; a->onoff--;
dey ; a->onoff--;
bne done_onoff ; if (a->onoff==0) {
bne put_offon ; if (a->onoff==0) {
lda note_a+NOTE_ENABLED,X
eor #$1 ; toggle
sta note_a+NOTE_ENABLED,X
.byte $a9 ;mask do_onoff
beq do_offon
do_onoff:
dex ; select ONOFF
;lda note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
ldy note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
jmp put_offon
do_offon:
lda note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
ldy note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
put_offon:
tya
sta note_a+NOTE_ONOFF,X
done_onoff:

View File

@ -61,6 +61,7 @@ pt3_debug.dsk: PT3_DUMPER PT3_TIMER PT3_TABLE_TEST HELLO_DEBUG DUMP
$(DOS33) -y pt3_debug.dsk BSAVE -a 0x4000 ./music/BH.PT3
$(DOS33) -y pt3_debug.dsk BSAVE -a 0x4000 ./music/ND.PT3
$(DOS33) -y pt3_debug.dsk BSAVE -a 0x4000 ./music/OO.PT3
$(DOS33) -y pt3_debug.dsk BSAVE -a 0x4000 ./music/DY.PT3
HELLO: hello.bas
../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO

View File

@ -29,6 +29,7 @@ Code Optimization
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%
FixVibrato 2423 + 143
Times: Validated
BH.PT3: 10.0B 16 1:33 93 17.2%

BIN
pt3_player/music/DY.PT3 Normal file

Binary file not shown.

View File

@ -425,7 +425,8 @@ song_list:
; .asciiz "CR.PT3"
; .asciiz "EA.PT3"
; .asciiz "RI.PT3"
.asciiz "OO.PT3"
; .asciiz "OO.PT3"
.asciiz "DY.PT3"
;=========
;routines

View File

@ -22,7 +22,8 @@
; + 2828 bytes -- fix some correctness issues
; + 2776 bytes -- init vars with loop (slower, but more correct and smaller)
; + 2739 bytes -- qkumba's crazy SMC everywhere patch
; + 2430+120 = 2650 bytes -- move NOTE structs to page0
; + 2418+143 = 2561 bytes -- move NOTE structs to page0
; + 2423+143 = 2566 bytes -- fix vibrato code
; TODO
; move some of these flags to be bits rather than bytes?
@ -1034,13 +1035,13 @@ handle_onoff:
bne put_offon ; if (a->onoff==0) {
lda note_a+NOTE_ENABLED,X
eor #$1 ; toggle
eor #$1 ; toggle note_enabled
sta note_a+NOTE_ENABLED,X
.byte $a9 ;mask do_onoff
beq do_offon
do_onoff:
dex ; select ONOFF
;lda note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
ldy note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
jmp put_offon
do_offon:
ldy note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
put_offon: