From 5c0748033326b5f2f1013f3645a557b935190717 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 31 Aug 2019 01:34:01 -0400 Subject: [PATCH] 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 --- demosplash/pt3_lib.s | 17 +++++++++-------- ootw/pt3_lib.s | 17 +++++++++-------- pt3_lib/pt3_lib.s | 17 +++++++++-------- pt3_player/Makefile | 1 + pt3_player/OPTIMIZATION.txt | 1 + pt3_player/music/DY.PT3 | Bin 0 -> 3902 bytes pt3_player/pt3_dumper.s | 3 ++- pt3_player/pt3_lib.s | 11 ++++++----- 8 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 pt3_player/music/DY.PT3 diff --git a/demosplash/pt3_lib.s b/demosplash/pt3_lib.s index 054bdadf..416f9bad 100644 --- a/demosplash/pt3_lib.s +++ b/demosplash/pt3_lib.s @@ -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: diff --git a/ootw/pt3_lib.s b/ootw/pt3_lib.s index 054bdadf..416f9bad 100644 --- a/ootw/pt3_lib.s +++ b/ootw/pt3_lib.s @@ -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: diff --git a/pt3_lib/pt3_lib.s b/pt3_lib/pt3_lib.s index 054bdadf..416f9bad 100644 --- a/pt3_lib/pt3_lib.s +++ b/pt3_lib/pt3_lib.s @@ -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: diff --git a/pt3_player/Makefile b/pt3_player/Makefile index 70b61803..6bc4d320 100644 --- a/pt3_player/Makefile +++ b/pt3_player/Makefile @@ -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 diff --git a/pt3_player/OPTIMIZATION.txt b/pt3_player/OPTIMIZATION.txt index 279d50f5..711cc05a 100644 --- a/pt3_player/OPTIMIZATION.txt +++ b/pt3_player/OPTIMIZATION.txt @@ -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% diff --git a/pt3_player/music/DY.PT3 b/pt3_player/music/DY.PT3 new file mode 100644 index 0000000000000000000000000000000000000000..228cdff3f735d6b4f61f828f75eaae9e8aa3bc5e GIT binary patch literal 3902 zcmcIneP~8j&kimRmj4=pNx74yUMS9BWG^Y7u9qTA;D+vx|D{HmixleNJ zG>I3+Y|gvq+;iW#zk9y!)6wM26UnEJedn3v$l-?`9yvDi{P&;x?o+AfX1+Hv^X$l; zf8R>)xnx8dqv9V#)E)j|_`UGck;{=AkbO>~QSiJFK3F zkwJ#tVTWVg`}+ol2ktv`|HnV^nNJ@6^yeNq^7%)<`1Qvgf8wjnSHxNI8*yH|g8!=6 z#PhFW3r~{#jL5U%QMn|~$Y0BM!9QTk7-!_F@pofWJZL^?Zi(NTO+1fUKex^bWnHn( zNVS81+hS|VV#~_vw70||+vktkynfl{^;OMB0%zpg))xXBfjc3V4Q>S74mIJ?FiprW*DW=X4hgz0>uREixlvQk&0=nt#>{vP z3ub)5U!8=|Pg6TJQ@-Zg(Db!6#~`SlVqJ-1e043`s4Fum)8b`%y;(_0W%z7e1&%8@ zTR9GOs)Dr;z|PXOP+i&6e@tMiqUZ9h9s$Q>h%S!LMEWu1!*~vIFiS=zx$>f^%ni3wV1Ku?_ z?hYrLQ*ypC2law~viZ7H=DZ*Z)9ucOt@Qay%F14f-{FL8a}E}P2pk`=p^SyZYJFZR zdrk~fh?IoO%(-}38O20J$+@z(Uc?c+xiuvoFOxsX%sB z$rBZs75nJjW=&ZcY+6)irsme$f|bG4x(Z}UDp;)X#(sctj7ty~l$G{hO4p7zs>+(h z^0GgaRA3e_Z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index 61f1190c..9725f73a 100644 --- a/pt3_player/pt3_dumper.s +++ b/pt3_player/pt3_dumper.s @@ -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 diff --git a/pt3_player/pt3_lib.s b/pt3_player/pt3_lib.s index 014055c6..af64a58e 100644 --- a/pt3_player/pt3_lib.s +++ b/pt3_player/pt3_lib.s @@ -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: