2012-04-01 01:41:15 +00:00
|
|
|
struct CPU : Processor::ARM, Thread, MMIO {
|
2015-06-27 02:38:08 +00:00
|
|
|
using ARM::read;
|
|
|
|
using ARM::write;
|
|
|
|
|
Update to v097r17 release.
byuu says:
Changelog:
- ruby: if DirectSoundCreate fails (no sound device present), return
false from init instead of crashing
- nall: improved edge case return values for
(basename,pathname,dirname,...)
- nall: renamed file_system_object class to inode
- nall: varuint_t replaced with VariadicNatural; which contains
.bit,.bits,.byte ala Natural/Integer
- nall: fixed boolean compilation error on Windows
- WS: popa should not restore SP
- GBA: rewrote the CPU/APU cores to use the .bit,.bits functions;
removed registers.cpp from each
Note that the GBA changes are extremely major. This is about five hours
worth of extremely delicate work. Any slight errors could break
emulation in extremely bad ways. Let's hold off on extensive testing
until the next WIP, after I do the same to the PPU.
So far ... endrift's SOUNDCNT_X I/O test is failing, although that code
didn't change, so clearly I messed up SOUNDCNT_H somehow ...
To compile on Windows:
1. change nall/string/platform.hpp line 47 to
return slice(result, 0, 3);
2. change ruby/video.wgl.cpp line 72 to
auto lock(uint32_t*& data, uint& pitch, uint width, uint height) -> bool {
3. add this line to the very top of hiro/windows/header.cpp:
#define boolean FuckYouMicrosoft
2016-02-23 11:08:44 +00:00
|
|
|
struct Interrupt {
|
|
|
|
enum : uint {
|
|
|
|
VBlank = 0x0001,
|
|
|
|
HBlank = 0x0002,
|
|
|
|
VCoincidence = 0x0004,
|
|
|
|
Timer0 = 0x0008,
|
|
|
|
Timer1 = 0x0010,
|
|
|
|
Timer2 = 0x0020,
|
|
|
|
Timer3 = 0x0040,
|
|
|
|
Serial = 0x0080,
|
|
|
|
DMA0 = 0x0100,
|
|
|
|
DMA1 = 0x0200,
|
|
|
|
DMA2 = 0x0400,
|
|
|
|
DMA3 = 0x0800,
|
|
|
|
Keypad = 0x1000,
|
|
|
|
Cartridge = 0x2000,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2012-03-29 11:58:10 +00:00
|
|
|
#include "registers.hpp"
|
2015-06-27 02:38:08 +00:00
|
|
|
#include "prefetch.hpp"
|
2012-04-03 23:50:40 +00:00
|
|
|
#include "state.hpp"
|
2012-03-19 11:19:53 +00:00
|
|
|
|
2015-06-25 09:52:32 +00:00
|
|
|
//cpu.cpp
|
2015-11-16 08:38:05 +00:00
|
|
|
CPU();
|
|
|
|
~CPU();
|
|
|
|
|
2015-06-25 09:52:32 +00:00
|
|
|
static auto Enter() -> void;
|
|
|
|
auto main() -> void;
|
2012-03-19 11:19:53 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto step(uint clocks) -> void override;
|
2012-03-19 11:19:53 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto sync_step(uint clocks) -> void;
|
2015-06-25 09:52:32 +00:00
|
|
|
auto keypad_run() -> void;
|
|
|
|
auto power() -> void;
|
Update to v087r08 release.
byuu says:
Added some more ARM opcodes, hooked up MMIO. Bind it with mmio[(addr
000-3ff)] = this; inside CPU/PPU/APU, goes to read(), write().
Also moved the Hitachi HG51B core to processor/, and split it apart from
the snes/chip/hitachidsp implementation.
This one actually worked really well. Very clean split between MMIO/DMA
and the processor core. I may move a more generic DMA function inside
the core, not sure yet.
I still believe the HG51B169 to be a variant of the HG51BS family, but
given they're meant to be incredibly flexible microcontrollers, it's
possible that each variant gets its own instruction set.
So, who knows. We'll worry about it if we ever find another HG51B DSP,
I guess.
GBA BIOS is constantly reading from 04000300, but it never writes. If
I return prng()&1, I can get it to proceed until it hits a bad opcode
(stc opcode, which the GBA lacks a coprocessor so ... bad codepath.)
Without it, it just reads that register forever and keeps resetting the
system, or something ...
I guess we're going to have to try and get ARMwrestler working, because
the BIOS seems to need too much emulation code to do anything at all.
2012-03-24 07:52:36 +00:00
|
|
|
|
2015-07-01 10:58:42 +00:00
|
|
|
//bus.cpp
|
Update to v098r06 release.
byuu says:
Changelog:
- emulation cores now refresh video from host thread instead of
cothreads (fix AMD crash)
- SFC: fixed another bug with leap year months in SharpRTC emulation
- SFC: cleaned up camelCase on function names for
armdsp,epsonrtc,hitachidsp,mcc,nss,sharprtc classes
- GB: added MBC1M emulation (requires manually setting mapper=MBC1M in
manifest.bml for now, sorry)
- audio: implemented Emulator::Audio mixer and effects processor
- audio: implemented Emulator::Stream interface
- it is now possible to have more than two audio streams: eg SNES
+ SGB + MSU1 + Voicer-Kun (eventually)
- audio: added reverb delay + reverb level settings; exposed balance
configuration in UI
- video: reworked palette generation to re-enable saturation, gamma,
luminance adjustments
- higan/emulator.cpp is gone since there was nothing left in it
I know you guys are going to say the color adjust/balance/reverb stuff
is pointless. And indeed it mostly is. But I like the idea of allowing
some fun special effects and configurability that isn't system-wide.
Note: there seems to be some kind of added audio lag in the SGB
emulation now, and I don't really understand why. The code should be
effectively identical to what I had before. The only main thing is that
I'm sampling things to 48000hz instead of 32040hz before mixing. There's
no point where I'm intentionally introducing added latency though. I'm
kind of stumped, so if anyone wouldn't mind taking a look at it, it'd be
much appreciated :/
I don't have an MSU1 test ROM, but the latency issue may affect MSU1 as
well, and that would be very bad.
2016-04-22 13:35:51 +00:00
|
|
|
auto busIdle() -> void override;
|
|
|
|
auto busRead(uint mode, uint32 addr) -> uint32 override;
|
|
|
|
auto busWrite(uint mode, uint32 addr, uint32 word) -> void override;
|
|
|
|
auto busWait(uint mode, uint32 addr) -> uint;
|
2015-07-01 10:58:42 +00:00
|
|
|
|
2015-06-25 09:52:32 +00:00
|
|
|
//mmio.cpp
|
|
|
|
auto read(uint32 addr) -> uint8;
|
|
|
|
auto write(uint32 addr, uint8 byte) -> void;
|
Update to v087r26 release.
byuu says:
Changelog:
- fixed FIFO[1] reset behavior (fixes audio in Sword of Mana)
- added FlashROM emulation (both sizes)
- GBA parses RAM settings from manifest.xml now
- save RAM is written to disk now
- added save state support (it's currently broken, though)
- fixed ROM/RAM access timings
- open bus should mostly work (we don't do the PC+12 stuff yet)
- emulated the undocumented memory control register (mirror IWRAM,
disable I+EWRAM, EWRAM wait state count)
- emulated keypad interrupts
- emulated STOP (freezes video, audio, DMA and timers; only breaks on
keypad IRQs)
- probably a lot more, it was a long night ...
Show stoppers, missing things, broken things, etc:
- ST018 is still completely broken
- GBC audio sequencer apparently needs work
- GBA audio FIFO buffer seems too quiet
- PHI / ROM prefetch needs to be emulated (no idea on how to do this,
especially PHI)
- SOUNDBIAS 64/128/256khz modes should output at that resolution
(really, we need to simulate PWM properly, no idea on how to do this)
- object mosaic top-left coordinates are wrong (minor, fixing will
actually make the effect look worse)
- need to emulate PPU greenswap and color palette distortion (no idea on
how do this)
- need GBA save type database (I would also LIKE to blacklist
/ patch-out trainers, but that's a discussion for another day.)
- some ARM ops advance the prefetch buffer, so you can read PC+12 in
some cases
2012-04-16 12:19:39 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto iwram_read(uint mode, uint32 addr) -> uint32;
|
|
|
|
auto iwram_write(uint mode, uint32 addr, uint32 word) -> void;
|
2012-04-07 08:17:49 +00:00
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto ewram_read(uint mode, uint32 addr) -> uint32;
|
|
|
|
auto ewram_write(uint mode, uint32 addr, uint32 word) -> void;
|
2012-04-03 23:50:40 +00:00
|
|
|
|
2015-06-25 09:52:32 +00:00
|
|
|
//dma.cpp
|
|
|
|
auto dma_run() -> void;
|
|
|
|
auto dma_exec(Registers::DMA& dma) -> void;
|
|
|
|
auto dma_vblank() -> void;
|
|
|
|
auto dma_hblank() -> void;
|
|
|
|
auto dma_hdma() -> void;
|
|
|
|
|
|
|
|
//timer.cpp
|
2015-11-16 08:38:05 +00:00
|
|
|
auto timer_step(uint clocks) -> void;
|
|
|
|
auto timer_increment(uint n) -> void;
|
|
|
|
auto timer_fifo_run(uint n) -> void;
|
2015-06-25 09:52:32 +00:00
|
|
|
|
|
|
|
//serialization.cpp
|
|
|
|
auto serialize(serializer&) -> void;
|
2015-11-16 08:38:05 +00:00
|
|
|
|
|
|
|
uint8* iwram = nullptr;
|
|
|
|
uint8* ewram = nullptr;
|
2012-03-19 11:19:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CPU cpu;
|