Okay maybe not all of them, but close to all of them ...

This commit is contained in:
byuu
2019-08-01 08:54:40 +09:00
parent fe81130f54
commit 0e56b27228
2 changed files with 19 additions and 19 deletions

View File

@@ -28,7 +28,7 @@ auto PPU::readVRAM() -> uint16 {
} }
template<bool Byte> template<bool Byte>
auto PPU::writeVRAM(uint8_t data) -> void { auto PPU::writeVRAM(uint8 data) -> void {
if(!io.displayDisable && cpu.vcounter() < vdisp()) return; if(!io.displayDisable && cpu.vcounter() < vdisp()) return;
Line::flush(); Line::flush();
auto address = vramAddress(); auto address = vramAddress();
@@ -60,7 +60,7 @@ auto PPU::readOAM(uint10 address) -> uint8 {
return readObject(address); return readObject(address);
} }
auto PPU::writeOAM(uint10 address, uint8_t data) -> void { auto PPU::writeOAM(uint10 address, uint8 data) -> void {
Line::flush(); Line::flush();
//0x0218: Uniracers (2-player mode) hack; requires cycle timing for latch.oamAddress to be correct //0x0218: Uniracers (2-player mode) hack; requires cycle timing for latch.oamAddress to be correct
if(!io.displayDisable && cpu.vcounter() < vdisp()) address = 0x0218; //latch.oamAddress; if(!io.displayDisable && cpu.vcounter() < vdisp()) address = 0x0218; //latch.oamAddress;
@@ -68,7 +68,7 @@ auto PPU::writeOAM(uint10 address, uint8_t data) -> void {
} }
template<bool Byte> template<bool Byte>
auto PPU::readCGRAM(uint8_t address) -> uint8 { auto PPU::readCGRAM(uint8 address) -> uint8 {
if(!io.displayDisable if(!io.displayDisable
&& cpu.vcounter() > 0 && cpu.vcounter() < vdisp() && cpu.vcounter() > 0 && cpu.vcounter() < vdisp()
&& cpu.hcounter() >= 88 && cpu.hcounter() < 1096 && cpu.hcounter() >= 88 && cpu.hcounter() < 1096
@@ -81,7 +81,7 @@ auto PPU::readCGRAM(uint8_t address) -> uint8 {
} }
} }
auto PPU::writeCGRAM(uint8_t address, uint15 data) -> void { auto PPU::writeCGRAM(uint8 address, uint15 data) -> void {
if(!io.displayDisable if(!io.displayDisable
&& cpu.vcounter() > 0 && cpu.vcounter() < vdisp() && cpu.vcounter() > 0 && cpu.vcounter() < vdisp()
&& cpu.hcounter() >= 88 && cpu.hcounter() < 1096 && cpu.hcounter() >= 88 && cpu.hcounter() < 1096
@@ -103,17 +103,17 @@ auto PPU::readIO(uint address, uint8 data) -> uint8 {
} }
case 0x2134: { //MPYL case 0x2134: { //MPYL
uint result = (int16_t)io.mode7.a * (int8_t)(io.mode7.b >> 8); uint result = (int16)io.mode7.a * (int8)(io.mode7.b >> 8);
return latch.ppu1.mdr = result >> 0; return latch.ppu1.mdr = result >> 0;
} }
case 0x2135: { //MPYM case 0x2135: { //MPYM
uint result = (int16_t)io.mode7.a * (int8_t)(io.mode7.b >> 8); uint result = (int16)io.mode7.a * (int8)(io.mode7.b >> 8);
return latch.ppu1.mdr = result >> 8; return latch.ppu1.mdr = result >> 8;
} }
case 0x2136: { //MPYH case 0x2136: { //MPYH
uint result = (int16_t)io.mode7.a * (int8_t)(io.mode7.b >> 8); uint result = (int16)io.mode7.a * (int8)(io.mode7.b >> 8);
return latch.ppu1.mdr = result >> 16; return latch.ppu1.mdr = result >> 16;
} }

View File

@@ -244,12 +244,12 @@ public:
auto latchCounters() -> void; auto latchCounters() -> void;
alwaysinline auto vramAddress() const -> uint; alwaysinline auto vramAddress() const -> uint;
alwaysinline auto readVRAM() -> uint16; alwaysinline auto readVRAM() -> uint16;
template<bool Byte> alwaysinline auto writeVRAM(uint8_t data) -> void; template<bool Byte> alwaysinline auto writeVRAM(uint8 data) -> void;
alwaysinline auto updateTiledata(uint address) -> void; alwaysinline auto updateTiledata(uint address) -> void;
alwaysinline auto readOAM(uint10 address) -> uint8; alwaysinline auto readOAM(uint10 address) -> uint8;
alwaysinline auto writeOAM(uint10 address, uint8_t data) -> void; alwaysinline auto writeOAM(uint10 address, uint8 data) -> void;
template<bool Byte> alwaysinline auto readCGRAM(uint8_t address) -> uint8; template<bool Byte> alwaysinline auto readCGRAM(uint8 address) -> uint8;
alwaysinline auto writeCGRAM(uint8_t address, uint15 data) -> void; alwaysinline auto writeCGRAM(uint8 address, uint15 data) -> void;
auto readIO(uint address, uint8 data) -> uint8; auto readIO(uint address, uint8 data) -> uint8;
auto writeIO(uint address, uint8 data) -> void; auto writeIO(uint address, uint8 data) -> void;
auto updateVideoMode() -> void; auto updateVideoMode() -> void;
@@ -264,14 +264,14 @@ public:
Latch latch; Latch latch;
IO io; IO io;
uint16_t vram[32 * 1024] = {}; uint16 vram[32 * 1024] = {};
uint16_t cgram[256] = {}; uint16 cgram[256] = {};
Object objects[128] = {}; Object objects[128] = {};
//[unserialized] //[unserialized]
uint16_t* output = {}; uint16* output = {};
uint16_t* lightTable[16] = {}; uint16* lightTable[16] = {};
uint8_t* tilecache[3] = {}; //bitplane -> bitmap tiledata uint8* tilecache[3] = {}; //bitplane -> bitmap tiledata
uint ItemLimit = 0; uint ItemLimit = 0;
uint TileLimit = 0; uint TileLimit = 0;
@@ -280,9 +280,9 @@ public:
//line.cpp //line.cpp
static auto flush() -> void; static auto flush() -> void;
auto render() -> void; auto render() -> void;
auto pixel(uint x, Pixel above, Pixel below) const -> uint16_t; auto pixel(uint x, Pixel above, Pixel below) const -> uint16;
auto blend(uint x, uint y, bool halve) const -> uint16_t; auto blend(uint x, uint y, bool halve) const -> uint16;
alwaysinline auto directColor(uint paletteIndex, uint paletteColor) const -> uint16_t; alwaysinline auto directColor(uint paletteIndex, uint paletteColor) const -> uint16;
alwaysinline auto plotAbove(uint x, uint source, uint priority, uint color) -> void; alwaysinline auto plotAbove(uint x, uint source, uint priority, uint color) -> void;
alwaysinline auto plotBelow(uint x, uint source, uint priority, uint color) -> void; alwaysinline auto plotBelow(uint x, uint source, uint priority, uint color) -> void;
alwaysinline auto plotHD(Pixel*, uint x, uint source, uint priority, uint color, bool hires, bool subpixel) -> void; alwaysinline auto plotHD(Pixel*, uint x, uint source, uint priority, uint color, bool hires, bool subpixel) -> void;