1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

Added Super Chip emulation.

This commit is contained in:
Thomas Harte 2017-02-26 17:47:29 -05:00
parent 8b1ec827e0
commit 9d7985c1e1
2 changed files with 22 additions and 2 deletions

View File

@ -87,10 +87,23 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
}
// check for a ROM read
if((address&0x1000) && isReadOperation(operation)) {
uint16_t masked_address = address & 0x1fff;
if(address&0x1000)
{
if(isReadOperation(operation) && (!uses_superchip_ || masked_address > 0x10ff)) {
returnValue &= rom_pages_[(address >> 10)&3][address&1023];
}
// check for a Super Chip RAM access
if(uses_superchip_ && masked_address < 0x1100) {
if(masked_address < 0x1080) {
superchip_ram_[masked_address & 0x7f] = *value;
} else {
returnValue &= superchip_ram_[masked_address & 0x7f];
}
}
}
// check for a RAM access
if((address&0x1280) == 0x80) {
if(isReadOperation(operation)) {
@ -263,6 +276,8 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
rom_pages_[1] = &rom_[1024 & romMask];
rom_pages_[2] = &rom_[2048 & romMask];
rom_pages_[3] = &rom_[3072 & romMask];
uses_superchip_ = target.atari.uses_superchip;
}
#pragma mark - Audio and Video

View File

@ -56,9 +56,14 @@ class Machine:
virtual void crt_did_end_batch_of_frames(Outputs::CRT::CRT *crt, unsigned int number_of_frames, unsigned int number_of_unexpected_vertical_syncs);
private:
// ROM information
uint8_t *rom_, *rom_pages_[4];
size_t rom_size_;
// cartridge RAM expansion store
uint8_t superchip_ram_[128];
bool uses_superchip_;
// the RIOT and TIA
PIA mos6532_;
std::unique_ptr<TIA> tia_;