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.
 
 
 
 
 

41 lines
846 B

  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_REGS 11
  9. /* Structs */
  10. typedef struct {
  11. uint8_t *vram;
  12. uint8_t regs[VDP_REGS];
  13. uint8_t h_counter;
  14. uint8_t v_counter;
  15. bool v_count_jump;
  16. uint8_t control_code;
  17. uint16_t control_addr;
  18. bool control_flag;
  19. bool stat_int, stat_ovf, stat_col;
  20. uint8_t read_buf;
  21. } VDP;
  22. /* Functions */
  23. void vdp_init(VDP*);
  24. void vdp_free(VDP*);
  25. void vdp_power(VDP*);
  26. void vdp_simulate_line(VDP*);
  27. uint8_t vdp_read_control(VDP*);
  28. uint8_t vdp_read_data(VDP*);
  29. void vdp_write_control(VDP*, uint8_t);
  30. void vdp_write_data(VDP*, uint8_t);