command stream preset instruments/volumes

This commit is contained in:
tildearrow 2025-11-10 18:27:45 -05:00
parent d3ce1a0b84
commit 92ad27f87e
5 changed files with 200 additions and 38 deletions

View file

@ -22,7 +22,7 @@
#include "imgui.h"
#include "guiConst.h"
String disasmCmd(unsigned char* buf, size_t bufLen, unsigned int addr, unsigned char* speedDial) {
String disasmCmd(unsigned char* buf, size_t bufLen, unsigned int addr, unsigned char* fastIns, unsigned char* fastVols, unsigned char* fastCmds) {
if (addr>=bufLen) return "???";
if (buf[addr]<0xb4) {
@ -104,14 +104,17 @@ String disasmCmd(unsigned char* buf, size_t bufLen, unsigned int addr, unsigned
if (addr+2>=bufLen) return "???";
return fmt::sprintf("pan $%x, $%x",(int)buf[addr+1],(int)buf[addr+2]);
break;
case 0xe0: case 0xe1: case 0xe2: case 0xe3:
case 0xe4: case 0xe5: case 0xe6: case 0xe7:
case 0xe8: case 0xe9: case 0xea: case 0xeb:
case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5:
return fmt::sprintf("qins%d $%.2x",buf[addr]-0xe0,fastIns[buf[addr]-0xe0]);
break;
case 0xe6: case 0xe7: case 0xe8: case 0xe9: case 0xea: case 0xeb:
return fmt::sprintf("qvol%d $%.2x",buf[addr]-0xe6,fastVols[buf[addr]-0xe6]);
break;
case 0xec: case 0xed: case 0xee: case 0xef: {
unsigned char cmd=speedDial[buf[addr]&15];
unsigned char cmd=fastCmds[buf[addr]&3];
int cmdLen=DivCS::getCmdLength(cmd);
if ((addr+cmdLen)>=bufLen) return "???";
String ret=fmt::sprintf("qcmd%d %s",buf[addr]-0xd0,(cmd<DIV_CMD_MAX)?cmdName[cmd]:"INVALID");
String ret=fmt::sprintf("qcmd%d %s",buf[addr]-0xec,(cmd<DIV_CMD_MAX)?cmdName[cmd]:"INVALID");
for (int i=0; i<cmdLen; i++) {
ret+=fmt::sprintf(", %.2x",buf[addr+1+i]);
}
@ -325,7 +328,7 @@ void FurnaceGUI::drawCSPlayer() {
if (state->trace[j]==0) {
ImGui::TextUnformatted("...");
} else {
String dis=disasmCmd(buf,bufSize,state->trace[j],cs->getFastCmds());
String dis=disasmCmd(buf,bufSize,state->trace[j],cs->getFastIns(),cs->getFastVols(),cs->getFastCmds());
ImGui::Text("%.4x: %s",state->trace[j],dis.c_str());
}
}
@ -400,7 +403,7 @@ void FurnaceGUI::drawCSPlayer() {
}
ImGui::TableNextColumn();
String dis=disasmCmd(i.data,8,0,cs->getFastCmds());
String dis=disasmCmd(i.data,8,0,cs->getFastIns(),cs->getFastVols(),cs->getFastCmds());
ImGui::Text("%s",dis.c_str());
// jmp/ret separator
@ -599,8 +602,18 @@ void FurnaceGUI::drawCSPlayer() {
ImGui::SameLine();
ImGui::Text("%d",cs->getFastDelays()[i]);
}
ImGui::Text("preset instruments:");
for (int i=0; i<6; i++) {
ImGui::SameLine();
ImGui::Text("%d",cs->getFastIns()[i]);
}
ImGui::Text("preset volumes:");
for (int i=0; i<6; i++) {
ImGui::SameLine();
ImGui::Text("%d",cs->getFastVols()[i]);
}
ImGui::Text("speed dial commands:");
for (int i=0; i<16; i++) {
for (int i=0; i<4; i++) {
ImGui::SameLine();
ImGui::Text("%d",cs->getFastCmds()[i]);
}