An emulator, assembler, and disassembler for the Sega Game Gear
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
837 B

  1. /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. /*
  4. This file contains code to implement the Z80 instruction set. Since there
  5. are a lot of functions, it is kept separate from the main z80.c file. It is
  6. included in the middle of z80.c and should not be compiled separately.
  7. */
  8. /*
  9. 0x00: NOP
  10. */
  11. static uint8_t z80_inst_nop(Z80 *z80, uint8_t opcode)
  12. {
  13. (void) opcode;
  14. z80->regfile.pc++;
  15. return 4;
  16. }
  17. /*
  18. Unimplemented opcode handler.
  19. */
  20. static uint8_t z80_inst_ERR(Z80 *z80, uint8_t opcode)
  21. {
  22. z80->except = true;
  23. z80->exc_code = Z80_EXC_UNIMPLEMENTED_OPCODE;
  24. z80->exc_data = opcode;
  25. return 2;
  26. }
  27. static uint8_t (*instruction_lookup_table[256])(Z80*, uint8_t) = {
  28. z80_inst_nop,
  29. z80_inst_ERR
  30. };