1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-12 15:31:09 +00:00

Reinstated the Activision stack pager.

This commit is contained in:
Thomas Harte 2017-03-18 18:03:48 -04:00
parent e0bca1e37b
commit a4cd12394e
3 changed files with 63 additions and 6 deletions

View File

@ -10,11 +10,12 @@
#include <algorithm>
#include <stdio.h>
#include "CartridgeUnpaged.hpp"
#include "CartridgeCommaVid.hpp"
#include "CartridgeAtari8k.hpp"
#include "CartridgeAtari16k.hpp"
#include "CartridgeAtari32k.hpp"
#include "CartridgeActivisionStack.hpp"
#include "CartridgeCommaVid.hpp"
#include "CartridgeUnpaged.hpp"
using namespace Atari2600;
namespace {
@ -104,6 +105,9 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
bus_.reset(new CartridgeAtari32k(target.cartridges.front()->get_segments().front().data));
}
break;
case StaticAnalyser::Atari2600PagingModel::ActivisionStack:
bus_.reset(new CartridgeActivisionStack(target.cartridges.front()->get_segments().front().data));
break;
}
/* if(!target.cartridges.front()->get_segments().size()) return;

View File

@ -0,0 +1,47 @@
//
// CartridgeActivisionStack.h
// Clock Signal
//
// Created by Thomas Harte on 18/03/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#ifndef Atari2600_CartridgeActivisionStack_hpp
#define Atari2600_CartridgeActivisionStack_hpp
namespace Atari2600 {
class CartridgeActivisionStack: public Cartridge<CartridgeActivisionStack> {
public:
CartridgeActivisionStack(const std::vector<uint8_t> &rom) :
Cartridge(rom),
last_opcode_(0x00) {
rom_ptr_ = rom_.data();
}
void perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) {
if(!(address & 0x1000)) return;
if(operation == CPU6502::BusOperation::ReadOpcode && (last_opcode_ == 0x20 || last_opcode_ == 0x60)) {
if(address & 0x2000) {
rom_ptr_ = rom_.data();
} else {
rom_ptr_ = rom_.data() + 4096;
}
}
if(isReadOperation(operation)) {
*value = rom_ptr_[address & 4095];
}
if(operation == CPU6502::BusOperation::ReadOpcode) last_opcode_ = *value;
}
private:
uint8_t *rom_ptr_;
uint8_t last_opcode_;
};
}
#endif /* Atari2600_CartridgeActivisionStack_hpp */

View File

@ -944,6 +944,9 @@
4BEA52641DF3472B007E74F2 /* Speaker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Speaker.cpp; sourceTree = "<group>"; };
4BEA52651DF3472B007E74F2 /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = "<group>"; };
4BEA52671DF34909007E74F2 /* PIA.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = PIA.hpp; sourceTree = "<group>"; };
4BEAC0781E7DD86E00EE56B2 /* CartridgeAtari16k.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CartridgeAtari16k.hpp; sourceTree = "<group>"; };
4BEAC0791E7DD86E00EE56B2 /* CartridgeAtari32k.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CartridgeAtari32k.hpp; sourceTree = "<group>"; };
4BEAC07A1E7DDFDA00EE56B2 /* CartridgeActivisionStack.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CartridgeActivisionStack.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>"; };
@ -1111,13 +1114,16 @@
4BE7C9161E3D397100A5496D /* TIA.cpp */,
4B2E2D991C3A06EC00138695 /* Atari2600Inputs.h */,
4B2E2D981C3A06EC00138695 /* Atari2600.hpp */,
4BE069991E7C942C00DD379F /* Cartridge.hpp */,
4BEAC07A1E7DDFDA00EE56B2 /* CartridgeActivisionStack.hpp */,
4BA443E81E7DB8F900C86749 /* CartridgeAtari8k.hpp */,
4BEAC0781E7DD86E00EE56B2 /* CartridgeAtari16k.hpp */,
4BEAC0791E7DD86E00EE56B2 /* CartridgeAtari32k.hpp */,
4BA443E71E7DB54700C86749 /* CartridgeCommaVid.hpp */,
4BE0699A1E7C9C5A00DD379F /* CartridgeUnpaged.hpp */,
4BEA52671DF34909007E74F2 /* PIA.hpp */,
4BEA52651DF3472B007E74F2 /* Speaker.hpp */,
4BE7C9171E3D397100A5496D /* TIA.hpp */,
4BE069991E7C942C00DD379F /* Cartridge.hpp */,
4BE0699A1E7C9C5A00DD379F /* CartridgeUnpaged.hpp */,
4BA443E71E7DB54700C86749 /* CartridgeCommaVid.hpp */,
4BA443E81E7DB8F900C86749 /* CartridgeAtari8k.hpp */,
);
path = Atari2600;
sourceTree = "<group>";