An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

39 lignes
806 B

  1. /* Copyright (C) 2014-2016 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #pragma once
  4. #include <stdbool.h>
  5. #include <stdint.h>
  6. #include "mmu.h"
  7. #define Z80_EXC_NOT_POWERED 0
  8. #define Z80_EXC_UNIMPLEMENTED_OPCODE 1
  9. /* Structs */
  10. typedef struct {
  11. uint8_t a, f, b, c, d, e, h, l;
  12. uint8_t a_, f_, b_, c_, d_, e_, h_, l_;
  13. uint16_t ix, iy, sp, pc;
  14. uint8_t i, r;
  15. bool im_a, im_b;
  16. bool iff1, iff2;
  17. } Z80RegFile;
  18. typedef struct {
  19. Z80RegFile regfile;
  20. MMU *mmu;
  21. bool except;
  22. uint8_t exc_code, exc_data;
  23. double pending_cycles;
  24. } Z80;
  25. /* Functions */
  26. void z80_init(Z80*, MMU*);
  27. void z80_power(Z80*);
  28. bool z80_do_cycles(Z80*, double);
  29. void z80_dump_registers(const Z80*);