From ab2080546ef9f437d23a1a0933bca4cd650e6eb8 Mon Sep 17 00:00:00 2001 From: Maxim Date: Mon, 8 May 2023 17:55:17 +0100 Subject: [PATCH] Add YM2413 state to tech info --- meka/srcs/app_techinfo.cpp | 32 ++++++++++++++++++++++++++++++++ meka/srcs/app_techinfo.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/meka/srcs/app_techinfo.cpp b/meka/srcs/app_techinfo.cpp index 71669c82..1b824f53 100644 --- a/meka/srcs/app_techinfo.cpp +++ b/meka/srcs/app_techinfo.cpp @@ -20,6 +20,8 @@ t_app_tech_info TechInfo; +extern u8 * FM_Regs; + //----------------------------------------------------------------------------- // Functions //----------------------------------------------------------------------------- @@ -192,6 +194,36 @@ void TechInfo_Update(void) TechInfo_SetLine(app, line, line_idx++); } + { + if (FM_Regs != NULL) + { + sprintf(line, " [YM2413] Custom inst: %02X/%02X/%02X/%02X/%02X/%02X/%02X/%02X Rhythm: %02X", + FM_Regs[0], FM_Regs[1], FM_Regs[2], FM_Regs[3], FM_Regs[4], FM_Regs[5], FM_Regs[6], FM_Regs[7], + FM_Regs[0xe]); + TechInfo_SetLine(app, line, line_idx++); + char* p = line; + p += sprintf(p, " [YM2413]"); + for (int i = 0; i < 9; ++i) + { + p += sprintf(p, " Tone %d: %01X,%03X,%c,%c,%01X,%01X", + i, + (FM_Regs[i + 0x20] & 0x6) >> 1, // Block + FM_Regs[i + 0x10] | ((FM_Regs[i + 0x20] & 1) << 8), // F-num + (FM_Regs[i + 0x20] & 0x20) != 0 ? 'S' : '-', // Sustain + (FM_Regs[i + 0x20] & 0x10) != 0 ? 'K' : '-', // Key + FM_Regs[i + 0x30] & 0x0f, // Volume + FM_Regs[i + 0x30] >> 4 // Instrument + ); + if (i % 3 == 2) + { + TechInfo_SetLine(app, line, line_idx++); + p = line; + p += sprintf(p, " [YM2413]"); + } + } + } + } + // - Memory { char mapper_regs[256]; diff --git a/meka/srcs/app_techinfo.h b/meka/srcs/app_techinfo.h index 6f3e2c14..91973ef1 100644 --- a/meka/srcs/app_techinfo.h +++ b/meka/srcs/app_techinfo.h @@ -7,7 +7,7 @@ // Definitions //----------------------------------------------------------------------------- -#define TECHINFO_LINES (10) +#define TECHINFO_LINES (14) #define TECHINFO_COLUMNS (80) //-----------------------------------------------------------------------------