private void LogInstructionToDebugger(S8Instruction instr) { if (VerboseMode) { var regs = GetChangedRegs(); if (!string.IsNullOrEmpty(regs)) { LogMessage(regs); } instr.DecodeInstruction(); LogMessage(instr.Instruction2Text(state.pc, true)); prevRegs = (byte[])state.regs.Clone(); } }
public UInt16 Dissasemble(UInt16 start, UInt16 length, bool showAddress = false, bool allowOutsideLoadedMemory = false) { S8Instruction s8i; UInt16 currentAddress = start; UInt16 endAddress = (UInt16)(currentAddress + length); // Special - if no length givien, assume 20 instructions if (length == 0) { endAddress = (UInt16)(currentAddress + 20); //endAddress = cpu.state.memoryUsed; } if (!allowOutsideLoadedMemory) { if (endAddress > cpu.state.memoryUsed) { endAddress = cpu.state.memoryUsed; } } // Dont read outside physical memory if (endAddress > bytes.Length) { endAddress = (UInt16)(bytes.Length - 1); } while (currentAddress < endAddress) { int lineAddress = currentAddress; byte opcode = bytes[currentAddress++]; byte param = bytes[currentAddress++]; s8i = new S8Instruction(opcode, param); s8i.DecodeInstruction(); LogMessage(s8i.Instruction2Text(lineAddress, showAddress)); } return(currentAddress); }