machine_x86.cpp 606 B

1234567891011121314151617181920212223242526
  1. #include "machine_x86.h"
  2. // Index registers **** temp solution
  3. static const std::string regNames[] = {
  4. "undef",
  5. "ax", "cx", "dx", "bx",
  6. "sp", "bp", "si", "di",
  7. "es", "cs", "ss", "ds",
  8. "al", "cl", "dl", "bl",
  9. "ah", "ch", "dh", "bh",
  10. "tmp",
  11. "bx+si", "bx+di", "bp+si", "bp+di",
  12. "si", "di", "bp", "bx"
  13. };
  14. /* uint8_t and uint16_t registers */
  15. Machine_X86::Machine_X86()
  16. {
  17. static_assert((sizeof(regNames)/sizeof(std::string))==LAST_REG,
  18. "Reg count not equal number of strings");
  19. }
  20. const std::string &Machine_X86::regName(eReg r)
  21. {
  22. return regNames[r];
  23. }