// File: NGageMegaman[P]NEScutre/src/cpu.cpp
// Function: Cpu::debug_dump(unsigned char)
void Cpu::debug_dump(uint8_t inst) {
    cout << "INSTRUCCION" << std::hex << (int) inst << endl;
    cout << "regA =  " << std::hex << (unsigned) regA << endl;
    cout << "regX =  " << std::hex << (unsigned) regX << endl;
    cout << "regY =  " << std::hex << (unsigned) regY << endl;
    cout << "regPC = " << std::hex << (unsigned) regPC << endl;
    cout << "regSP = " << std::hex << (unsigned) regSP << endl;
    cout << "regP =" << endl;
    cout << "    C = " << regP.C;
    cout << "    Z = " << regP.Z;
    cout << "    I = " << regP.I;
    cout << "    D = " << regP.D;
    cout << "    B = " << regP.B;
    cout << "    V = " << regP.V;
    cout << "    N = " << regP.N << endl;
    cout << "cycles = " << clock->cycles << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x5b77(%rip), %rdi      # 0x9fd8
leaq 0x3054(%rip), %rsi      # 0x74bc
callq 0x1100
movq %rax, %rdi
leaq 0x309(%rip), %rsi       # 0x4780
callq 0x1070
movq %rax, %rdi
movzbl -0x9(%rbp), %esi
callq 0x11b0
movq %rax, %rdi
movq 0x5b36(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x5b3a(%rip), %rdi      # 0x9fd8
leaq 0x3023(%rip), %rsi      # 0x74c8
callq 0x1100
movq %rax, %rdi
leaq 0x2cc(%rip), %rsi       # 0x4780
callq 0x1070
movq %rax, %rdi
movq -0x18(%rbp), %rax
movzbl 0x10020(%rax), %esi
callq 0x1170
movq %rax, %rdi
movq 0x5af2(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x5af6(%rip), %rdi      # 0x9fd8
leaq 0x2fe8(%rip), %rsi      # 0x74d1
callq 0x1100
movq %rax, %rdi
leaq 0x288(%rip), %rsi       # 0x4780
callq 0x1070
movq %rax, %rdi
movq -0x18(%rbp), %rax
movzbl 0x10021(%rax), %esi
callq 0x1170
movq %rax, %rdi
movq 0x5aae(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x5ab2(%rip), %rdi      # 0x9fd8
leaq 0x2fad(%rip), %rsi      # 0x74da
callq 0x1100
movq %rax, %rdi
leaq 0x244(%rip), %rsi       # 0x4780
callq 0x1070
movq %rax, %rdi
movq -0x18(%rbp), %rax
movzbl 0x10022(%rax), %esi
callq 0x1170
movq %rax, %rdi
movq 0x5a6a(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x5a6e(%rip), %rdi      # 0x9fd8
leaq 0x2f72(%rip), %rsi      # 0x74e3
callq 0x1100
movq %rax, %rdi
leaq 0x200(%rip), %rsi       # 0x4780
callq 0x1070
movq %rax, %rdi
movq -0x18(%rbp), %rax
movzwl 0x10024(%rax), %esi
callq 0x1170
movq %rax, %rdi
movq 0x5a26(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x5a2a(%rip), %rdi      # 0x9fd8
leaq 0x2f37(%rip), %rsi      # 0x74ec
callq 0x1100
movq %rax, %rdi
leaq 0x1bc(%rip), %rsi       # 0x4780
callq 0x1070
movq %rax, %rdi
movq -0x18(%rbp), %rax
movzwl 0x10026(%rax), %esi
callq 0x1170
movq %rax, %rdi
movq 0x59e2(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x59e6(%rip), %rdi      # 0x9fd8
leaq 0x2efc(%rip), %rsi      # 0x74f5
callq 0x1100
movq %rax, %rdi
movq 0x59c0(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x59c4(%rip), %rdi      # 0x9fd8
leaq 0x2ee1(%rip), %rsi      # 0x74fc
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x10028(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq 0x599a(%rip), %rdi      # 0x9fd8
leaq 0x2ec0(%rip), %rsi      # 0x7505
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x10029(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq 0x5970(%rip), %rdi      # 0x9fd8
leaq 0x2e9f(%rip), %rsi      # 0x750e
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x1002a(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq 0x5946(%rip), %rdi      # 0x9fd8
leaq 0x2e7e(%rip), %rsi      # 0x7517
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x1002b(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq 0x591c(%rip), %rdi      # 0x9fd8
leaq 0x2e5d(%rip), %rsi      # 0x7520
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x1002c(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq 0x58f2(%rip), %rdi      # 0x9fd8
leaq 0x2e3c(%rip), %rsi      # 0x7529
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x1002d(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq 0x58c8(%rip), %rdi      # 0x9fd8
leaq 0x2e1b(%rip), %rsi      # 0x7532
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movb 0x1002e(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x11d0
movq %rax, %rdi
movq 0x588b(%rip), %rsi      # 0x9fc8
callq 0x1110
movq 0x588f(%rip), %rdi      # 0x9fd8
leaq 0x2deb(%rip), %rsi      # 0x753b
callq 0x1100
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl (%rax), %esi
callq 0x1170
movq %rax, %rdi
movq 0x5858(%rip), %rsi      # 0x9fc8
callq 0x1110
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)