1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

CBS RAM Plus returns.

This commit is contained in:
Thomas Harte 2017-03-18 18:56:20 -04:00
parent 0b611a14b9
commit 217fbf257e
3 changed files with 58 additions and 24 deletions

View File

@ -14,6 +14,7 @@
#include "CartridgeAtari16k.hpp"
#include "CartridgeAtari32k.hpp"
#include "CartridgeActivisionStack.hpp"
#include "CartridgeCBSRAMPlus.hpp"
#include "CartridgeCommaVid.hpp"
#include "CartridgeParkerBros.hpp"
#include "CartridgeTigervision.hpp"
@ -83,6 +84,10 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
switch(target.atari.paging_model) {
case StaticAnalyser::Atari2600PagingModel::None: bus_.reset(new CartridgeUnpaged(rom)); break;
case StaticAnalyser::Atari2600PagingModel::CommaVid: bus_.reset(new CartridgeCommaVid(rom)); break;
case StaticAnalyser::Atari2600PagingModel::ActivisionStack: bus_.reset(new CartridgeActivisionStack(rom)); break;
case StaticAnalyser::Atari2600PagingModel::ParkerBros: bus_.reset(new CartridgeParkerBros(rom)); break;
case StaticAnalyser::Atari2600PagingModel::Tigervision: bus_.reset(new CartridgeTigervision(rom)); break;
case StaticAnalyser::Atari2600PagingModel::CBSRamPlus: bus_.reset(new CartridgeCBSRAMPlus(rom)); break;
case StaticAnalyser::Atari2600PagingModel::Atari8k:
if(target.atari.uses_superchip) {
bus_.reset(new CartridgeAtari8kSuperChip(rom));
@ -92,38 +97,21 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
break;
case StaticAnalyser::Atari2600PagingModel::Atari16k:
if(target.atari.uses_superchip) {
bus_.reset(new CartridgeAtari16kSuperChip(target.cartridges.front()->get_segments().front().data));
bus_.reset(new CartridgeAtari16kSuperChip(rom));
} else {
bus_.reset(new CartridgeAtari16k(target.cartridges.front()->get_segments().front().data));
bus_.reset(new CartridgeAtari16k(rom));
}
break;
case StaticAnalyser::Atari2600PagingModel::Atari32k:
if(target.atari.uses_superchip) {
bus_.reset(new CartridgeAtari32kSuperChip(target.cartridges.front()->get_segments().front().data));
bus_.reset(new CartridgeAtari32kSuperChip(rom));
} else {
bus_.reset(new CartridgeAtari32k(target.cartridges.front()->get_segments().front().data));
bus_.reset(new CartridgeAtari32k(rom));
}
break;
case StaticAnalyser::Atari2600PagingModel::ActivisionStack:
bus_.reset(new CartridgeActivisionStack(target.cartridges.front()->get_segments().front().data));
break;
case StaticAnalyser::Atari2600PagingModel::ParkerBros:
bus_.reset(new CartridgeParkerBros(rom));
break;
case StaticAnalyser::Atari2600PagingModel::Tigervision:
bus_.reset(new CartridgeTigervision(rom));
break;
}
/* switch(target.atari.paging_model) {
case StaticAnalyser::Atari2600PagingModel::CBSRamPlus:
// allocate 256 bytes of RAM; allow writing from 0x1000, reading from 0x1100
ram_.resize(256);
ram_write_targets_[0] = ram_.data();
ram_write_targets_[1] = ram_write_targets_[0] + 128;
ram_read_targets_[2] = ram_write_targets_[0];
ram_read_targets_[3] = ram_write_targets_[1];
break;
case StaticAnalyser::Atari2600PagingModel::MegaBoy:
mega_boy_page_ = 15;
break;

View File

@ -0,0 +1,44 @@
//
// CartridgeCBSRAMPlus.h
// Clock Signal
//
// Created by Thomas Harte on 18/03/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#ifndef Atari2600_CartridgeCBSRAMPlus_hpp
#define Atari2600_CartridgeCBSRAMPlus_hpp
#include "Cartridge.hpp"
namespace Atari2600 {
class CartridgeCBSRAMPlus: public Cartridge<CartridgeCBSRAMPlus> {
public:
CartridgeCBSRAMPlus(const std::vector<uint8_t> &rom) :
Cartridge(rom) {
rom_ptr_ = rom_.data();
}
void perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) {
address &= 0x1fff;
if(!(address & 0x1000)) return;
if(address >= 0x1ff8 && address <= 0x1ffa) rom_ptr_ = rom_.data() + (address - 0x1ff8) * 4096;
if(isReadOperation(operation)) {
*value = rom_ptr_[address & 4095];
}
if(address < 0x1100) ram_[address & 0xff] = *value;
else if(address < 0x1200 && isReadOperation(operation)) *value = ram_[address & 0xff];
}
private:
uint8_t *rom_ptr_;
uint8_t ram_[256];
};
}
#endif /* Atari2600_CartridgeCBSRAMPlus_hpp */

View File

@ -949,6 +949,7 @@
4BEAC07A1E7DDFDA00EE56B2 /* CartridgeActivisionStack.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CartridgeActivisionStack.hpp; sourceTree = "<group>"; };
4BEAC07B1E7DE74200EE56B2 /* CartridgeParkerBros.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CartridgeParkerBros.hpp; sourceTree = "<group>"; };
4BEAC07C1E7DEA6B00EE56B2 /* CartridgeTigervision.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CartridgeTigervision.hpp; sourceTree = "<group>"; };
4BEAC07D1E7DF13E00EE56B2 /* CartridgeCBSRAMPlus.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CartridgeCBSRAMPlus.hpp; sourceTree = "<group>"; };
4BEE0A6A1D72496600532C7B /* Cartridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cartridge.cpp; sourceTree = "<group>"; };
4BEE0A6B1D72496600532C7B /* Cartridge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = "<group>"; };
4BEE0A6D1D72496600532C7B /* PRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PRG.cpp; sourceTree = "<group>"; };
@ -1121,13 +1122,14 @@
4BA443E81E7DB8F900C86749 /* CartridgeAtari8k.hpp */,
4BEAC0781E7DD86E00EE56B2 /* CartridgeAtari16k.hpp */,
4BEAC0791E7DD86E00EE56B2 /* CartridgeAtari32k.hpp */,
4BEAC07D1E7DF13E00EE56B2 /* CartridgeCBSRAMPlus.hpp */,
4BA443E71E7DB54700C86749 /* CartridgeCommaVid.hpp */,
4BEAC07B1E7DE74200EE56B2 /* CartridgeParkerBros.hpp */,
4BEAC07C1E7DEA6B00EE56B2 /* CartridgeTigervision.hpp */,
4BE0699A1E7C9C5A00DD379F /* CartridgeUnpaged.hpp */,
4BEA52671DF34909007E74F2 /* PIA.hpp */,
4BEA52651DF3472B007E74F2 /* Speaker.hpp */,
4BE7C9171E3D397100A5496D /* TIA.hpp */,
4BEAC07C1E7DEA6B00EE56B2 /* CartridgeTigervision.hpp */,
);
path = Atari2600;
sourceTree = "<group>";