mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Changelog: - gba/cpu: massive code cleanup effort - gba/cpu: DMA can run in between active instructions¹ - gba/cpu: added two-cycle startup delay between DMA activation and DMA transfers² - processor/spc700: BBC, BBC, CBNE cycle 4 is an idle cycle - processor/spc700: ADDW, SUBW, MOVW (read) cycle 4 is an idle cycle ¹: unfortunately, this causes yet another performance penalty for the poor GBA core =( Also, I think I may have missed disabling DMAs while the CPU is stopped. I'll fix that in the next WIP. ²: I put the waiting counter decrement at the wrong place, so this doesn't actually work. Needs to be more like this: auto CPU::step(uint clocks) -> void { for(auto _ : range(clocks)) { for(auto& timer : this->timer) timer.run(); for(auto& dma : this->dma) if(dma.active && dma.waiting) dma.waiting--; context.clock++; } ... auto CPU::DMA::run() -> bool { if(cpu.stopped() || !active || waiting) return false; transfer(); if(irq) cpu.irq.flag |= CPU::Interrupt::DMA0 << id; if(drq && id == 3) cpu.irq.flag |= CPU::Interrupt::Cartridge; return true; } Of course, the real fix will be restructuring how DMA works, so that it's always running in parallel with the CPU instead of this weird design where it tries to run all channels in some kind of loop until no channels are active anymore whenever one channel is activated. Not really sure how to design that yet, however.
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
enum class Input : uint {
|
|
A, B, Select, Start, Right, Left, Up, Down, R, L,
|
|
};
|
|
|
|
struct BIOS {
|
|
BIOS();
|
|
~BIOS();
|
|
|
|
auto read(uint mode, uint32 addr) -> uint32;
|
|
auto write(uint mode, uint32 addr, uint32 word) -> void;
|
|
|
|
uint8* data = nullptr;
|
|
uint size = 0;
|
|
uint32 mdr = 0;
|
|
};
|
|
|
|
struct System {
|
|
auto loaded() const -> bool { return _loaded; }
|
|
auto frequency() const -> double { return 16 * 1024 * 1024; }
|
|
|
|
auto init() -> void;
|
|
auto term() -> void;
|
|
auto load(Emulator::Interface*) -> bool;
|
|
auto save() -> void;
|
|
auto unload() -> void;
|
|
auto power() -> void;
|
|
auto run() -> void;
|
|
auto runToSave() -> void;
|
|
|
|
//video.cpp
|
|
auto configureVideoPalette() -> void;
|
|
auto configureVideoEffects() -> void;
|
|
|
|
//serialization.cpp
|
|
auto serialize() -> serializer;
|
|
auto unserialize(serializer&) -> bool;
|
|
|
|
auto serialize(serializer&) -> void;
|
|
auto serializeAll(serializer&) -> void;
|
|
auto serializeInit() -> void;
|
|
|
|
private:
|
|
Emulator::Interface* interface = nullptr;
|
|
|
|
struct Information {
|
|
string manifest;
|
|
} information;
|
|
|
|
bool _loaded = false;
|
|
uint _serializeSize = 0;
|
|
};
|
|
|
|
extern BIOS bios;
|
|
extern System system;
|