ppu.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 Manoel TRAPIER.
  8. * Copyright (c) 2003-2018 986-Studio. All rights reserved.
  9. *
  10. * $LastChangedDate$
  11. * $Author$
  12. * $HeadURL$
  13. * $Revision$
  14. *
  15. */
  16. #ifndef PPU_H
  17. #define PPU_H
  18. #include <types.h>
  19. typedef struct PPU_Sprite_
  20. {
  21. uint8_t y;
  22. uint8_t tileid;
  23. uint8_t flags;
  24. uint8_t x;
  25. } PPU_Sprite;
  26. /*
  27. PPU must be initialized after memory initialisation..
  28. */
  29. int ppu_init();
  30. int ppu_hblank(uint16_t scanline);
  31. uint8_t ppu_readReg(uint8_t id);
  32. void ppu_writeReg(uint8_t id, uint8_t val);
  33. void ppu_fillSprRamDMA(uint8_t value);
  34. #define PPU_MIRROR_HORIZTAL 0
  35. #define PPU_MIRROR_VERTICAL 1
  36. #define PPU_SCREEN_000 0
  37. #define PPU_SCREEN_400 1
  38. #define PPU_SCREEN_800 2
  39. #define PPU_SCREEN_C00 3
  40. #define PPU_SCMODE_SINGLE 0
  41. #define PPU_SCMODE_NORMAL 1
  42. #define PPU_SCMODE_FOURSC 2
  43. void ppu_setMirroring(uint8_t direction);
  44. void ppu_setSingleScreen(uint8_t screen);
  45. void ppu_setScreenMode(uint8_t mode);
  46. PPU_Sprite ppu_getSprite(uint16_t i);
  47. unsigned char ppu_memoryRead(uint8_t page, uint8_t addr);
  48. void ppu_memoryWrite(uint8_t page, uint8_t addr, uint8_t value);
  49. void ppu_debugSprites();
  50. void ppu_debugColor();
  51. #endif