public static byte[] DisassembleGetOpcodeBytes(SM83 cpu, ushort address) { var opcode = new byte[3]; for (int i = 0; i < opcode.Length; i++) { opcode[i] = address + i <= 0xFFFF ? cpu.memoryReadDelegate((ushort)(address + i)) : (byte)0; } return(opcode); }
public static string PrintInterrupt(SM83 cpu) { var intFlags = (InterruptSource)cpu.memoryReadDelegate(0xFF0F); var intEnable = (InterruptSource)cpu.memoryReadDelegate(0xFFFF); var intFlagsString = $"{((intFlags & InterruptSource.VBlank) != 0 ? "V" : "-")}" + $"{((intFlags & InterruptSource.LCDCStatus) != 0 ? "L" : "-")}" + $"{((intFlags & InterruptSource.TimerOverflow) != 0 ? "T" : "-")}" + $"{((intFlags & InterruptSource.SerialIO) != 0 ? "S" : "-")}" + $"{((intFlags & InterruptSource.Keypad) != 0 ? "K" : "-")}"; var intEnableString = $"{((intEnable & InterruptSource.VBlank) != 0 ? "V" : "-")}" + $"{((intEnable & InterruptSource.LCDCStatus) != 0 ? "L" : "-")}" + $"{((intEnable & InterruptSource.TimerOverflow) != 0 ? "T" : "-")}" + $"{((intEnable & InterruptSource.SerialIO) != 0 ? "S" : "-")}" + $"{((intEnable & InterruptSource.Keypad) != 0 ? "K" : "-")}"; return($"IME:{(cpu.ime ? "1" : "0")} IF:{intFlagsString} IE:{intEnableString}"); }