Mirror of CollapseOS
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.

27 lines
614B

  1. #include <stdint.h>
  2. #include <stdbool.h>
  3. #define VDP_VRAM_SIZE 0x4020
  4. #define VDP_SCREENW (32*8)
  5. #define VDP_SCREENH (24*8)
  6. // Offset of the name table
  7. #define VDP_NTABLE_OFFSET 0x3800
  8. typedef struct {
  9. // the last 0x20 is palette RAM
  10. uint8_t vram[VDP_VRAM_SIZE];
  11. uint8_t regs[0x10];
  12. uint8_t cmdlsb;
  13. bool has_cmdlsb;
  14. uint16_t curaddr;
  15. } VDP;
  16. void vdp_init(VDP *vdp);
  17. uint8_t vdp_cmd_rd(VDP *vdp);
  18. void vdp_cmd_wr(VDP *vdp, uint8_t val);
  19. uint8_t vdp_data_rd(VDP *vdp);
  20. void vdp_data_wr(VDP *vdp, uint8_t val);
  21. // result is a RGB value
  22. uint8_t vdp_pixel(VDP *vdp, uint16_t x, uint16_t y);