2016-08-17 12:31:22 +00:00
|
|
|
//TI SN76489
|
|
|
|
|
|
|
|
struct PSG : Thread {
|
Update to v101r24 release.
byuu says:
Changelog:
- SMS: extended bus mapping of in/out ports: now decoding them fully
inside ms/bus
- SMS: moved Z80 disassembly code from processor/z80 to ms/cpu
(cosmetic)
- SMS: hooked up non-functional silent PSG sample generation, so I can
cap the framerate at 60fps
- SMS: hooked up the VDP main loop: 684 clocks/scanline, 262
scanlines/frame (no PAL support yet)
- SMS: emulated the VDP Vcounter and Hcounter polling ... hopefully
it's right, as it's very bizarre
- SMS: emulated VDP in/out ports (data read, data write, status read,
control write, register write)
- SMS: decoding and caching all VDP register flags (variable names
will probably change)
- nall: \#undef IN on Windows port (prevent compilation warning on
processor/z80)
Watching Sonic the Hedgehog, I can definitely see some VDP register
writes going through, which is a good sign.
Probably the big thing that's needed before I can get enough into the
VDP to start showing graphics is interrupt support. And interrupts are
never fun to figure out :/
What really sucks on this front is I'm flying blind on the Z80 CPU core.
Without a working VDP, I can't run any Z80 test ROMs to look for CPU
bugs. And the CPU is certainly too buggy still to run said test ROM
anyway. I can't find any SMS emulators with trace logging from reset.
Such logs vastly accelerate tracking down CPU logic bugs, so without
them, it's going to take a lot longer.
2016-12-17 11:31:34 +00:00
|
|
|
shared_pointer<Emulator::Stream> stream;
|
|
|
|
|
2016-08-17 12:31:22 +00:00
|
|
|
static auto Enter() -> void;
|
|
|
|
auto main() -> void;
|
|
|
|
auto step(uint clocks) -> void;
|
2016-08-19 14:11:26 +00:00
|
|
|
|
|
|
|
auto power() -> void;
|
2017-02-21 11:07:33 +00:00
|
|
|
|
|
|
|
//io.cpp
|
|
|
|
auto write(uint8 data) -> void;
|
|
|
|
auto balance(uint8 data) -> void;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Tone {
|
|
|
|
//tone.cpp
|
|
|
|
auto run() -> void;
|
|
|
|
auto power() -> void;
|
|
|
|
|
|
|
|
uint4 volume;
|
|
|
|
uint10 counter;
|
|
|
|
uint10 pitch;
|
|
|
|
uint1 clock;
|
|
|
|
uint1 output;
|
|
|
|
|
|
|
|
uint1 left;
|
|
|
|
uint1 right;
|
|
|
|
} tone0, tone1, tone2;
|
|
|
|
|
|
|
|
struct Noise {
|
|
|
|
//noise.cpp
|
|
|
|
auto run() -> void;
|
|
|
|
auto power() -> void;
|
|
|
|
|
|
|
|
uint4 volume;
|
|
|
|
uint6 counter;
|
|
|
|
uint1 enable;
|
|
|
|
uint2 rate;
|
|
|
|
uint16 lfsr;
|
|
|
|
uint1 clock;
|
|
|
|
uint1 output;
|
|
|
|
|
|
|
|
uint1 left;
|
|
|
|
uint1 right;
|
|
|
|
} noise;
|
|
|
|
|
|
|
|
uint3 select;
|
|
|
|
int lowpassLeft;
|
|
|
|
int lowpassRight;
|
|
|
|
uint16 levels[16];
|
2016-08-17 12:31:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern PSG psg;
|