2012-04-26 10:51:13 +00:00
|
|
|
struct CPU : Processor::LR35902, Thread, MMIO {
|
2015-11-21 07:36:48 +00:00
|
|
|
enum class Interrupt : uint { Vblank, Stat, Timer, Serial, Joypad };
|
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
static auto Enter() -> void;
|
2015-11-21 07:36:48 +00:00
|
|
|
auto main() -> void;
|
2016-06-05 22:10:01 +00:00
|
|
|
auto raise(Interrupt id) -> void;
|
2015-11-21 07:36:48 +00:00
|
|
|
auto interrupt_test() -> void;
|
|
|
|
auto stop() -> bool;
|
|
|
|
auto power() -> void;
|
|
|
|
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
|
|
|
//mmio.cpp
|
|
|
|
auto wram_addr(uint16 addr) const -> uint;
|
|
|
|
auto mmio_joyp_poll() -> void;
|
|
|
|
auto mmio_read(uint16 addr) -> uint8;
|
|
|
|
auto mmio_write(uint16 addr, uint8 data) -> void;
|
|
|
|
|
|
|
|
//memory.cpp
|
2016-06-05 22:10:01 +00:00
|
|
|
auto io() -> void override;
|
|
|
|
auto read(uint16 addr) -> uint8 override;
|
|
|
|
auto write(uint16 addr, uint8 data) -> void override;
|
2015-11-21 07:36:48 +00:00
|
|
|
auto cycle_edge() -> void;
|
|
|
|
auto dma_read(uint16 addr) -> uint8;
|
|
|
|
auto dma_write(uint16 addr, uint8 data) -> void;
|
|
|
|
auto debugger_read(uint16 addr) -> uint8;
|
|
|
|
|
|
|
|
//timing.cpp
|
|
|
|
auto add_clocks(uint clocks) -> void;
|
|
|
|
auto timer_262144hz() -> void;
|
|
|
|
auto timer_65536hz() -> void;
|
|
|
|
auto timer_16384hz() -> void;
|
|
|
|
auto timer_8192hz() -> void;
|
|
|
|
auto timer_4096hz() -> void;
|
|
|
|
auto hblank() -> void;
|
2011-01-02 04:46:54 +00:00
|
|
|
|
2010-12-28 06:03:02 +00:00
|
|
|
struct Status {
|
2016-01-11 10:31:30 +00:00
|
|
|
uint22 clock;
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
//$ff00 JOYP
|
|
|
|
bool p15;
|
|
|
|
bool p14;
|
2010-12-31 05:43:47 +00:00
|
|
|
uint8 joyp;
|
2011-01-06 10:16:07 +00:00
|
|
|
uint8 mlt_req;
|
2010-12-30 07:18:47 +00:00
|
|
|
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
//$ff01 SB
|
|
|
|
uint8 serial_data;
|
2015-11-21 07:36:48 +00:00
|
|
|
uint serial_bits;
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
|
|
|
|
//$ff02 SC
|
|
|
|
bool serial_transfer;
|
|
|
|
bool serial_clock;
|
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
//$ff04 DIV
|
2016-01-11 10:31:30 +00:00
|
|
|
uint16 div;
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
//$ff05 TIMA
|
|
|
|
uint8 tima;
|
|
|
|
|
|
|
|
//$ff06 TMA
|
|
|
|
uint8 tma;
|
|
|
|
|
|
|
|
//$ff07 TAC
|
|
|
|
bool timer_enable;
|
2015-11-21 07:36:48 +00:00
|
|
|
uint timer_clock;
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
//$ff0f IF
|
|
|
|
bool interrupt_request_joypad;
|
|
|
|
bool interrupt_request_serial;
|
|
|
|
bool interrupt_request_timer;
|
|
|
|
bool interrupt_request_stat;
|
|
|
|
bool interrupt_request_vblank;
|
|
|
|
|
2011-10-27 00:00:17 +00:00
|
|
|
//$ff4d KEY1
|
|
|
|
bool speed_double;
|
|
|
|
bool speed_switch;
|
|
|
|
|
|
|
|
//$ff51,$ff52 HDMA1,HDMA2
|
|
|
|
uint16 dma_source;
|
|
|
|
|
|
|
|
//$ff53,$ff54 HDMA3,HDMA4
|
|
|
|
uint16 dma_target;
|
|
|
|
|
|
|
|
//$ff55 HDMA5
|
|
|
|
bool dma_mode;
|
|
|
|
uint16 dma_length;
|
2013-12-10 12:12:54 +00:00
|
|
|
bool dma_completed;
|
2011-10-27 00:00:17 +00:00
|
|
|
|
|
|
|
//$ff6c ???
|
|
|
|
uint8 ff6c;
|
|
|
|
|
|
|
|
//$ff70 SVBK
|
|
|
|
uint3 wram_bank;
|
|
|
|
|
|
|
|
//$ff72-$ff75 ???
|
|
|
|
uint8 ff72;
|
|
|
|
uint8 ff73;
|
|
|
|
uint8 ff74;
|
|
|
|
uint8 ff75;
|
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
//$ffff IE
|
|
|
|
bool interrupt_enable_joypad;
|
|
|
|
bool interrupt_enable_serial;
|
|
|
|
bool interrupt_enable_timer;
|
|
|
|
bool interrupt_enable_stat;
|
|
|
|
bool interrupt_enable_vblank;
|
2010-12-28 06:03:02 +00:00
|
|
|
} status;
|
|
|
|
|
2011-10-27 00:00:17 +00:00
|
|
|
uint8 wram[32768]; //GB=8192, GBC=32768
|
2010-12-29 11:03:42 +00:00
|
|
|
uint8 hram[128];
|
2010-12-28 01:53:15 +00:00
|
|
|
};
|
|
|
|
|
2011-01-22 08:15:49 +00:00
|
|
|
extern CPU cpu;
|