mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-08 18:55:14 +00:00
Merge pull request #109 from TomHarte/CBSRamPlus
Adds emulation of the CBS RAM Plus paging scheme.
This commit is contained in:
commit
4a528b9ecb
@ -68,30 +68,25 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
if(operation != CPU6502::BusOperation::Ready) {
|
if(operation != CPU6502::BusOperation::Ready) {
|
||||||
uint16_t masked_address = address & 0x1fff;
|
uint16_t masked_address = address & 0x1fff;
|
||||||
|
|
||||||
|
#define AtariPager(start, end) \
|
||||||
|
if(masked_address >= start && masked_address <= end) { \
|
||||||
|
uint8_t *base_ptr = &rom_[(masked_address - start) * 4096];\
|
||||||
|
if(base_ptr != rom_pages_[0]) {\
|
||||||
|
rom_pages_[0] = base_ptr;\
|
||||||
|
rom_pages_[1] = base_ptr + 1024;\
|
||||||
|
rom_pages_[2] = base_ptr + 2048;\
|
||||||
|
rom_pages_[3] = base_ptr + 3072;\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
// check for potential paging
|
// check for potential paging
|
||||||
switch(paging_model_) {
|
switch(paging_model_) {
|
||||||
default:
|
default:
|
||||||
// check for an Atari paging access
|
|
||||||
if(rom_size_ > 4096 && ((address & 0x1f00) == 0x1f00)) {
|
|
||||||
uint8_t *base_ptr = rom_pages_[0];
|
|
||||||
uint8_t first_paging_register = (uint8_t)(0xf8 - (rom_size_ >> 14)*2);
|
|
||||||
|
|
||||||
const uint8_t paging_register = address&0xff;
|
|
||||||
if(paging_register >= first_paging_register) {
|
|
||||||
const uint16_t selected_page = paging_register - first_paging_register;
|
|
||||||
if(selected_page * 4096 < rom_size_) {
|
|
||||||
base_ptr = &rom_[selected_page * 4096];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(base_ptr != rom_pages_[0]) {
|
|
||||||
rom_pages_[0] = base_ptr;
|
|
||||||
rom_pages_[1] = base_ptr + 1024;
|
|
||||||
rom_pages_[2] = base_ptr + 2048;
|
|
||||||
rom_pages_[3] = base_ptr + 3072;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case StaticAnalyser::Atari2600PagingModel::Atari8k: AtariPager(0x1ff8, 0x1ff9); break;
|
||||||
|
case StaticAnalyser::Atari2600PagingModel::CBSRamPlus: AtariPager(0x1ff8, 0x1ffa); break;
|
||||||
|
case StaticAnalyser::Atari2600PagingModel::Atari16k: AtariPager(0x1ff6, 0x1ff9); break;
|
||||||
|
case StaticAnalyser::Atari2600PagingModel::Atari32k: AtariPager(0x1ff4, 0x1ffb); break;
|
||||||
case StaticAnalyser::Atari2600PagingModel::ParkerBros:
|
case StaticAnalyser::Atari2600PagingModel::ParkerBros:
|
||||||
if(masked_address >= 0x1fe0 && masked_address < 0x1ff8) {
|
if(masked_address >= 0x1fe0 && masked_address < 0x1ff8) {
|
||||||
int slot = (masked_address >> 3) & 3;
|
int slot = (masked_address >> 3) & 3;
|
||||||
@ -101,6 +96,8 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef AtariPager
|
||||||
|
|
||||||
// check for a ROM read
|
// check for a ROM read
|
||||||
if(address&0x1000)
|
if(address&0x1000)
|
||||||
{
|
{
|
||||||
@ -319,6 +316,13 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case StaticAnalyser::Atari2600PagingModel::CBSRamPlus:
|
||||||
|
ram_.resize(256);
|
||||||
|
has_ram_ = true;
|
||||||
|
ram_write_start_ = 0x1000;
|
||||||
|
ram_read_start_ = 0x1100;
|
||||||
|
break;
|
||||||
|
|
||||||
case StaticAnalyser::Atari2600PagingModel::CommaVid:
|
case StaticAnalyser::Atari2600PagingModel::CommaVid:
|
||||||
ram_.resize(1024);
|
ram_.resize(1024);
|
||||||
has_ram_ = true;
|
has_ram_ = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user