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.
 
 
 
 
 

51 lines
1.1 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. #include "psg.h"
  9. #include "rom.h"
  10. #include "z80.h"
  11. #define GG_SCREEN_WIDTH 160
  12. #define GG_SCREEN_HEIGHT 144
  13. #define GG_FPS 60
  14. #define GG_EXC_BUFF_SIZE 128
  15. /* Structs, etc. */
  16. struct GameGear;
  17. typedef void (*GGFrameCallback)(struct GameGear*);
  18. typedef struct GameGear {
  19. Z80 cpu;
  20. MMU mmu;
  21. VDP vdp;
  22. PSG psg;
  23. IO io;
  24. bool powered;
  25. GGFrameCallback callback;
  26. char exc_buffer[GG_EXC_BUFF_SIZE];
  27. } GameGear;
  28. /* Functions */
  29. GameGear* gamegear_create();
  30. void gamegear_destroy(GameGear*);
  31. void gamegear_load(GameGear*, const ROM*);
  32. void gamegear_simulate(GameGear*);
  33. void gamegear_power_off(GameGear*); // TODO: generic "gamegear_input()" with a power-off option
  34. void gamegear_attach_callback(GameGear*, GGFrameCallback);
  35. void gamegear_attach_display(GameGear*, uint32_t*);
  36. void gamegear_detach(GameGear*);
  37. const char* gamegear_get_exception(GameGear*);
  38. void gamegear_print_state(const GameGear*);