mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 23:22:25 +01:00
byuu says: Changelog: - WS: fixed lods, scas instructions - WS: implemented missing GRP4 instructions - WS: fixed transparency for screen one - WSC: added color-mode PPU rendering - WS+WSC: added packed pixel mode support - WS+WSC: added dummy sound register reads/writes - SFC: added threading to SuperDisc (it's hanging for right now; need to clear IRQ on $21e2 writes) SuperDisc Timer and Sound Check were failing before due to not turning off IRQs on $21e4 clear, so I'm happy that's fixed now. Riviera starts now, and displays the first intro screen before crashing. Huge, huge amounts of corrupted graphics, though. This game's really making me work for it :( No color games seem fully playable yet, but a lot of monochrome and color games are now at least showing more intro screen graphics before dying. This build defaults to horizontal orientation, but I left the inputs bound to vertical orientation. Whoops. I still need to implement a screen flip key binding.
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include <ws/ws.hpp>
|
|
|
|
namespace WonderSwan {
|
|
|
|
IO* iomap[64 * 1024] = {nullptr};
|
|
InternalRAM iram;
|
|
Bus bus;
|
|
|
|
auto IO::power() -> void {
|
|
static IO unmapped;
|
|
for(auto& n : iomap) n = &unmapped;
|
|
}
|
|
|
|
auto IO::portRead(uint16 addr) -> uint8 {
|
|
//print("[", hex(addr, 4L), "]: port unmapped\n");
|
|
return 0x00;
|
|
}
|
|
|
|
auto IO::portWrite(uint16 addr, uint8 data) -> void {
|
|
//print("[", hex(addr, 4L), "] = ", hex(data, 2L), ": port unmapped\n");
|
|
}
|
|
|
|
auto InternalRAM::power() -> void {
|
|
for(auto& byte : memory) byte = 0x00;
|
|
}
|
|
|
|
auto InternalRAM::read(uint16 addr, uint size) -> uint32 {
|
|
if(size == Long) return read(addr + 0, Word) << 0 | read(addr + 2, Word) << 16;
|
|
if(size == Word) return read(addr + 0, Byte) << 0 | read(addr + 1, Byte) << 8;
|
|
|
|
if(addr >= 0x4000 && !system.r.depth) return 0x90;
|
|
return memory[addr];
|
|
}
|
|
|
|
auto InternalRAM::write(uint16 addr, uint8 data) -> void {
|
|
if(addr >= 0x4000 && !system.r.depth) return;
|
|
memory[addr] = data;
|
|
}
|
|
|
|
auto Bus::read(uint20 addr) -> uint8 {
|
|
if(addr.bits(16,19) == 0) return iram.read(addr);
|
|
if(addr.bits(16,19) == 1) return cartridge.ramRead(addr);
|
|
if(addr.bits(16,19) >= 2) return cartridge.romRead(addr);
|
|
unreachable;
|
|
}
|
|
|
|
auto Bus::write(uint20 addr, uint8 data) -> void {
|
|
if(addr.bits(16,19) == 0) return iram.write(addr, data);
|
|
if(addr.bits(16,19) == 1) return cartridge.ramWrite(addr, data);
|
|
if(addr.bits(16,19) >= 2) return cartridge.romWrite(addr, data);
|
|
}
|
|
|
|
}
|