2016-01-27 11:31:39 +00:00
|
|
|
#include <ws/ws.hpp>
|
|
|
|
|
|
|
|
namespace WonderSwan {
|
|
|
|
|
|
|
|
uint8 iram[64 * 1024] = {0};
|
2016-01-28 11:39:49 +00:00
|
|
|
IO* iomap[64 * 1024] = {0};
|
2016-01-27 11:31:39 +00:00
|
|
|
Bus bus;
|
|
|
|
|
|
|
|
auto IO::power() -> void {
|
|
|
|
static IO unmapped;
|
2016-01-28 11:39:49 +00:00
|
|
|
for(auto& n : iomap) n = &unmapped;
|
|
|
|
}
|
|
|
|
|
2016-01-30 06:40:35 +00:00
|
|
|
auto IO::portRead(uint16 addr) -> uint8 {
|
2016-02-04 10:29:08 +00:00
|
|
|
print("[", hex(addr, 4L), "]: port unmapped\n");
|
2016-01-30 06:40:35 +00:00
|
|
|
return 0x00;
|
2016-01-28 11:39:49 +00:00
|
|
|
}
|
|
|
|
|
2016-01-30 06:40:35 +00:00
|
|
|
auto IO::portWrite(uint16 addr, uint8 data) -> void {
|
2016-02-04 10:29:08 +00:00
|
|
|
print("[", hex(addr, 4L), "] = ", hex(data, 2L), ": port unmapped\n");
|
2016-01-27 11:31:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Bus::read(uint20 addr) -> uint8 {
|
|
|
|
if(addr < 0x10000) return cpu.ramRead(addr);
|
|
|
|
if(addr < 0x20000) return cartridge.ramRead(addr);
|
|
|
|
return cartridge.romRead(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Bus::write(uint20 addr, uint8 data) -> void {
|
|
|
|
if(addr < 0x10000) return cpu.ramWrite(addr, data);
|
|
|
|
if(addr < 0x20000) return cartridge.ramWrite(addr, data);
|
|
|
|
return cartridge.romWrite(addr, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|