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.
 
 
 
 
 

50 lignes
1.0 KiB

  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 "io.h"
  7. #include "mmu.h"
  8. #define Z80_EXC_NOT_POWERED 0
  9. #define Z80_EXC_UNIMPLEMENTED_OPCODE 1
  10. #define Z80_EXC_IO_ERROR 2
  11. /* Structs */
  12. typedef struct {
  13. uint8_t a, f, b, c, d, e, h, l;
  14. uint8_t a_, f_, b_, c_, d_, e_, h_, l_;
  15. uint16_t ix, iy, sp, pc;
  16. uint8_t i, r;
  17. bool im_a, im_b;
  18. bool iff1, iff2;
  19. } Z80RegFile;
  20. typedef struct {
  21. bool fresh;
  22. uint16_t last_addr;
  23. uint64_t counter;
  24. } Z80TraceInfo;
  25. typedef struct {
  26. Z80RegFile regfile;
  27. MMU *mmu;
  28. IO *io;
  29. bool except;
  30. uint8_t exc_code, exc_data;
  31. uint16_t *last_index;
  32. double pending_cycles;
  33. Z80TraceInfo trace;
  34. } Z80;
  35. /* Functions */
  36. void z80_init(Z80*, MMU*, IO*);
  37. void z80_power(Z80*);
  38. bool z80_do_cycles(Z80*, double);
  39. void z80_dump_registers(const Z80*);