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.

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. #define VDP_LINES_PER_FRAME 262
  7. #define VDP_VRAM_SIZE (16 * 1024)
  8. #define VDP_CRAM_SIZE (64)
  9. #define VDP_REGS 11
  10. /* Structs */
  11. typedef struct {
  12. uint32_t *pixels;
  13. uint8_t *vram;
  14. uint8_t *cram;
  15. uint8_t regs[VDP_REGS];
  16. uint8_t h_counter;
  17. uint8_t v_counter;
  18. bool v_count_jump;
  19. uint8_t flags;
  20. uint8_t control_code;
  21. uint16_t control_addr;
  22. uint8_t line_count;
  23. uint8_t read_buf;
  24. uint8_t cram_latch;
  25. } VDP;
  26. /* Functions */
  27. void vdp_init(VDP*);
  28. void vdp_free(VDP*);
  29. void vdp_power(VDP*);
  30. void vdp_simulate_line(VDP*);
  31. uint8_t vdp_read_control(VDP*);
  32. uint8_t vdp_read_data(VDP*);
  33. void vdp_write_control(VDP*, uint8_t);
  34. void vdp_write_data(VDP*, uint8_t);
  35. bool vdp_assert_irq(VDP*);
  36. void vdp_dump_registers(const VDP*);