bsnes/higan/pce/vdc/vdc.hpp

154 lines
2.8 KiB
C++
Raw Normal View History

//Hudson Soft HuC6260 -- Video Color Encoder
//Hudson Soft HuC6270 -- Video Display Controller
Update to v101r30 release. byuu says: Changelog: - SMS: added cartridge ROM/RAM mirroring (fixes Alex Kidd) - SMS: fixed 8x16 sprite mode (fixes Wonder Boy, Ys graphics) - Z80: emulated "ex (sp),hl" instruction - Z80: fixed INx NF (should be set instead of cleared) - Z80: fixed loop condition check for CPxR, INxR, LDxR, OTxR (fixes walking in Wonder Boy) - SFC: removed Debugger and sfc/debugger.hpp - icarus: connected MS, GG, MD importing to the scan dialog - PCE: added emulation skeleton to higan and icarus At this point, Master System games are fairly highly compatible, sans audio. Game Gear games are running, but I need to crop the resolution and support the higher color palette that they can utilize. It's really something else the way they handled the resolution shrink on that thing. The last change is obviously going to be the biggest news. I'm very well aware it's not an ideal time to start on a new emulation core, with the MS and MD cores only just now coming to life with no audio support. But, for whatever reason, my heart's really set on working on the PC Engine. I wanted to write the final higan skeleton core, and get things ready so that whenever I'm in the mood to work on the PCE, I can do so. The skeleton is far and away the most tedious and obnoxious part of the emulator development, because it's basically all just lots of boilerplate templated code, lots of new files to create, etc. I really don't know how things are going to proceed ... but I can say with 99.9% certainty that this will be the final brand new core ever added to higan -- at least one written by me, that is. This was basically the last system from my childhood that I ever cared about. It's the last 2D system with games that I really enjoy playing. No other system is worth dividing my efforts and reducing the quality and amount of time to work on the systems I have. In the future, there will be potential for FDS, Mega CD and PCE-CD support. But those will all be add-ons, and they'll all be really difficult and challenge the entire design of higan's UI (it's entirely cartridge-driven at this time.) None of them will be entirely new cores like this one.
2017-01-11 20:27:30 +00:00
struct VDC : Thread {
static auto Enter() -> void;
auto main() -> void;
auto scanline() -> void;
Update to v101r30 release. byuu says: Changelog: - SMS: added cartridge ROM/RAM mirroring (fixes Alex Kidd) - SMS: fixed 8x16 sprite mode (fixes Wonder Boy, Ys graphics) - Z80: emulated "ex (sp),hl" instruction - Z80: fixed INx NF (should be set instead of cleared) - Z80: fixed loop condition check for CPxR, INxR, LDxR, OTxR (fixes walking in Wonder Boy) - SFC: removed Debugger and sfc/debugger.hpp - icarus: connected MS, GG, MD importing to the scan dialog - PCE: added emulation skeleton to higan and icarus At this point, Master System games are fairly highly compatible, sans audio. Game Gear games are running, but I need to crop the resolution and support the higher color palette that they can utilize. It's really something else the way they handled the resolution shrink on that thing. The last change is obviously going to be the biggest news. I'm very well aware it's not an ideal time to start on a new emulation core, with the MS and MD cores only just now coming to life with no audio support. But, for whatever reason, my heart's really set on working on the PC Engine. I wanted to write the final higan skeleton core, and get things ready so that whenever I'm in the mood to work on the PCE, I can do so. The skeleton is far and away the most tedious and obnoxious part of the emulator development, because it's basically all just lots of boilerplate templated code, lots of new files to create, etc. I really don't know how things are going to proceed ... but I can say with 99.9% certainty that this will be the final brand new core ever added to higan -- at least one written by me, that is. This was basically the last system from my childhood that I ever cared about. It's the last 2D system with games that I really enjoy playing. No other system is worth dividing my efforts and reducing the quality and amount of time to work on the systems I have. In the future, there will be potential for FDS, Mega CD and PCE-CD support. But those will all be add-ons, and they'll all be really difficult and challenge the entire design of higan's UI (it's entirely cartridge-driven at this time.) None of them will be entirely new cores like this one.
2017-01-11 20:27:30 +00:00
auto step(uint clocks) -> void;
auto refresh() -> void;
auto power() -> void;
//io.cpp
auto vramRead(uint16 addr) -> uint16;
auto vramWrite(uint16 addr, uint16 data) -> void;
auto read(uint11 addr) -> uint8;
auto write(uint11 addr, uint8 data) -> void;
Update to v101r30 release. byuu says: Changelog: - SMS: added cartridge ROM/RAM mirroring (fixes Alex Kidd) - SMS: fixed 8x16 sprite mode (fixes Wonder Boy, Ys graphics) - Z80: emulated "ex (sp),hl" instruction - Z80: fixed INx NF (should be set instead of cleared) - Z80: fixed loop condition check for CPxR, INxR, LDxR, OTxR (fixes walking in Wonder Boy) - SFC: removed Debugger and sfc/debugger.hpp - icarus: connected MS, GG, MD importing to the scan dialog - PCE: added emulation skeleton to higan and icarus At this point, Master System games are fairly highly compatible, sans audio. Game Gear games are running, but I need to crop the resolution and support the higher color palette that they can utilize. It's really something else the way they handled the resolution shrink on that thing. The last change is obviously going to be the biggest news. I'm very well aware it's not an ideal time to start on a new emulation core, with the MS and MD cores only just now coming to life with no audio support. But, for whatever reason, my heart's really set on working on the PC Engine. I wanted to write the final higan skeleton core, and get things ready so that whenever I'm in the mood to work on the PCE, I can do so. The skeleton is far and away the most tedious and obnoxious part of the emulator development, because it's basically all just lots of boilerplate templated code, lots of new files to create, etc. I really don't know how things are going to proceed ... but I can say with 99.9% certainty that this will be the final brand new core ever added to higan -- at least one written by me, that is. This was basically the last system from my childhood that I ever cared about. It's the last 2D system with games that I really enjoy playing. No other system is worth dividing my efforts and reducing the quality and amount of time to work on the systems I have. In the future, there will be potential for FDS, Mega CD and PCE-CD support. But those will all be add-ons, and they'll all be really difficult and challenge the entire design of higan's UI (it's entirely cartridge-driven at this time.) None of them will be entirely new cores like this one.
2017-01-11 20:27:30 +00:00
private:
uint32 buffer[512 * 484];
uint16 vram[0x8000];
uint16 satb[0x100];
uint9 cram[0x200];
struct State {
uint x;
uint y;
} state;
struct IRQ {
enum class Line : uint {
Collision,
Overflow,
LineCoincidence,
Vblank,
TransferVRAM,
TransferSATB,
};
//irq.cpp
auto poll() -> void;
auto raise(Line) -> void;
auto lower() -> void;
bool enableCollision;
bool enableOverflow;
bool enableLineCoincidence;
bool enableVblank;
bool enableTransferVRAM;
bool enableTransferSATB;
bool pendingCollision;
bool pendingOverflow;
bool pendingLineCoincidence;
bool pendingVblank;
bool pendingTransferVRAM;
bool pendingTransferSATB;
} irq;
struct DMA {
//dma.cpp
auto step(uint clocks) -> void;
auto vramStart() -> void;
auto satbStart() -> void;
auto satbQueue() -> void;
bool sourceIncrementMode;
bool targetIncrementMode;
bool satbRepeat;
uint16 source;
uint16 target;
uint16 length;
uint16 satbSource;
bool vramActive;
bool satbActive;
bool satbPending;
uint16 satbTarget;
} dma;
struct IO {
uint5 address;
//VDC
//$00 MAWR (W)
uint16 vramAddressWrite;
//$01 MARR (W)
uint16 vramAddressRead;
//$02 VWR (W)
//$02 VRR (R)
uint16 vramDataWrite;
uint16 vramDataRead;
//$05 CR (W)
uint2 externalSync;
bool spriteBlank;
bool backgroundBlank;
uint2 displayOutput;
bool dramRefresh;
uint vramAddressIncrement;
//$06 RCR
uint10 lineCoincidence;
//$07 BXR
uint10 backgroundHscroll;
//$08 BYR
uint9 backgroundVscroll;
//$09 MWR
uint2 vramAccess;
uint2 spriteAccess;
uint backgroundWidth;
uint backgroundHeight;
bool cgMode;
//$0a HSR
uint5 horizontalSyncWidth;
uint7 horizontalDisplayStart;
//$0b HDR
uint7 horizontalDisplayWidth;
uint7 horizontalDisplayEnd;
//$0c VPR
uint5 verticalSyncWidth;
uint8 verticalDisplayStart;
//$0d VDR
uint9 verticalDisplayWidth;
//$0e VCR
uint8 verticalDisplayEnd;
//VCE
//$00 CR
uint2 divisionRatio;
bool colorBlur;
bool grayscale;
//$02 CTA
uint9 colorAddress;
} io;
Update to v101r30 release. byuu says: Changelog: - SMS: added cartridge ROM/RAM mirroring (fixes Alex Kidd) - SMS: fixed 8x16 sprite mode (fixes Wonder Boy, Ys graphics) - Z80: emulated "ex (sp),hl" instruction - Z80: fixed INx NF (should be set instead of cleared) - Z80: fixed loop condition check for CPxR, INxR, LDxR, OTxR (fixes walking in Wonder Boy) - SFC: removed Debugger and sfc/debugger.hpp - icarus: connected MS, GG, MD importing to the scan dialog - PCE: added emulation skeleton to higan and icarus At this point, Master System games are fairly highly compatible, sans audio. Game Gear games are running, but I need to crop the resolution and support the higher color palette that they can utilize. It's really something else the way they handled the resolution shrink on that thing. The last change is obviously going to be the biggest news. I'm very well aware it's not an ideal time to start on a new emulation core, with the MS and MD cores only just now coming to life with no audio support. But, for whatever reason, my heart's really set on working on the PC Engine. I wanted to write the final higan skeleton core, and get things ready so that whenever I'm in the mood to work on the PCE, I can do so. The skeleton is far and away the most tedious and obnoxious part of the emulator development, because it's basically all just lots of boilerplate templated code, lots of new files to create, etc. I really don't know how things are going to proceed ... but I can say with 99.9% certainty that this will be the final brand new core ever added to higan -- at least one written by me, that is. This was basically the last system from my childhood that I ever cared about. It's the last 2D system with games that I really enjoy playing. No other system is worth dividing my efforts and reducing the quality and amount of time to work on the systems I have. In the future, there will be potential for FDS, Mega CD and PCE-CD support. But those will all be add-ons, and they'll all be really difficult and challenge the entire design of higan's UI (it's entirely cartridge-driven at this time.) None of them will be entirely new cores like this one.
2017-01-11 20:27:30 +00:00
};
extern VDC vdc;