2012-05-21 10:56:48 +00:00
|
|
|
//Epson RTC-4513 Real-Time Clock
|
|
|
|
|
Update to v098r01 release.
byuu says:
Changelog:
- SFC: balanced profile removed
- SFC: performance profile removed
- SFC: code for handling non-threaded CPU, SMP, DSP, PPU removed
- SFC: Coprocessor, Controller (and expansion port) shared Thread code
merged to SFC::Cothread
- Cothread here just means "Thread with CPU affinity" (couldn't think
of a better name, sorry)
- SFC: CPU now has vector<Thread*> coprocessors, peripherals;
- this is the beginning of work to allow expansion port devices to be
dynamically changed at run-time
- ruby: all audio drivers default to 48000hz instead of 22050hz now if
no frequency is assigned
- note: the WASAPI driver can default to whatever the native frequency
is; doesn't have to be 48000hz
- tomoko: removed the ability to change the frequency from the UI (but
it will display the frequency used)
- tomoko: removed the timing settings panel
- the goal is to work toward smooth video via adaptive sync
- the model is broken by not being in control of the audio frequency
anyway
- it's further broken by PAL running at 50hz and WSC running at 75hz
- it was always broken anyway by SNES interlace timing varying from
progressive timing
- higan: audio/ stub created (for now, it's just nall/dsp/ moved here
and included as a header)
- higan: video/ stub created
- higan/GNUmakefile: now includes build rules for essential components
(libco, emulator, audio, video)
The audio changes are in preparation to merge wareya's awesome WASAPI
work without the need for the nall/dsp resampler.
2016-04-09 03:40:12 +00:00
|
|
|
struct EpsonRTC : Cothread {
|
2015-11-14 00:52:51 +00:00
|
|
|
static auto Enter() -> void;
|
2016-02-09 11:51:12 +00:00
|
|
|
auto main() -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto init() -> void;
|
|
|
|
auto load() -> void;
|
|
|
|
auto unload() -> void;
|
|
|
|
auto power() -> void;
|
|
|
|
auto reset() -> void;
|
|
|
|
auto sync() -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
2016-02-16 09:32:49 +00:00
|
|
|
auto read(uint24 addr, uint8 data) -> uint8;
|
|
|
|
auto write(uint24 addr, uint8 data) -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto serialize(serializer&) -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
2012-05-23 11:27:45 +00:00
|
|
|
uint21 clocks;
|
2015-11-14 00:52:51 +00:00
|
|
|
uint seconds;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
|
|
|
uint2 chipselect;
|
2015-11-14 00:52:51 +00:00
|
|
|
enum class State : uint { Mode, Seek, Read, Write } state;
|
2012-05-21 10:56:48 +00:00
|
|
|
uint4 mdr;
|
|
|
|
uint4 offset;
|
2015-11-14 00:52:51 +00:00
|
|
|
uint wait;
|
Update to v089r06 release.
[Yes, the release number is re-used. -Ed.]
byuu says:
I had some bugs in r07 that I couldn't track down, DKJM2's clock was
getting all out of sync.
So I just reverted to r05, blew away both RTCs entirely, and wrote them
cleanly from scratch (obviously looking off the old code.) A bit
extreme, but it worked.
I believe I found the error in the process, day and month were resetting
the counter to 0 instead of 1, it wasn't handling leap year, etc.
While I was at it, I fixed the day-of-week calculation. The SharpRTC
epoch is actually 1000-01-01, and not 1900-01-01.
I'm sure you guys will be really happy that if it ever becomes 1000AD
again and you're playing a ROM hack that uses the SharpRTC and relies on
its weekday value that it will show the correct day now ...
Kind of a pain to compute, but nothing compared to the seventh circle of
hell that was my IBM dBase III Julian<>Gregorian conversion functions :/
Also found a few bugs in the Epson code this way. And I moved the round
seconds actions and flag clear to +125us after flag set.
So, if you had the old r06 or r07, please delete those.
Unfortunately, this took all of my energy today, so the file names
inside manifest changes will have to be in the next WIP.
EDIT: ran a diff against old r07 and new r06.
- added if(days == 31) case twice in EpsonRTC::tick_day()
- forgot weekday = 0; in SharpRTC::load()
- need to move the cartridge+cheat objects up in sfc/Makefile again
- System::init() needs assert(interface != nullptr /* not 0 */)
2012-05-24 23:26:06 +00:00
|
|
|
uint1 ready;
|
2012-05-23 11:27:45 +00:00
|
|
|
uint1 holdtick;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
|
|
|
uint4 secondlo;
|
|
|
|
uint3 secondhi;
|
|
|
|
uint1 batteryfailure;
|
|
|
|
|
|
|
|
uint4 minutelo;
|
|
|
|
uint3 minutehi;
|
2012-05-23 11:27:45 +00:00
|
|
|
uint1 resync;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
|
|
|
uint4 hourlo;
|
|
|
|
uint2 hourhi;
|
|
|
|
uint1 meridian;
|
|
|
|
|
|
|
|
uint4 daylo;
|
|
|
|
uint2 dayhi;
|
|
|
|
uint1 dayram;
|
|
|
|
|
|
|
|
uint4 monthlo;
|
|
|
|
uint1 monthhi;
|
|
|
|
uint2 monthram;
|
|
|
|
|
|
|
|
uint4 yearlo;
|
|
|
|
uint4 yearhi;
|
|
|
|
|
|
|
|
uint3 weekday;
|
|
|
|
|
|
|
|
uint1 hold;
|
|
|
|
uint1 calendar;
|
|
|
|
uint1 irqflag;
|
|
|
|
uint1 roundseconds;
|
|
|
|
|
|
|
|
uint1 irqmask;
|
|
|
|
uint1 irqduty;
|
|
|
|
uint2 irqperiod;
|
|
|
|
|
|
|
|
uint1 pause;
|
|
|
|
uint1 stop;
|
|
|
|
uint1 atime; //astronomical time (24-hour mode)
|
|
|
|
uint1 test;
|
|
|
|
|
|
|
|
//memory.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 rtcReset() -> void;
|
|
|
|
auto rtcRead(uint4 addr) -> uint4;
|
|
|
|
auto rtcWrite(uint4 addr, uint4 data) -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto load(const uint8* data) -> void;
|
|
|
|
auto save(uint8* data) -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
|
|
|
|
//time.cpp
|
2015-11-14 00:52:51 +00:00
|
|
|
auto irq(uint2 period) -> void;
|
|
|
|
auto duty() -> void;
|
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 roundSeconds() -> void;
|
2015-11-14 00:52:51 +00:00
|
|
|
auto tick() -> void;
|
|
|
|
|
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 tickSecond() -> void;
|
|
|
|
auto tickMinute() -> void;
|
|
|
|
auto tickHour() -> void;
|
|
|
|
auto tickDay() -> void;
|
|
|
|
auto tickMonth() -> void;
|
|
|
|
auto tickYear() -> void;
|
2012-05-21 10:56:48 +00:00
|
|
|
};
|
|
|
|
|
2012-05-22 12:10:00 +00:00
|
|
|
extern EpsonRTC epsonrtc;
|