mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 14:42:33 +01:00
byuu says: Changelog: - higan: readded support for soft-reset to Famicom, Super Famicom, Mega Drive cores (work in progress) - handhelds lack soft reset obviously - the PC Engine also lacks a physical reset button - the Master System's reset button acts like a gamepad button, so can't show up in the menu - Mega Drive: power cycle wasn't initializing CPU (M68K) or APU (Z80) RAM - Super Famicom: fix SPC700 opcode 0x3b regression; fixes Majuu Ou [Jonas Quinn] - Super Famicom: fix SharpRTC save regression; fixes Dai Kaijuu Monogatari II's real-time clock [Talarubi] - Super Famicom: fix EpsonRTC save regression; fixes Tengai Makyou Zero's real-time clock [Talarubi] - Super Famicom: removed `*::init()` functions, as they were never used - Super Famicom: removed all but two `*::load()` functions, as they were not used - higan: added option to auto-save backup RAM every five seconds (enabled by default) - this is in case the emulator crashes, or there's a power outage; turn it off under advanced settings if you want - libco: updated license from public domain to ISC, for consistency with nall, ruby, hiro - nall: Linux compiler defaults to g++; override with g++-version if g++ is <= 4.8 - FreeBSD compiler default is going to remain g++49 until my dev box OS ships with g++ >= 4.9 Errata: I have weird RAM initialization constants, thanks to hex_usr and onethirdxcubed for both finding this: http://wiki.nesdev.com/w/index.php?title=CPU_power_up_state&diff=11711&oldid=11184 I'll remove this in the next WIP.
124 lines
2.5 KiB
C++
124 lines
2.5 KiB
C++
struct PPU : Thread {
|
|
inline auto rate() const -> uint { return Region::PAL() ? 5 : 4; }
|
|
inline auto vlines() const -> uint { return Region::PAL() ? 312 : 262; }
|
|
|
|
//ppu.cpp
|
|
static auto Enter() -> void;
|
|
auto main() -> void;
|
|
auto step(uint clocks) -> void;
|
|
|
|
auto scanline() -> void;
|
|
auto frame() -> void;
|
|
auto refresh() -> void;
|
|
|
|
auto power(bool reset) -> void;
|
|
|
|
//memory.cpp
|
|
auto readCIRAM(uint11 addr) -> uint8;
|
|
auto writeCIRAM(uint11 addr, uint8 data) -> void;
|
|
|
|
auto readCGRAM(uint5 addr) -> uint8;
|
|
auto writeCGRAM(uint5 addr, uint8 data) -> void;
|
|
|
|
auto readIO(uint16 addr) -> uint8;
|
|
auto writeIO(uint16 addr, uint8 data) -> void;
|
|
|
|
//render.cpp
|
|
auto enable() const -> bool;
|
|
auto loadCHR(uint16 addr) -> uint8;
|
|
|
|
auto renderPixel() -> void;
|
|
auto renderSprite() -> void;
|
|
auto renderScanline() -> void;
|
|
|
|
//serialization.cpp
|
|
auto serialize(serializer&) -> void;
|
|
|
|
struct IO {
|
|
//internal
|
|
uint8 mdr;
|
|
|
|
uint1 field;
|
|
uint lx;
|
|
uint ly;
|
|
|
|
uint8 busData;
|
|
|
|
union {
|
|
uint value;
|
|
NaturalBitField<uint, 0, 4> tileX;
|
|
NaturalBitField<uint, 5, 9> tileY;
|
|
NaturalBitField<uint,10,11> nametable;
|
|
NaturalBitField<uint,10,10> nametableX;
|
|
NaturalBitField<uint,11,11> nametableY;
|
|
NaturalBitField<uint,12,14> fineY;
|
|
NaturalBitField<uint, 0,14> address;
|
|
NaturalBitField<uint, 0, 7> addressLo;
|
|
NaturalBitField<uint, 8,14> addressHi;
|
|
NaturalBitField<uint,15,15> latch;
|
|
NaturalBitField<uint,16,18> fineX;
|
|
} v, t;
|
|
|
|
bool nmiHold;
|
|
bool nmiFlag;
|
|
|
|
//$2000
|
|
uint vramIncrement;
|
|
uint spriteAddress;
|
|
uint bgAddress;
|
|
uint spriteHeight;
|
|
bool masterSelect;
|
|
bool nmiEnable;
|
|
|
|
//$2001
|
|
bool grayscale;
|
|
bool bgEdgeEnable;
|
|
bool spriteEdgeEnable;
|
|
bool bgEnable;
|
|
bool spriteEnable;
|
|
uint3 emphasis;
|
|
|
|
//$2002
|
|
bool spriteOverflow;
|
|
bool spriteZeroHit;
|
|
|
|
//$2003
|
|
uint8 oamAddress;
|
|
} io;
|
|
|
|
struct OAM {
|
|
//serialization.cpp
|
|
auto serialize(serializer&) -> void;
|
|
|
|
uint8 id = 64;
|
|
uint8 y = 0xff;
|
|
uint8 tile = 0xff;
|
|
uint8 attr = 0xff;
|
|
uint8 x = 0xff;
|
|
|
|
uint8 tiledataLo = 0;
|
|
uint8 tiledataHi = 0;
|
|
};
|
|
|
|
struct Latches {
|
|
uint16 nametable;
|
|
uint16 attribute;
|
|
uint16 tiledataLo;
|
|
uint16 tiledataHi;
|
|
|
|
uint oamIterator;
|
|
uint oamCounter;
|
|
|
|
OAM oam[8]; //primary
|
|
OAM soam[8]; //secondary
|
|
} latch;
|
|
|
|
uint8 ciram[2048];
|
|
uint8 cgram[32];
|
|
uint8 oam[256];
|
|
|
|
uint32 buffer[256 * 262];
|
|
};
|
|
|
|
extern PPU ppu;
|