ppu.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * PPU emulation - The peTI-NESulator Project
  3. * ppu.h
  4. *
  5. * Define and emulate the PPU (Picture Processing Unit) of the real NES
  6. *
  7. * Created by Manoël Trapier.
  8. * Copyright (c) 2002-2019 986-Studio.
  9. *
  10. */
  11. #ifndef PPU_H
  12. #define PPU_H
  13. #include <types.h>
  14. typedef struct PPU_Sprite_
  15. {
  16. uint8_t y;
  17. uint8_t tileid;
  18. uint8_t flags;
  19. uint8_t x;
  20. } PPU_Sprite;
  21. /*
  22. PPU must be initialized after memory initialisation..
  23. */
  24. int ppu_init();
  25. int ppu_hblank(uint16_t scanline);
  26. uint8_t ppu_readReg(uint8_t id);
  27. void ppu_writeReg(uint8_t id, uint8_t val);
  28. void ppu_fillSprRamDMA(uint8_t value);
  29. #define PPU_MIRROR_HORIZTAL 0
  30. #define PPU_MIRROR_VERTICAL 1
  31. #define PPU_SCREEN_000 0
  32. #define PPU_SCREEN_400 1
  33. #define PPU_SCREEN_800 2
  34. #define PPU_SCREEN_C00 3
  35. #define PPU_SCMODE_SINGLE 0
  36. #define PPU_SCMODE_NORMAL 1
  37. #define PPU_SCMODE_FOURSC 2
  38. void ppu_setMirroring(uint8_t direction);
  39. void ppu_setSingleScreen(uint8_t screen);
  40. void ppu_setScreenMode(uint8_t mode);
  41. PPU_Sprite ppu_getSprite(uint16_t i);
  42. uint8_t ppu_memoryRead(uint8_t page, uint8_t addr);
  43. void ppu_memoryWrite(uint8_t page, uint8_t addr, uint8_t value);
  44. void ppu_debugSprites();
  45. void ppu_debugColor();
  46. #endif