public string[] Disassemble(ushort address, int count, bool extendedFormat = true)
{
string[] s = new string[count];
ushort word;
for (int i = 0; i < count; i += 1) {
word = DebugReadMemory(address, SegmentIndex.CS);
ushort nextword = DebugReadMemory((ushort)(address + 2), SegmentIndex.CS);
ushort instructionSize = 2;
YCPUInstruction opcode = m_Opcodes[word & 0x00FF];
if (extendedFormat) {
s[i] =
$"{address:X4}:{word:X4} {(opcode.Disassembler != null ? opcode.Disassembler(opcode.Name, word, nextword, address, true, out instructionSize) : opcode.Name)}";
}
else {
s[i] = opcode.Disassembler != null ?
opcode.Disassembler(opcode.Name, word, nextword, address, false, out instructionSize).ToLowerInvariant() :
opcode.Name;
}
address += instructionSize;
}
return s;
}