1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-11 19:29:39 +00:00

Extended to emulate the CommaVid.

This commit is contained in:
Thomas Harte 2017-02-27 20:50:59 -05:00
parent 8f8b103224
commit 184c8ae707
2 changed files with 34 additions and 12 deletions

View File

@ -90,17 +90,20 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
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 RAM access
bool was_ram_access = false;
if(has_ram_) {
if(masked_address >= ram_write_start_ && masked_address < ram_.size() + ram_write_start_) {
ram_[masked_address & ram_.size() - 1] = *value;
was_ram_access = true;
} else if(masked_address >= ram_read_start_ && masked_address < ram_.size() + ram_read_start_) {
returnValue &= ram_[masked_address & ram_.size() - 1];
was_ram_access = true;
}
}
// 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];
}
if(isReadOperation(operation) && !was_ram_access) {
returnValue &= rom_pages_[(address >> 10)&3][address&1023];
}
}
@ -277,7 +280,25 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
rom_pages_[2] = &rom_[2048 & romMask];
rom_pages_[3] = &rom_[3072 & romMask];
uses_superchip_ = target.atari.uses_superchip;
switch(target.atari.paging_model)
{
default:
if(target.atari.uses_superchip)
{
ram_.resize(128);
has_ram_ = true;
ram_write_start_ = 0x1000;
ram_read_start_ = 0x1080;
}
break;
case StaticAnalyser::Atari2600PagingModel::CommaVid:
ram_.resize(1024);
has_ram_ = true;
ram_write_start_ = 0x1400;
ram_read_start_ = 0x1000;
break;
}
}
#pragma mark - Audio and Video

View File

@ -61,8 +61,9 @@ class Machine:
size_t rom_size_;
// cartridge RAM expansion store
uint8_t superchip_ram_[128];
bool uses_superchip_;
std::vector<uint8_t> ram_;
uint16_t ram_write_start_, ram_read_start_;
bool has_ram_;
// the RIOT and TIA
PIA mos6532_;