diff --git a/ui/ui_ay38910.h b/ui/ui_ay38910.h index a7c7b81..881aad4 100644 --- a/ui/ui_ay38910.h +++ b/ui/ui_ay38910.h @@ -110,7 +110,7 @@ void ui_ay38910_init(ui_ay38910_t* win, const ui_ay38910_desc_t* desc) { win->init_x = (float) desc->x; win->init_y = (float) desc->y; win->init_w = (float) ((desc->w == 0) ? 440 : desc->w); - win->init_h = (float) ((desc->h == 0) ? 378 : desc->h); + win->init_h = (float) ((desc->h == 0) ? 420 : desc->h); win->open = desc->open; win->valid = true; ui_chip_init(&win->chip, &desc->chip_desc); @@ -163,15 +163,32 @@ static void _ui_ay38910_draw_state(ui_ay38910_t* win) { } ImGui::EndTable(); } - ImGui::Separator(); - ImGui::Text("Noise Period %02X (reg:%02X)", ay->noise.period, ay->reg[AY38910_REG_PERIOD_NOISE]); - ImGui::Text("Noise Count %02X", ay->noise.counter); - ImGui::Text("Noise Rand %05X", ay->noise.rng); - ImGui::Text("Noise Bit %s", ay->noise.bit ? "ON":"OFF"); - ImGui::Separator(); - ImGui::Text("Env Period %04X (reg:%04X)", ay->env.period, (ay->reg[AY38910_REG_ENV_PERIOD_COARSE]<<8)|ay->reg[AY38910_REG_ENV_PERIOD_FINE]); - ImGui::Text("Env Count %04X", ay->env.counter); - ImGui::Text("Env Ampl %02X", ay->env.shape_state); + if (ImGui::BeginTable("##ay_noise", 2)) { + ImGui::TableSetupColumn("Noise", ImGuiTableColumnFlags_WidthFixed, 86); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("Period"); ImGui::TableNextColumn(); + ImGui::Text("%02X (reg:%02X)", ay->noise.period, ay->reg[AY38910_REG_PERIOD_NOISE]); ImGui::TableNextColumn(); + ImGui::Text("Count"); ImGui::TableNextColumn(); + ImGui::Text("%02X", ay->noise.counter); ImGui::TableNextColumn(); + ImGui::Text("Rand"); ImGui::TableNextColumn(); + ImGui::Text("%05X", ay->noise.rng); ImGui::TableNextColumn(); + ImGui::Text("Bit"); ImGui::TableNextColumn(); + ImGui::Text("%s", ay->noise.bit ? "ON":"OFF"); ImGui::TableNextColumn(); + ImGui::EndTable(); + } + if (ImGui::BeginTable("##ay_envelope", 2)) { + ImGui::TableSetupColumn("Envelope", ImGuiTableColumnFlags_WidthFixed, 86); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("Period"); ImGui::TableNextColumn(); + ImGui::Text("%04X (reg:%04X)", ay->env.period, (ay->reg[AY38910_REG_ENV_PERIOD_COARSE]<<8)|ay->reg[AY38910_REG_ENV_PERIOD_FINE]); ImGui::TableNextColumn(); + ImGui::Text("Count"); ImGui::TableNextColumn(); + ImGui::Text("%04X", ay->env.counter); ImGui::TableNextColumn(); + ImGui::Text("Amplitude"); ImGui::TableNextColumn(); + ImGui::Text("%02X", ay->env.shape_state); ImGui::TableNextColumn(); + ImGui::EndTable(); + } const int num_ports = (ay->type==AY38910_TYPE_8910) ? 2 : ((ay->type == AY38910_TYPE_8912) ? 1 : 0); const int max_ports = 2; if (ImGui::BeginTable("##ay_ports", max_ports + 1)) { diff --git a/ui/ui_m6526.h b/ui/ui_m6526.h index f5ce679..f80b4ba 100644 --- a/ui/ui_m6526.h +++ b/ui/ui_m6526.h @@ -122,95 +122,92 @@ void ui_m6526_discard(ui_m6526_t* win) { static void _ui_m6526_draw_state(ui_m6526_t* win) { const m6526_t* cia = win->cia; - ImGui::Columns(3, "##cia_columns", false); - ImGui::SetColumnWidth(0, 64); - ImGui::SetColumnWidth(1, 80); - ImGui::SetColumnWidth(2, 80); - - /* ports */ - ImGui::NextColumn(); - ImGui::Text("Port A"); ImGui::NextColumn(); - ImGui::Text("Port B"); ImGui::NextColumn(); - ImGui::Separator(); - ImGui::Text("DDR"); ImGui::NextColumn(); - ui_util_b8("", cia->pa.ddr); ImGui::NextColumn(); - ui_util_b8("", cia->pb.ddr); ImGui::NextColumn(); - ImGui::Text("Reg"); ImGui::NextColumn(); - ui_util_b8("", cia->pa.reg); ImGui::NextColumn(); - ui_util_b8("", cia->pb.reg); ImGui::NextColumn(); - ImGui::Text("Inp"); ImGui::NextColumn(); - ui_util_b8("", cia->pa.inp); ImGui::NextColumn(); - ui_util_b8("", cia->pb.inp); ImGui::NextColumn(); - ImGui::Text("Pins"); ImGui::NextColumn(); - ui_util_b8("", cia->pa.pins); ImGui::NextColumn(); - ui_util_b8("", cia->pb.pins); ImGui::NextColumn(); - - /* timers */ - ImGui::Separator(); - ImGui::NextColumn(); - ImGui::Text("Timer A"); ImGui::NextColumn(); - ImGui::Text("Timer B"); ImGui::NextColumn(); - ImGui::Separator(); - ImGui::Text("Latch"); ImGui::NextColumn(); - ImGui::Text("%04X", cia->ta.latch); ImGui::NextColumn(); - ImGui::Text("%04X", cia->tb.latch); ImGui::NextColumn(); - ImGui::Text("Counter"); ImGui::NextColumn(); - ImGui::Text("%04X", cia->ta.counter); ImGui::NextColumn(); - ImGui::Text("%04X", cia->tb.counter); ImGui::NextColumn(); - ImGui::Text("Control"); ImGui::NextColumn(); - ui_util_b8("", cia->ta.cr); ImGui::NextColumn(); - ui_util_b8("", cia->tb.cr); ImGui::NextColumn(); - ImGui::Text(":START"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_TIMER_STARTED(cia->ta.cr) ? "STARTED":"STOP"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_TIMER_STARTED(cia->tb.cr) ? "STARTED":"STOP"); ImGui::NextColumn(); - ImGui::Text(":PBON"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_PBON(cia->ta.cr) ? "PB6":"---"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_PBON(cia->tb.cr) ? "PB7":"---"); ImGui::NextColumn(); - ImGui::Text(":OUTMODE"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_OUTMODE_TOGGLE(cia->ta.cr) ? "TOGGLE":"PULSE"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_OUTMODE_TOGGLE(cia->tb.cr) ? "TOGGLE":"PULSE"); ImGui::NextColumn(); - ImGui::Text(":RUNMODE"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_RUNMODE_ONESHOT(cia->ta.cr) ? "ONESHOT":"CONT"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_RUNMODE_ONESHOT(cia->tb.cr) ? "ONESHOT":"CONT"); ImGui::NextColumn(); - ImGui::Text(":INMODE"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_TA_INMODE_PHI2(cia->ta.cr) ? "PHI2":"CNT"); ImGui::NextColumn(); - if (M6526_TB_INMODE_PHI2(cia->tb.cr)) { - ImGui::Text("PHI2"); + if (ImGui::BeginTable("##cia_ports", 3)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 64); + ImGui::TableSetupColumn("Port A", ImGuiTableColumnFlags_WidthFixed, 72); + ImGui::TableSetupColumn("Port B", ImGuiTableColumnFlags_WidthFixed, 72); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("DDR"); ImGui::TableNextColumn(); + ui_util_b8("", cia->pa.ddr); ImGui::TableNextColumn(); + ui_util_b8("", cia->pb.ddr); ImGui::TableNextColumn(); + ImGui::Text("Reg"); ImGui::TableNextColumn(); + ui_util_b8("", cia->pa.reg); ImGui::TableNextColumn(); + ui_util_b8("", cia->pb.reg); ImGui::TableNextColumn(); + ImGui::Text("Inp"); ImGui::TableNextColumn(); + ui_util_b8("", cia->pa.inp); ImGui::TableNextColumn(); + ui_util_b8("", cia->pb.inp); ImGui::TableNextColumn(); + ImGui::Text("Pins"); ImGui::TableNextColumn(); + ui_util_b8("", cia->pa.pins); ImGui::TableNextColumn(); + ui_util_b8("", cia->pb.pins); ImGui::TableNextColumn(); + ImGui::EndTable(); } - else if (M6526_TB_INMODE_CNT(cia->tb.cr)) { - ImGui::Text("CNT"); + if (ImGui::BeginTable("##cia_timers", 3)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 64); + ImGui::TableSetupColumn("Timer A", ImGuiTableColumnFlags_WidthFixed, 72); + ImGui::TableSetupColumn("Timer B", ImGuiTableColumnFlags_WidthFixed, 72); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("Latch"); ImGui::TableNextColumn(); + ImGui::Text("%04X", cia->ta.latch); ImGui::TableNextColumn(); + ImGui::Text("%04X", cia->tb.latch); ImGui::TableNextColumn(); + ImGui::Text("Counter"); ImGui::TableNextColumn(); + ImGui::Text("%04X", cia->ta.counter); ImGui::TableNextColumn(); + ImGui::Text("%04X", cia->tb.counter); ImGui::TableNextColumn(); + ImGui::Text("Control"); ImGui::TableNextColumn(); + ui_util_b8("", cia->ta.cr); ImGui::TableNextColumn(); + ui_util_b8("", cia->tb.cr); ImGui::TableNextColumn(); + ImGui::Text(" START"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_TIMER_STARTED(cia->ta.cr) ? "STARTED":"STOP"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_TIMER_STARTED(cia->tb.cr) ? "STARTED":"STOP"); ImGui::TableNextColumn(); + ImGui::Text(" PBON"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_PBON(cia->ta.cr) ? "PB6":"---"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_PBON(cia->tb.cr) ? "PB7":"---"); ImGui::TableNextColumn(); + ImGui::Text(" OUTMODE"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_OUTMODE_TOGGLE(cia->ta.cr) ? "TOGGLE":"PULSE"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_OUTMODE_TOGGLE(cia->tb.cr) ? "TOGGLE":"PULSE"); ImGui::TableNextColumn(); + ImGui::Text(" RUNMODE"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_RUNMODE_ONESHOT(cia->ta.cr) ? "ONESHOT":"CONT"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_RUNMODE_ONESHOT(cia->tb.cr) ? "ONESHOT":"CONT"); ImGui::TableNextColumn(); + ImGui::Text(" INMODE"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_TA_INMODE_PHI2(cia->ta.cr) ? "PHI2":"CNT"); ImGui::TableNextColumn(); + if (M6526_TB_INMODE_PHI2(cia->tb.cr)) { + ImGui::Text("PHI2"); + } else if (M6526_TB_INMODE_CNT(cia->tb.cr)) { + ImGui::Text("CNT"); + } else if (M6526_TB_INMODE_TA(cia->tb.cr)) { + ImGui::Text("TA"); + } else if (M6526_TB_INMODE_TACNT(cia->tb.cr)) { + ImGui::Text("TACNT"); + } + ImGui::TableNextColumn(); + ImGui::Text(" SPMODE"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_TA_SPMODE_OUTPUT(cia->ta.cr) ? "OUTPUT":"INPUT"); ImGui::TableNextColumn(); + ImGui::Text("---"); ImGui::TableNextColumn(); + ImGui::Text(" TODIN"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_TA_TODIN_50HZ(cia->ta.cr) ? "50HZ":"60HZ"); ImGui::TableNextColumn(); + ImGui::Text("---"); ImGui::TableNextColumn(); + ImGui::Text(" ALARM"); ImGui::TableNextColumn(); + ImGui::Text("%s", M6526_TB_ALARM_ALARM(cia->ta.cr) ? "ALARM":"CLOCK"); ImGui::TableNextColumn(); + ImGui::Text("---"); ImGui::TableNextColumn(); + ImGui::Text("Bit"); ImGui::TableNextColumn(); + ImGui::Text("%s", cia->ta.t_bit ? "ON":"OFF"); ImGui::TableNextColumn(); + ImGui::Text("%s", cia->tb.t_bit ? "ON":"OFF"); ImGui::TableNextColumn(); + ImGui::Text("Out"); ImGui::TableNextColumn(); + ImGui::Text("%s", cia->ta.t_out ? "ON":"OFF"); ImGui::TableNextColumn(); + ImGui::Text("%s", cia->tb.t_out ? "ON":"OFF"); ImGui::TableNextColumn(); + ImGui::EndTable(); } - else if (M6526_TB_INMODE_TA(cia->tb.cr)) { - ImGui::Text("TA"); + if (ImGui::BeginTable("##cia_interrupt", 2)) { + ImGui::TableSetupColumn("Interrupt", ImGuiTableColumnFlags_WidthFixed, 64); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("Mask"); ImGui::TableNextColumn(); + ui_util_b8("", cia->intr.imr); ImGui::TableNextColumn(); + ImGui::Text("Control"); ImGui::TableNextColumn(); + ui_util_b8("", cia->intr.icr); ImGui::TableNextColumn(); + ImGui::EndTable(); } - else if (M6526_TB_INMODE_TACNT(cia->tb.cr)) { - ImGui::Text("TACNT"); - } - ImGui::NextColumn(); - ImGui::Text(":SPMODE"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_TA_SPMODE_OUTPUT(cia->ta.cr) ? "OUTPUT":"INPUT"); ImGui::NextColumn(); - ImGui::Text("---"); ImGui::NextColumn(); - ImGui::Text(":TODIN"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_TA_TODIN_50HZ(cia->ta.cr) ? "50HZ":"60HZ"); ImGui::NextColumn(); - ImGui::Text("---"); ImGui::NextColumn(); - ImGui::Text(":ALARM"); ImGui::NextColumn(); - ImGui::Text("%s", M6526_TB_ALARM_ALARM(cia->ta.cr) ? "ALARM":"CLOCK"); ImGui::NextColumn(); - ImGui::Text("---"); ImGui::NextColumn(); - ImGui::Text("Bit"); ImGui::NextColumn(); - ImGui::Text("%s", cia->ta.t_bit ? "ON":"OFF"); ImGui::NextColumn(); - ImGui::Text("%s", cia->tb.t_bit ? "ON":"OFF"); ImGui::NextColumn(); - ImGui::Text("Out"); ImGui::NextColumn(); - ImGui::Text("%s", cia->ta.t_out ? "ON":"OFF"); ImGui::NextColumn(); - ImGui::Text("%s", cia->tb.t_out ? "ON":"OFF"); ImGui::NextColumn(); - - /* interrupt */ - ImGui::Columns(); - ImGui::Separator(); - ImGui::Text("Interrupt"); - ImGui::Separator(); - ui_util_b8("Mask ", cia->intr.imr); - ui_util_b8("Control ", cia->intr.icr); - } void ui_m6526_draw(ui_m6526_t* win) { diff --git a/ui/ui_m6581.h b/ui/ui_m6581.h index d6a8948..a4936b6 100644 --- a/ui/ui_m6581.h +++ b/ui/ui_m6581.h @@ -123,140 +123,138 @@ void ui_m6581_discard(ui_m6581_t* win) { static void _ui_m6581_draw_state(ui_m6581_t* win) { m6581_t* sid = win->sid; - const float cw0 = 96.0f; - const float cw = 64.0f; - ImGui::Columns(4, "##sid_channels", false); - ImGui::SetColumnWidth(0, cw0); - ImGui::SetColumnWidth(1, cw); - ImGui::SetColumnWidth(2, cw); - ImGui::SetColumnWidth(3, cw); - ImGui::Columns(); + const float cw0 = 84.0f; + const float cw = 56.0f; if (ImGui::CollapsingHeader("Wave Generator", ImGuiTreeNodeFlags_DefaultOpen)) { - ImGui::Columns(4, "##sid_channels", false); - ImGui::NextColumn(); - ImGui::Text("Chn0"); ImGui::NextColumn(); - ImGui::Text("Chn1"); ImGui::NextColumn(); - ImGui::Text("Chn2"); ImGui::NextColumn(); - ImGui::Separator(); - ImGui::Text("Muted"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", sid->voice[i].muted ? "YES":"NO"); ImGui::NextColumn(); - } - ImGui::Text("Frequency"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%04X", sid->voice[i].freq); ImGui::NextColumn(); - } - ImGui::Text("Pulse Width"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%04X", sid->voice[i].pulse_width); ImGui::NextColumn(); - } - ImGui::Text("Accum"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%06X", sid->voice[i].wav_accum); ImGui::NextColumn(); - } - ImGui::Text("Noise Shift"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%06X", sid->voice[i].noise_shift); ImGui::NextColumn(); - } - ImGui::Text("Sync"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", sid->voice[i].sync ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text("Output"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%04X", sid->voice[i].wav_output); ImGui::NextColumn(); - } - ImGui::Text("Control"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ui_util_b8("", sid->voice[i].ctrl); ImGui::NextColumn(); - } - ImGui::Text(":GATE"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_GATE) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":SYNC"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_SYNC) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":RINGMOD"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_RINGMOD) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":TEST"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_TEST) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":TRIANGLE"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_TRIANGLE) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":SAWTOOTH"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_SAWTOOTH) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":PULSE"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_PULSE) ? "ON":"OFF"); ImGui::NextColumn(); - } - ImGui::Text(":NOISE"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_NOISE) ? "ON":"OFF"); ImGui::NextColumn(); + if (ImGui::BeginTable("##sid_channels", 4)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, cw0); + ImGui::TableSetupColumn("Chn0", ImGuiTableColumnFlags_WidthFixed, cw); + ImGui::TableSetupColumn("Chn2", ImGuiTableColumnFlags_WidthFixed, cw); + ImGui::TableSetupColumn("Chn3", ImGuiTableColumnFlags_WidthFixed, cw); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("Muted"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", sid->voice[i].muted ? "YES":"NO"); ImGui::TableNextColumn(); + } + ImGui::Text("Frequency"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%04X", sid->voice[i].freq); ImGui::TableNextColumn(); + } + ImGui::Text("Pulse Width"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%04X", sid->voice[i].pulse_width); ImGui::TableNextColumn(); + } + ImGui::Text("Accum"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%06X", sid->voice[i].wav_accum); ImGui::TableNextColumn(); + } + ImGui::Text("Noise Shift"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%06X", sid->voice[i].noise_shift); ImGui::TableNextColumn(); + } + ImGui::Text("Sync"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", sid->voice[i].sync ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text("Output"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%04X", sid->voice[i].wav_output); ImGui::TableNextColumn(); + } + ImGui::Text("Control"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ui_util_b8("", sid->voice[i].ctrl); ImGui::TableNextColumn(); + } + ImGui::Text(" GATE"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_GATE) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" SYNC"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_SYNC) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" RINGMOD"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_RINGMOD) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" TEST"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_TEST) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" TRIANGLE"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_TRIANGLE) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" SAWTOOTH"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_SAWTOOTH) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" PULSE"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_PULSE) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::Text(" NOISE"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%s", (sid->voice[i].ctrl & M6581_CTRL_NOISE) ? "ON":"OFF"); ImGui::TableNextColumn(); + } + ImGui::EndTable(); } } - ImGui::Columns(); if (ImGui::CollapsingHeader("Envelope Generator")) { - ImGui::Columns(4, "##sid_channels", false); - ImGui::NextColumn(); - ImGui::Text("Chn0"); ImGui::NextColumn(); - ImGui::Text("Chn1"); ImGui::NextColumn(); - ImGui::Text("Chn2"); ImGui::NextColumn(); - ImGui::Separator(); - ImGui::Text("State"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - const char* state; - switch (sid->voice[i].env_state) { - case M6581_ENV_FROZEN: state = "frozen"; break; - case M6581_ENV_ATTACK: state = "attack"; break; - case M6581_ENV_DECAY: state = "decay"; break; - case M6581_ENV_RELEASE: state = "release"; break; - default: state = "???"; break; + if (ImGui::BeginTable("##sid_env", 4)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, cw0); + ImGui::TableSetupColumn("Chn0", ImGuiTableColumnFlags_WidthFixed, cw); + ImGui::TableSetupColumn("Chn2", ImGuiTableColumnFlags_WidthFixed, cw); + ImGui::TableSetupColumn("Chn3", ImGuiTableColumnFlags_WidthFixed, cw); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("State"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + const char* state; + switch (sid->voice[i].env_state) { + case M6581_ENV_FROZEN: state = "frozen"; break; + case M6581_ENV_ATTACK: state = "attack"; break; + case M6581_ENV_DECAY: state = "decay"; break; + case M6581_ENV_RELEASE: state = "release"; break; + default: state = "???"; break; + } + ImGui::Text("%s", state); ImGui::TableNextColumn(); } - ImGui::Text("%s", state); ImGui::NextColumn(); - } - ImGui::Text("Attack"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%X", sid->voice[i].env_attack_add); ImGui::NextColumn(); - } - ImGui::Text("Decay"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%X", sid->voice[i].env_decay_sub); ImGui::NextColumn(); - } - ImGui::Text("Sustain"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%04X", sid->voice[i].env_sustain_level); ImGui::NextColumn(); - } - ImGui::Text("Release"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%X", sid->voice[i].env_release_sub); ImGui::NextColumn(); - } - ImGui::Text("Cur Level"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%02X", sid->voice[i].env_cur_level); ImGui::NextColumn(); - } - ImGui::Text("Counter"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%04X", sid->voice[i].env_counter); ImGui::NextColumn(); - } - ImGui::Text("Exp Counter"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%02X", sid->voice[i].env_exp_counter); ImGui::NextColumn(); - } - ImGui::Text("Counter Cmp"); ImGui::NextColumn(); - for (int i = 0; i < 3; i++) { - ImGui::Text("%X", sid->voice[i].env_counter_compare); ImGui::NextColumn(); + ImGui::Text("Attack"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%X", sid->voice[i].env_attack_add); ImGui::TableNextColumn(); + } + ImGui::Text("Decay"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%X", sid->voice[i].env_decay_sub); ImGui::TableNextColumn(); + } + ImGui::Text("Sustain"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%04X", sid->voice[i].env_sustain_level); ImGui::TableNextColumn(); + } + ImGui::Text("Release"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%X", sid->voice[i].env_release_sub); ImGui::TableNextColumn(); + } + ImGui::Text("Cur Level"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%02X", sid->voice[i].env_cur_level); ImGui::TableNextColumn(); + } + ImGui::Text("Counter"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%04X", sid->voice[i].env_counter); ImGui::TableNextColumn(); + } + ImGui::Text("Exp Counter"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%02X", sid->voice[i].env_exp_counter); ImGui::TableNextColumn(); + } + ImGui::Text("Counter Cmp"); ImGui::TableNextColumn(); + for (int i = 0; i < 3; i++) { + ImGui::Text("%X", sid->voice[i].env_counter_compare); ImGui::TableNextColumn(); + } + ImGui::EndTable(); } } - ImGui::Columns(); if (ImGui::CollapsingHeader("Filter")) { ImGui::Text("Voices %s %s %s", (0 != (sid->filter.voices & 1)) ? "ON ":"OFF", @@ -266,10 +264,10 @@ static void _ui_m6581_draw_state(ui_m6581_t* win) { ImGui::Text("Resonance %X", sid->filter.resonance); ImGui::Text("Volume %X", sid->filter.volume); ImGui::Text("Mode %X", sid->filter.mode); - ImGui::Text(" :LOWPASS %s", (0 != (sid->filter.mode & M6581_FILTER_LP)) ? "ON":"OFF"); - ImGui::Text(" :BANDPASS %s", (0 != (sid->filter.mode & M6581_FILTER_BP)) ? "ON":"OFF"); - ImGui::Text(" :HIGHPASS %s", (0 != (sid->filter.mode & M6581_FILTER_HP)) ? "ON":"OFF"); - ImGui::Text(" :3OFF %s", (0 != (sid->filter.mode & M6581_FILTER_3OFF)) ? "ON":"OFF"); + ImGui::Text(" LOWPASS %s", (0 != (sid->filter.mode & M6581_FILTER_LP)) ? "ON":"OFF"); + ImGui::Text(" BANDPASS %s", (0 != (sid->filter.mode & M6581_FILTER_BP)) ? "ON":"OFF"); + ImGui::Text(" HIGHPASS %s", (0 != (sid->filter.mode & M6581_FILTER_HP)) ? "ON":"OFF"); + ImGui::Text(" 3OFF %s", (0 != (sid->filter.mode & M6581_FILTER_3OFF)) ? "ON":"OFF"); ImGui::Text("w0 %X", sid->filter.w0); ImGui::Text("v_lp %X", sid->filter.v_lp); ImGui::Text("v_bp %X", sid->filter.v_bp); diff --git a/ui/ui_mc6845.h b/ui/ui_mc6845.h index 6e9a048..c2c6c62 100644 --- a/ui/ui_mc6845.h +++ b/ui/ui_mc6845.h @@ -131,30 +131,31 @@ static void _ui_mc6845_draw_state(ui_mc6845_t* win) { case MC6845_TYPE_MC6845: ImGui::Text("Type: MC6845"); break; default: ImGui::Text("Type: ???"); break; } - ImGui::Separator(); - ImGui::Columns(2, "##regs", false); - ImGui::SetColumnWidth(0, 124); - ImGui::SetColumnWidth(1, 124); - mc->h_total = ui_util_input_u8("R0 HTotal", mc->h_total); ImGui::NextColumn(); - mc->h_displayed = ui_util_input_u8("R1 HDisp", mc->h_displayed); ImGui::NextColumn(); - mc->h_sync_pos = ui_util_input_u8("R2 HSyncPos", mc->h_sync_pos); ImGui::NextColumn(); - mc->sync_widths = ui_util_input_u8("R3 SyncWidth", mc->sync_widths); ImGui::NextColumn(); - mc->v_total = ui_util_input_u8("R4 VTotal", mc->v_total); ImGui::NextColumn(); - mc->v_total_adjust = ui_util_input_u8("R5 VTotalAdj", mc->v_total_adjust); ImGui::NextColumn(); - mc->v_displayed = ui_util_input_u8("R6 VDisp", mc->v_displayed); ImGui::NextColumn(); - mc->v_sync_pos = ui_util_input_u8("R7 VSyncPos", mc->v_sync_pos); ImGui::NextColumn(); - mc->interlace_mode = ui_util_input_u8("R8 Interl", mc->interlace_mode); ImGui::NextColumn(); - mc->max_scanline_addr = ui_util_input_u8("R9 MaxScanl", mc->max_scanline_addr); ImGui::NextColumn(); - mc->cursor_start = ui_util_input_u8("R10 CursStart", mc->cursor_start); ImGui::NextColumn(); - mc->cursor_end = ui_util_input_u8("R11 CursEnd", mc->cursor_end); ImGui::NextColumn(); - mc->start_addr_hi = ui_util_input_u8("R12 AddrHi", mc->start_addr_hi); ImGui::NextColumn(); - mc->start_addr_lo = ui_util_input_u8("R13 AddrLo", mc->start_addr_lo); ImGui::NextColumn(); - mc->cursor_hi = ui_util_input_u8("R14 CursHi", mc->cursor_hi); ImGui::NextColumn(); - mc->cursor_lo = ui_util_input_u8("R15 CursLo", mc->cursor_lo); ImGui::NextColumn(); - mc->lightpen_hi = ui_util_input_u8("R16 LPenHi", mc->lightpen_hi); ImGui::NextColumn(); - mc->lightpen_lo = ui_util_input_u8("R17 LPenLo", mc->lightpen_lo); ImGui::NextColumn(); - ImGui::Columns(); + if (ImGui::BeginTable("##regs", 2)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 124); + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 124); + ImGui::TableNextColumn(); + mc->h_total = ui_util_input_u8("R0 HTotal", mc->h_total); ImGui::TableNextColumn(); + mc->h_displayed = ui_util_input_u8("R1 HDisp", mc->h_displayed); ImGui::TableNextColumn(); + mc->h_sync_pos = ui_util_input_u8("R2 HSyncPos", mc->h_sync_pos); ImGui::TableNextColumn(); + mc->sync_widths = ui_util_input_u8("R3 SyncWidth", mc->sync_widths); ImGui::TableNextColumn(); + mc->v_total = ui_util_input_u8("R4 VTotal", mc->v_total); ImGui::TableNextColumn(); + mc->v_total_adjust = ui_util_input_u8("R5 VTotalAdj", mc->v_total_adjust); ImGui::TableNextColumn(); + mc->v_displayed = ui_util_input_u8("R6 VDisp", mc->v_displayed); ImGui::TableNextColumn(); + mc->v_sync_pos = ui_util_input_u8("R7 VSyncPos", mc->v_sync_pos); ImGui::TableNextColumn(); + mc->interlace_mode = ui_util_input_u8("R8 Interl", mc->interlace_mode); ImGui::TableNextColumn(); + mc->max_scanline_addr = ui_util_input_u8("R9 MaxScanl", mc->max_scanline_addr); ImGui::TableNextColumn(); + mc->cursor_start = ui_util_input_u8("R10 CursStart", mc->cursor_start); ImGui::TableNextColumn(); + mc->cursor_end = ui_util_input_u8("R11 CursEnd", mc->cursor_end); ImGui::TableNextColumn(); + mc->start_addr_hi = ui_util_input_u8("R12 AddrHi", mc->start_addr_hi); ImGui::TableNextColumn(); + mc->start_addr_lo = ui_util_input_u8("R13 AddrLo", mc->start_addr_lo); ImGui::TableNextColumn(); + mc->cursor_hi = ui_util_input_u8("R14 CursHi", mc->cursor_hi); ImGui::TableNextColumn(); + mc->cursor_lo = ui_util_input_u8("R15 CursLo", mc->cursor_lo); ImGui::TableNextColumn(); + mc->lightpen_hi = ui_util_input_u8("R16 LPenHi", mc->lightpen_hi); ImGui::TableNextColumn(); + mc->lightpen_lo = ui_util_input_u8("R17 LPenLo", mc->lightpen_lo); ImGui::TableNextColumn(); + ImGui::EndTable(); + } ImGui::Separator(); ImGui::Text("Memory Addr: %04X Row Start: %04X", mc->ma, mc->ma_row_start); ImGui::Text("Row Ctr: %02X Scanline Ctr: %02X", mc->v_ctr, mc->r_ctr); diff --git a/ui/ui_z80ctc.h b/ui/ui_z80ctc.h index 532ecbd..432af4c 100644 --- a/ui/ui_z80ctc.h +++ b/ui/ui_z80ctc.h @@ -147,35 +147,35 @@ static void _ui_z80ctc_channels(ui_z80ctc_t* win) { for (int i = 0; i < 4; i++) { ImGui::Text("%02X", ctc->chn[i].control); ImGui::TableNextColumn(); } - ImGui::Text("INT"); ImGui::TableNextColumn(); + ImGui::Text(" INT"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_EI) ? "EI":"DI"); ImGui::TableNextColumn(); } - ImGui::Text("MODE"); ImGui::TableNextColumn(); + ImGui::Text(" MODE"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_MODE) ? "CTR":"TMR"); ImGui::TableNextColumn(); } - ImGui::Text("PRESCALE"); ImGui::TableNextColumn(); + ImGui::Text(" PRESCALE"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_PRESCALER) ? "256":"16"); ImGui::TableNextColumn(); } - ImGui::Text("EDGE"); ImGui::TableNextColumn(); + ImGui::Text(" EDGE"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_EDGE) ? "RISE":"FALL"); ImGui::TableNextColumn(); } - ImGui::Text("TRIGGER"); ImGui::TableNextColumn(); + ImGui::Text(" TRIGGER"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_TRIGGER) ? "PULS":"AUTO"); ImGui::TableNextColumn(); } - ImGui::Text("CONSTANT"); ImGui::TableNextColumn(); + ImGui::Text(" CONSTANT"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_CONST_FOLLOWS) ? "FLWS":"NONE"); ImGui::TableNextColumn(); } - ImGui::Text("RESET"); ImGui::TableNextColumn(); + ImGui::Text(" RESET"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_RESET) ? "ON":"OFF"); ImGui::TableNextColumn(); } - ImGui::Text("CONTROL"); ImGui::TableNextColumn(); + ImGui::Text(" CONTROL"); ImGui::TableNextColumn(); for (int i = 0; i < 4; i++) { ImGui::Text("%s", (ctc->chn[i].control & Z80CTC_CTRL_CONTROL) ? "WRD":"VEC"); ImGui::TableNextColumn(); } diff --git a/ui/ui_z80pio.h b/ui/ui_z80pio.h index 8e0777f..5e19aa7 100644 --- a/ui/ui_z80pio.h +++ b/ui/ui_z80pio.h @@ -133,55 +133,53 @@ static const char* _ui_z80pio_mode_str(uint8_t mode) { static void _ui_z80pio_ports(ui_z80pio_t* win) { const z80pio_t* pio = win->pio; - - ImGui::Columns(3, "##pio_columns", false); - ImGui::SetColumnWidth(0, 80); - ImGui::SetColumnWidth(1, 40); - ImGui::SetColumnWidth(2, 40); - ImGui::NextColumn(); - ImGui::Text("PA"); ImGui::NextColumn(); - ImGui::Text("PB"); ImGui::NextColumn(); - ImGui::Separator(); - - ImGui::Text("Mode"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%s", _ui_z80pio_mode_str(pio->port[i].mode)); ImGui::NextColumn(); - } - ImGui::Text("Output"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%02X", pio->port[i].output); ImGui::NextColumn(); - } - ImGui::Text("Input"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%02X", pio->port[i].input); ImGui::NextColumn(); - } - ImGui::Text("IO Select"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%02X", pio->port[i].io_select); ImGui::NextColumn(); - } - ImGui::Text("INT Ctrl"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%02X", pio->port[i].int_control); ImGui::NextColumn(); - } - ImGui::Text(" ei/di"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%s", pio->port[i].int_control & Z80PIO_INTCTRL_EI ? "EI":"DI"); ImGui::NextColumn(); - } - ImGui::Text(" and/or"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%s", pio->port[i].int_control & Z80PIO_INTCTRL_ANDOR ? "AND":"OR"); ImGui::NextColumn(); - } - ImGui::Text(" hi/lo"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%s", pio->port[i].int_control & Z80PIO_INTCTRL_HILO ? "HI":"LO"); ImGui::NextColumn(); - } - ImGui::Text("INT Vec"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%02X", pio->port[i].int_vector); ImGui::NextColumn(); - } - ImGui::Text("INT Mask"); ImGui::NextColumn(); - for (int i = 0; i < 2; i++) { - ImGui::Text("%02X", pio->port[i].int_mask); ImGui::NextColumn(); + if (ImGui::BeginTable("##pio_columns", 3)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 64); + ImGui::TableSetupColumn("PA", ImGuiTableColumnFlags_WidthFixed, 32); + ImGui::TableSetupColumn("PB", ImGuiTableColumnFlags_WidthFixed, 32); + ImGui::TableHeadersRow(); + ImGui::TableNextColumn(); + ImGui::Text("Mode"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%s", _ui_z80pio_mode_str(pio->port[i].mode)); ImGui::TableNextColumn(); + } + ImGui::Text("Output"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%02X", pio->port[i].output); ImGui::TableNextColumn(); + } + ImGui::Text("Input"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%02X", pio->port[i].input); ImGui::TableNextColumn(); + } + ImGui::Text("IO Select"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%02X", pio->port[i].io_select); ImGui::TableNextColumn(); + } + ImGui::Text("INT Ctrl"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%02X", pio->port[i].int_control); ImGui::TableNextColumn(); + } + ImGui::Text(" ei/di"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%s", pio->port[i].int_control & Z80PIO_INTCTRL_EI ? "EI":"DI"); ImGui::TableNextColumn(); + } + ImGui::Text(" and/or"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%s", pio->port[i].int_control & Z80PIO_INTCTRL_ANDOR ? "AND":"OR"); ImGui::TableNextColumn(); + } + ImGui::Text(" hi/lo"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%s", pio->port[i].int_control & Z80PIO_INTCTRL_HILO ? "HI":"LO"); ImGui::TableNextColumn(); + } + ImGui::Text("INT Vec"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%02X", pio->port[i].int_vector); ImGui::TableNextColumn(); + } + ImGui::Text("INT Mask"); ImGui::TableNextColumn(); + for (int i = 0; i < 2; i++) { + ImGui::Text("%02X", pio->port[i].int_mask); ImGui::TableNextColumn(); + } + ImGui::EndTable(); } }