An emulator, assembler, and disassembler for the Sega Game Gear
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

z80.h 998 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. double pending_cycles;
  32. Z80TraceInfo trace;
  33. } Z80;
  34. /* Functions */
  35. void z80_init(Z80*, MMU*, IO*);
  36. void z80_power(Z80*);
  37. bool z80_do_cycles(Z80*, double);
  38. void z80_dump_registers(const Z80*);