An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

77 lignes
1.3 KiB

  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. #include "vdp.h"
  4. /*
  5. Initialize the Video Display Processor (VDP).
  6. */
  7. void vdp_init(VDP *vdp)
  8. {
  9. // TODO
  10. }
  11. /*
  12. Free memory previously allocated by the VDP.
  13. */
  14. void vdp_free(VDP *vdp)
  15. {
  16. // TODO
  17. }
  18. /*
  19. Power on the VDP, setting up initial state.
  20. */
  21. void vdp_power(VDP *vdp)
  22. {
  23. vdp->control_code = 0;
  24. vdp->control_addr = 0;
  25. vdp->control_flag = false;
  26. }
  27. /*
  28. Read a byte from the VDP's control port.
  29. */
  30. uint8_t vdp_read_control(VDP *vdp)
  31. {
  32. vdp->control_flag = false;
  33. // TODO
  34. return 0;
  35. }
  36. /*
  37. Read a byte from the VDP's data port.
  38. */
  39. uint8_t vdp_read_data(VDP *vdp)
  40. {
  41. vdp->control_flag = false;
  42. // TODO
  43. return 0;
  44. }
  45. /*
  46. Write a byte into the VDP's control port.
  47. */
  48. void vdp_write_control(VDP *vdp, uint8_t byte)
  49. {
  50. if (!vdp->control_flag) { // First byte
  51. vdp->control_addr = (vdp->control_addr & 0x3F00) + byte;
  52. } else { // Second byte
  53. vdp->control_addr = ((byte & 0x3F) << 8) + (vdp->control_addr & 0xFF);
  54. vdp->control_code = byte >> 6;
  55. }
  56. vdp->control_flag = !vdp->control_flag;
  57. }
  58. /*
  59. Write a byte into the VDP's data port.
  60. */
  61. void vdp_write_data(VDP *vdp, uint8_t byte)
  62. {
  63. vdp->control_flag = false;
  64. // TODO
  65. }