Minor adjustments and style fixes to the new APU debug functions

This commit is contained in:
Lior Halphon 2019-05-17 20:48:49 +03:00
parent 8d9149b020
commit 6648a0a84d

View File

@ -1600,7 +1600,8 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
GB_log(gb, " CH%u", channel + 1); GB_log(gb, " CH%u", channel + 1);
} }
} }
} else { }
else {
GB_log(gb, " no channels"); GB_log(gb, " no channels");
} }
GB_log(gb, "%s\n", gb->io_registers[GB_IO_NR50] & 0x80 ? " VIN": ""); GB_log(gb, "%s\n", gb->io_registers[GB_IO_NR50] & 0x80 ? " VIN": "");
@ -1612,7 +1613,8 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
GB_log(gb, " CH%u", channel + 1); GB_log(gb, " CH%u", channel + 1);
} }
} }
} else { }
else {
GB_log(gb, " no channels"); GB_log(gb, " no channels");
} }
GB_log(gb, "%s\n", gb->io_registers[GB_IO_NR50] & 0x80 ? " VIN": ""); GB_log(gb, "%s\n", gb->io_registers[GB_IO_NR50] & 0x80 ? " VIN": "");
@ -1657,10 +1659,10 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
for (uint8_t i = 0; i < 32; i++) { for (uint8_t i = 0; i < 32; i++) {
GB_log(gb, "%s%X", i%4?"":" ", gb->apu.wave_channel.wave_form[i]); GB_log(gb, "%s%X", i%4?"":" ", gb->apu.wave_channel.wave_form[i]);
} }
GB_log(gb, ", has %sjust been read\n", gb->apu.wave_channel.wave_form_just_read? "": "not "); GB_log(gb, "\n");
GB_log(gb, " Current position: %u\n", gb->apu.wave_channel.current_sample_index); GB_log(gb, " Current position: %u\n", gb->apu.wave_channel.current_sample_index);
GB_log(gb, " Volume %s (right-shifted %ux)\n", GB_log(gb, " Volume %s (right-shifted %u times)\n",
(char*[]){"100%", "50%", "25%", NULL, "muted"}[gb->apu.wave_channel.shift], (char*[]){"100%", "50%", "25%", NULL, "muted"}[gb->apu.wave_channel.shift],
gb->apu.wave_channel.shift); gb->apu.wave_channel.shift);
@ -1685,7 +1687,7 @@ static bool apu(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugg
gb->io_registers[GB_IO_NR42] & 8 ? "in" : "de", gb->io_registers[GB_IO_NR42] & 8 ? "in" : "de",
gb->io_registers[GB_IO_NR42] & 7); gb->io_registers[GB_IO_NR42] & 7);
GB_log(gb, " LFSR in %u-step mode, current value %%", GB_log(gb, " LFSR in %u-step mode, current value ",
gb->apu.noise_channel.narrow? 7 : 15); gb->apu.noise_channel.narrow? 7 : 15);
for (uint16_t lfsr = gb->apu.noise_channel.lfsr, i = 15; i--; lfsr <<= 1) { for (uint16_t lfsr = gb->apu.noise_channel.lfsr, i = 15; i--; lfsr <<= 1) {
GB_log(gb, "%u%s", (lfsr >> 14) & 1, i%4 ? "" : " "); GB_log(gb, "%u%s", (lfsr >> 14) & 1, i%4 ? "" : " ");
@ -1726,7 +1728,8 @@ static bool wave(GB_gameboy_t *gb, char *arguments, char *modifiers, const debug
for (uint8_t i = 0; i < 32; i++) { for (uint8_t i = 0; i < 32; i++) {
if ((gb->apu.wave_channel.wave_form[i] & mask) == cur_val) { if ((gb->apu.wave_channel.wave_form[i] & mask) == cur_val) {
GB_log(gb, "%X", gb->apu.wave_channel.wave_form[i]); GB_log(gb, "%X", gb->apu.wave_channel.wave_form[i]);
} else { }
else {
GB_log(gb, "%c", i%4 == 2 ? '-' : ' '); GB_log(gb, "%c", i%4 == 2 ? '-' : ' ');
} }
} }