nes.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2022 Dozingfiretruck
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all
  14. * copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. * SOFTWARE.
  23. */
  24. #ifndef _NES_
  25. #define _NES_
  26. #include "nes_port.h"
  27. #include "nes_rom.h"
  28. #include "nes_cpu.h"
  29. #include "nes_ppu.h"
  30. #include "nes_apu.h"
  31. #include "nes_mapper.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #define NES_NAME "NES"
  36. #define NES_WIDTH 256
  37. #define NES_HEIGHT 240
  38. #define NES_OK 0
  39. #define NES_ERROR -1
  40. typedef struct nes{
  41. uint8_t nes_quit;
  42. nes_rom_info_t nes_rom;
  43. nes_cpu_t nes_cpu;
  44. nes_ppu_t nes_ppu;
  45. nes_mapper_t nes_mapper;
  46. nes_color_t nes_draw_data[NES_DRAW_SIZE];
  47. } nes_t;
  48. int nes_init(nes_t *nes);
  49. int nes_deinit(nes_t *nes);
  50. int nes_initex(nes_t* nes);
  51. int nes_deinitex(nes_t* nes);
  52. void nes_run(nes_t* nes);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif// _NES_