Skip to content

Commit

Permalink
Add YM2413 state to tech info
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-zhao committed May 8, 2023
1 parent 7d1ffc1 commit ab20805
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions meka/srcs/app_techinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

t_app_tech_info TechInfo;

extern u8 * FM_Regs;

//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion meka/srcs/app_techinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Definitions
//-----------------------------------------------------------------------------

#define TECHINFO_LINES (10)
#define TECHINFO_LINES (14)
#define TECHINFO_COLUMNS (80)

//-----------------------------------------------------------------------------
Expand Down

0 comments on commit ab20805

Please sign in to comment.