From 1546870773d6b9d3e2ccb48da2c8cb5bfaf92702 Mon Sep 17 00:00:00 2001 From: Persune Date: Sat, 17 Feb 2024 17:06:45 +0800 Subject: [PATCH] Fix S5B init clobbering Kxx state Fixes #256. Fixes #246. Fixes #215. --- Source/drivers/asm/s5b.s | 8 ++++---- Source/drivers/drv_all.h | 4 ++-- Source/drivers/drv_s5b.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/drivers/asm/s5b.s b/Source/drivers/asm/s5b.s index f4ce1e98..e013b0dc 100644 --- a/Source/drivers/asm/s5b.s +++ b/Source/drivers/asm/s5b.s @@ -15,10 +15,10 @@ ft_init_s5b: sta var_EnvelopeRate sta var_EnvelopeRate + 1 sta var_EnvelopeType - ldx #(CH_COUNT_S5B - 1) -: sta var_EnvelopeAutoShift, x - sta var_EnvelopeEnabled, x - dex + sta var_EnvelopeEnabled + ldx #CH_COUNT_S5B +: dex + sta var_EnvelopeAutoShift, x bne :- lda #$07 sta $C000 diff --git a/Source/drivers/drv_all.h b/Source/drivers/drv_all.h index 9eefb748..10d991ff 100644 --- a/Source/drivers/drv_all.h +++ b/Source/drivers/drv_all.h @@ -588,8 +588,8 @@ const unsigned char DRIVER_ALL[] = { // // // 0x8A, 0x48, 0xB5, 0x90, 0x29, 0x7F, 0xAA, 0xA0, 0x00, 0xB1, 0x08, 0x8D, 0x00, 0x48, 0xC8, 0xCA, 0xD0, 0xF7, 0x68, 0xAA, 0x68, 0xA8, 0x60, 0x78, 0x70, 0x68, 0x60, 0x58, 0x50, 0x48, 0x40, 0xA9, 0x40, 0x8D, 0x9E, 0x04, 0x8D, 0x9F, 0x04, 0x8D, 0xA0, 0x04, 0xA9, 0xFF, 0x85, 0xBD, 0xA9, 0x00, - 0x85, 0xBC, 0x85, 0xBB, 0x85, 0xBF, 0x85, 0xC0, 0x85, 0xC1, 0xA2, 0x02, 0x95, 0xC2, 0x95, 0xC5, - 0xCA, 0xD0, 0xF9, 0xA9, 0x07, 0x8D, 0x00, 0xC0, 0xA9, 0x38, 0x85, 0xBE, 0x8D, 0x00, 0xE0, 0x60, + 0x85, 0xBC, 0x85, 0xBB, 0x85, 0xBF, 0x85, 0xC0, 0x85, 0xC1, 0x85, 0xC5, 0xA2, 0x03, 0xCA, 0x95, + 0xC2, 0xD0, 0xFB, 0xA9, 0x07, 0x8D, 0x00, 0xC0, 0xA9, 0x38, 0x85, 0xBE, 0x8D, 0x00, 0xE0, 0x60, 0xAD, 0x17, 0x02, 0xD0, 0x17, 0xA2, 0x08, 0x8E, 0x00, 0xC0, 0x8D, 0x00, 0xE0, 0xE8, 0x8E, 0x00, 0xC0, 0x8D, 0x00, 0xE0, 0xE8, 0x8E, 0x00, 0xC0, 0x8D, 0x00, 0xE0, 0x60, 0xA2, 0x00, 0x86, 0xBE, 0xA2, 0x02, 0x06, 0xBE, 0xBD, 0xB9, 0x04, 0x30, 0x02, 0xE6, 0xBE, 0xCA, 0x10, 0xF4, 0xA2, 0x02, diff --git a/Source/drivers/drv_s5b.h b/Source/drivers/drv_s5b.h index a2621907..5cb4f3df 100644 --- a/Source/drivers/drv_s5b.h +++ b/Source/drivers/drv_s5b.h @@ -395,8 +395,8 @@ const unsigned char DRIVER_S5B[] = { // // // 0x0A, 0x0B, 0x0C, 0x0D, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xA9, 0x40, 0x8D, 0xD6, 0x02, 0x8D, 0xD7, 0x02, 0x8D, 0xD8, 0x02, 0xA9, - 0xFF, 0x85, 0x25, 0xA9, 0x00, 0x85, 0x24, 0x85, 0x23, 0x85, 0x27, 0x85, 0x28, 0x85, 0x29, 0xA2, - 0x02, 0x95, 0x2A, 0x95, 0x2D, 0xCA, 0xD0, 0xF9, 0xA9, 0x07, 0x8D, 0x00, 0xC0, 0xA9, 0x38, 0x85, + 0xFF, 0x85, 0x25, 0xA9, 0x00, 0x85, 0x24, 0x85, 0x23, 0x85, 0x27, 0x85, 0x28, 0x85, 0x29, 0x85, + 0x2D, 0xA2, 0x03, 0xCA, 0x95, 0x2A, 0xD0, 0xFB, 0xA9, 0x07, 0x8D, 0x00, 0xC0, 0xA9, 0x38, 0x85, 0x26, 0x8D, 0x00, 0xE0, 0x60, 0xAD, 0x15, 0x02, 0xD0, 0x17, 0xA2, 0x08, 0x8E, 0x00, 0xC0, 0x8D, 0x00, 0xE0, 0xE8, 0x8E, 0x00, 0xC0, 0x8D, 0x00, 0xE0, 0xE8, 0x8E, 0x00, 0xC0, 0x8D, 0x00, 0xE0, 0x60, 0xA2, 0x00, 0x86, 0x26, 0xA2, 0x02, 0x06, 0x26, 0xBD, 0xDD, 0x02, 0x30, 0x02, 0xE6, 0x26,