cmmio.cpp 871 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include <../base.hpp>
  2. #include <../cart/cart.hpp>
  3. #include "cmmio.hpp"
  4. void CMMIO::init() {
  5. }
  6. void CMMIO::enable() {
  7. memory::mmio.map(0x3000, *this);
  8. memory::mmio.map(0x3001, *this);
  9. memory::mmio.map(0x3002, *this);
  10. memory::mmio.map(0x3004, *this);
  11. }
  12. void CMMIO::power() {
  13. reset();
  14. }
  15. void CMMIO::reset() {
  16. }
  17. uint8 CMMIO::mmio_read(unsigned addr) {
  18. addr &= 0xffff;
  19. //printf("CMMIO::mmio_read 0x%x",addr);
  20. return cpu.regs.mdr;
  21. }
  22. void CMMIO::mmio_write(unsigned addr, uint8 data) {
  23. addr &= 0xffff;
  24. //fflush(stdout);
  25. //printf("CMMIO::mmio_write 0x%04x 0x%02x (%i)\n",addr,data,data);
  26. /* debug to stderr */
  27. if (addr == 0x3000){
  28. fprintf(stderr,"%c",data);
  29. fflush(stderr);
  30. }
  31. #if 0
  32. if (addr == 0x3001){
  33. fprintf(stderr,"Trigger IRQ\n");
  34. fflush(stderr);
  35. cpu.triggerIRQ();
  36. }
  37. #endif
  38. }
  39. CMMIO::CMMIO() {
  40. }