From 0c6c70c098884cdf71d0eaa6b435b7ff7b60f71d Mon Sep 17 00:00:00 2001 From: shingo45endo Date: Mon, 24 Feb 2025 06:07:26 +0900 Subject: [PATCH 1/3] Fix to issue TXI interrupt when SCR is written Such behavior is not described anywhere in the H8/532 hardware manual, but the SC-55 firmware seems to be implemented on the assumption of such behavior. --- src/mcu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mcu.cpp b/src/mcu.cpp index 50ca007b..202adacc 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -328,6 +328,7 @@ void MCU_DeviceWrite(uint32_t address, uint8_t data) case DEV_P7DDR: break; case DEV_SCR: + MCU_Interrupt_SetRequest(INTERRUPT_SOURCE_UART_TX, (data & 0x80) != 0 && (dev_register[DEV_SSR] & 0x80) != 0); break; case DEV_WCR: break; From d8ae4c2cb2fc3edd377d9b89a6af8fe2cd1b3ca6 Mon Sep 17 00:00:00 2001 From: shingo45endo Date: Mon, 24 Feb 2025 06:10:05 +0900 Subject: [PATCH 2/3] Fix SSR being entirely overwritten Only the clear operation is valid for the SSR register, but the register is entirely overwritten at the end of the function because it does not return at the end of the DEV_SSR case. --- src/mcu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mcu.cpp b/src/mcu.cpp index 202adacc..c39f3ea7 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -417,7 +417,7 @@ void MCU_DeviceWrite(uint32_t address, uint8_t data) { dev_register[address] &= ~0x10; } - break; + return; } default: address += 0; From cdbc5eb7ab476ebe519bc064d2eff4a3abaf08d3 Mon Sep 17 00:00:00 2001 From: shingo45endo Date: Mon, 24 Feb 2025 06:17:54 +0900 Subject: [PATCH 3/3] Fix the initial value of SSR According to the hardware manual, the initial value of the SSR register is H'87. --- src/mcu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mcu.cpp b/src/mcu.cpp index c39f3ea7..2f9acc54 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -513,7 +513,7 @@ void MCU_DeviceReset(void) // dev_register[0x00] = 0x03; // dev_register[0x7c] = 0x87; dev_register[DEV_RAME] = 0x80; - dev_register[DEV_SSR] = 0x80; + dev_register[DEV_SSR] = 0x87; } void MCU_UpdateAnalog(uint64_t cycles)