Exemple #1
0
        private void MakeTrace(long _cycleCount)
        {
            int[] regs = new int[12];
            LibEmu83.TI83_GetRegs(Context, regs);
            ushort PC = (ushort)regs[10];

            string disasm    = Z80A.Disassemble(PC, addr => LibEmu83.TI83_ReadMemory(Context, addr), out int bytes_read);
            string byte_code = null;

            for (ushort i = 0; i < bytes_read; i++)
            {
                byte_code += $"{LibEmu83.TI83_ReadMemory(Context, (ushort)(PC + i)):X2}";
                if (i < (bytes_read - 1))
                {
                    byte_code += " ";
                }
            }

            Tracer.Put(new(
                           disassembly:
                           $"{PC:X4}: {byte_code,-12} {disasm,-26}",
                           registerInfo:
                           $"AF:{regs[0]:X4} BC:{regs[1]:X4} DE:{regs[2]:X4} HL:{regs[3]:X4} IX:{regs[8]:X4} IY:{regs[9]:X4} SP:{regs[11]:X4} Cy:{_cycleCount}"
                           ));
        }
 public IDictionary <string, RegisterValue> GetCpuFlagsAndRegisters()
 {
     int[] regs = new int[12];
     LibEmu83.TI83_GetRegs(Context, regs);
     return(new Dictionary <string, RegisterValue>
     {
         ["AF"] = (ushort)regs[0],
         ["BC"] = (ushort)regs[1],
         ["DE"] = (ushort)regs[2],
         ["HL"] = (ushort)regs[3],
         ["AF'"] = (ushort)regs[4],
         ["BC'"] = (ushort)regs[5],
         ["DE'"] = (ushort)regs[6],
         ["HL'"] = (ushort)regs[7],
         ["IX"] = (ushort)regs[8],
         ["IY"] = (ushort)regs[9],
         ["PC"] = (ushort)regs[10],
         ["SP"] = (ushort)regs[11],
     });
 }