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.
 
 
 
 
 

62 lines
1.3 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. typedef enum {
  29. BUTTON_UP = 0,
  30. BUTTON_DOWN = 1,
  31. BUTTON_LEFT = 2,
  32. BUTTON_RIGHT = 3,
  33. BUTTON_TRIGGER_1 = 4,
  34. BUTTON_TRIGGER_2 = 5,
  35. BUTTON_START
  36. } GGButton;
  37. /* Functions */
  38. GameGear* gamegear_create();
  39. void gamegear_destroy(GameGear*);
  40. void gamegear_load(GameGear*, const ROM*);
  41. void gamegear_simulate(GameGear*);
  42. void gamegear_input(GameGear*, GGButton, bool);
  43. void gamegear_power_off(GameGear*);
  44. void gamegear_attach_callback(GameGear*, GGFrameCallback);
  45. void gamegear_attach_display(GameGear*, uint32_t*);
  46. void gamegear_detach(GameGear*);
  47. const char* gamegear_get_exception(GameGear*);
  48. void gamegear_print_state(const GameGear*);