bsnes/higan/ws/cpu/cpu.hpp

79 lines
1.6 KiB
C++
Raw Normal View History

struct CPU : Processor::V30MZ, Thread, IO {
enum class Interrupt : uint {
SerialSend,
Input,
Cartridge,
SerialReceive,
LineCompare,
VblankTimer,
Vblank,
HblankTimer,
};
static auto Enter() -> void;
auto main() -> void;
auto step(uint clocks) -> void;
auto wait(uint clocks = 1) -> void override;
auto read(uint20 addr) -> uint8 override;
auto write(uint20 addr, uint8 data) -> void override;
auto in(uint16 port) -> uint8 override;
auto out(uint16 port, uint8 data) -> void override;
auto power() -> void;
//io.cpp
auto keypadRead() -> uint4;
auto portRead(uint16 addr) -> uint8 override;
auto portWrite(uint16 addr, uint8 data) -> void override;
//interrupt.cpp
auto poll() -> void;
auto raise(Interrupt) -> void;
auto lower(Interrupt) -> void;
//dma.cpp
auto dmaTransfer() -> void;
Update to v097r28 release. byuu says: Changelog: (all WSC unless otherwise noted) - fixed LINECMP=0 interrupt case (fixes FF4 world map during airship sequence) - improved CPU timing (fixes Magical Drop flickering and FF1 battle music) - added per-frame OAM caching (fixes sprite glitchiness in Magical Drop, Riviera, etc.) - added RTC emulation (fixes Dicing Knight and Judgement Silversword) - added save state support - added cheat code support (untested because I don't know of any cheat codes that exist for this system) - icarus: can now detect games with RTC chips - SFC: bugfix to SharpRTC emulation (Dai Kaijuu Monogatari II) - ( I was adding the extra leap year day to all 12 months instead of just February ... >_< ) Note that the RTC emulation is very incomplete. It's not really documented at all, and the two games I've tried that use it never even ask you to set the date/time (so they're probably just using it to count seconds.) I'm not even sure if I've implement the level-sensitive behavior correctly (actually, now that I think about it, I need to mask the clear bit in INT_ACK for the level-sensitive interrupts ...) A bit worried about the RTC alarm, because it seems like it'll fire continuously for a full minute. Or even if you turn it off after it fires, then that doesn't seem to be lowering the line until the next second ticks on the RTC, so that likely needs to happen when changing the alarm flag. Also not sure on this RTC's weekday byte. On the SharpRTC, it actually computes this for you. Because it's not at all an easy thing to calculate yourself in 65816 or V30MZ assembler. About 40 lines of code to do it in C. For now, I'm requiring the program to calculate the value itself. Also note that there's some gibberish tiles in Judgement Silversword, sadly. Not sure what's up there, but the game's still fully playable at least. Finally, no surprise: Beat-Mania doesn't run :P
2016-03-25 06:19:08 +00:00
//serialization.cpp
auto serialize(serializer&) -> void;
struct Registers {
//$0040-0042 DMA_SRC
uint20 dmaSource;
//$0044-0045 DMA_DST
uint16 dmaTarget;
//$0046-0047 DMA_LEN
uint16 dmaLength;
//$0048 DMA_CTRL
uint1 dmaEnable;
uint1 dmaMode; //0 = increment; 1 = decrement
//$00b0 INT_BASE
uint8 interruptBase;
//$00b1 SER_DATA
uint8 serialData;
//$00b2 INT_ENABLE
uint8 interruptEnable;
//$00b3 SER_STATUS
uint1 serialBaudRate; //0 = 9600; 1 = 38400
uint1 serialEnable;
//$00b4 INT_STATUS
uint8 interruptStatus;
//$00b5 KEYPAD
uint1 ypadEnable;
uint1 xpadEnable;
uint1 buttonEnable;
} r;
};
extern CPU cpu;