// File: RegulusImpact[P]sadboy/src/CPU.cpp
// Function: CPU::CheckRegisters()
void CPU::CheckRegisters() {
    if(Get(REGISTERS::A) != 0x01) { std::cout << "Failed on register a" << std::endl; exit(1); }
    if(Get(REGISTERS::B) != 0x00) { std::cout << "Failed on register b" << std::endl; exit(1); }
    if(Get(REGISTERS::C) != 0x13) { std::cout << "Failed on register c" << std::endl; exit(1); }
    if(Get(REGISTERS::D) != 0x00) { std::cout << "Failed on register d" << std::endl; exit(1); }
    if(Get(REGISTERS::E) != 0xD8) { std::cout << "Failed on register e" << std::endl; exit(1); }
    if(Get(REGISTERS::H) != 0x01) { std::cout << "Failed on register h" << std::endl; exit(1); }
    if(Get(REGISTERS::L) != 0x4D) { std::cout << "Failed on register l" << std::endl; exit(1); }
    if(stackPointer != 0xFFFE) { std::cout << "Failed on registers sp" << std::endl; exit(1); }
    if(programCounter != 0x0100) { std::cout << "Failed on registers pc" << std::endl; exit(1); }

    if (GetZ() != 0x1) { std::cout << "Failed on flag Z" << std::endl; exit(1); }
    if (GetN() != 0x0) { std::cout << "Failed on flag N" << std::endl; exit(1); }
    if (GetH() != 0x1) { std::cout << "Failed on flag H" << std::endl; exit(1); }
    if (GetCY() != 0x1) { std::cout << "Failed on flag CY" << std::endl; exit(1); }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movl $0x7, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0x1, %eax
je 0x32be2
movq 0x19403(%rip), %rdi     # 0x4bfc0
leaq 0x6b72(%rip), %rsi      # 0x39736
callq 0x5460
movq %rax, %rdi
movq 0x193d5(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x32c21
movq 0x193c4(%rip), %rdi     # 0x4bfc0
leaq 0x6b48(%rip), %rsi      # 0x3974b
callq 0x5460
movq %rax, %rdi
movq 0x19396(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0x13, %eax
je 0x32c63
movq 0x19382(%rip), %rdi     # 0x4bfc0
leaq 0x6b1b(%rip), %rsi      # 0x39760
callq 0x5460
movq %rax, %rdi
movq 0x19354(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x32ca5
movq 0x19340(%rip), %rdi     # 0x4bfc0
leaq 0x6aee(%rip), %rsi      # 0x39775
callq 0x5460
movq %rax, %rdi
movq 0x19312(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0xd8, %eax
je 0x32ce9
movq 0x192fc(%rip), %rdi     # 0x4bfc0
leaq 0x6abf(%rip), %rsi      # 0x3978a
callq 0x5460
movq %rax, %rdi
movq 0x192ce(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0x1, %eax
je 0x32d2b
movq 0x192ba(%rip), %rdi     # 0x4bfc0
leaq 0x6a92(%rip), %rsi      # 0x3979f
callq 0x5460
movq %rax, %rdi
movq 0x1928c(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x2de40
movzwl %ax, %eax
cmpl $0x4d, %eax
je 0x32d6d
movq 0x19278(%rip), %rdi     # 0x4bfc0
leaq 0x6a65(%rip), %rsi      # 0x397b4
callq 0x5460
movq %rax, %rdi
movq 0x1924a(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rax
movzwl 0x1a(%rax), %eax
cmpl $0xfffe, %eax           # imm = 0xFFFE
je 0x32da8
movq 0x1923d(%rip), %rdi     # 0x4bfc0
leaq 0x6a3f(%rip), %rsi      # 0x397c9
callq 0x5460
movq %rax, %rdi
movq 0x1920f(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rax
movzwl 0x18(%rax), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x32de3
movq 0x19202(%rip), %rdi     # 0x4bfc0
leaq 0x6a1b(%rip), %rsi      # 0x397e0
callq 0x5460
movq %rax, %rdi
movq 0x191d4(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
callq 0x2e170
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
je 0x32e22
movq 0x191c3(%rip), %rdi     # 0x4bfc0
leaq 0x69f3(%rip), %rsi      # 0x397f7
callq 0x5460
movq %rax, %rdi
movq 0x19195(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
callq 0x2e190
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x32e61
movq 0x19184(%rip), %rdi     # 0x4bfc0
leaq 0x69c5(%rip), %rsi      # 0x39808
callq 0x5460
movq %rax, %rdi
movq 0x19156(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
callq 0x2e1d0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
je 0x32ea0
movq 0x19145(%rip), %rdi     # 0x4bfc0
leaq 0x6997(%rip), %rsi      # 0x39819
callq 0x5460
movq %rax, %rdi
movq 0x19117(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
movq -0x10(%rbp), %rdi
callq 0x2e1b0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
je 0x32edf
movq 0x19106(%rip), %rdi     # 0x4bfc0
leaq 0x6969(%rip), %rsi      # 0x3982a
callq 0x5460
movq %rax, %rdi
movq 0x190d8(%rip), %rsi     # 0x4bfa8
callq 0x54d0
movl $0x1, %edi
callq 0x5590
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop