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

Re-emplaced the MegaBoy. Also cut detritus from the main Atari header.

This commit is contained in:
Thomas Harte 2017-03-18 19:02:34 -04:00
parent 217fbf257e
commit c31d85f820
4 changed files with 50 additions and 20 deletions

View File

@ -16,6 +16,7 @@
#include "CartridgeActivisionStack.hpp"
#include "CartridgeCBSRAMPlus.hpp"
#include "CartridgeCommaVid.hpp"
#include "CartridgeMegaBoy.hpp"
#include "CartridgeParkerBros.hpp"
#include "CartridgeTigervision.hpp"
#include "CartridgeUnpaged.hpp"
@ -27,8 +28,6 @@ namespace {
}
Machine::Machine() :
rom_(nullptr),
rom_pages_{nullptr, nullptr, nullptr, nullptr},
frame_record_pointer_(0),
is_ntsc_(true) {
set_clock_rate(NTSC_clock_rate);
@ -88,6 +87,7 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
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::MegaBoy: bus_.reset(new CartridgeMegaBoy(rom)); break;
case StaticAnalyser::Atari2600PagingModel::Atari8k:
if(target.atari.uses_superchip) {
bus_.reset(new CartridgeAtari8kSuperChip(rom));
@ -112,9 +112,6 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
}
/* switch(target.atari.paging_model) {
case StaticAnalyser::Atari2600PagingModel::MegaBoy:
mega_boy_page_ = 15;
break;
case StaticAnalyser::Atari2600PagingModel::MNetwork:
ram_.resize(2048);
// Put 256 bytes of RAM for writing at 0x1800 and reading at 0x1900

View File

@ -53,21 +53,7 @@ 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_;
size_t rom_size_;
// Memory model
uint8_t *rom_pages_[4], *ram_write_targets_[32], *ram_read_targets_[32];
uint8_t mega_boy_page_;
StaticAnalyser::Atari2600PagingModel paging_model_;
std::vector<uint8_t> ram_;
uint8_t throwaway_ram_[128];
// Activision stack records
uint8_t last_opcode_;
// the cartridge
// the bus
std::unique_ptr<Bus> bus_;
// output frame rate tracker

View File

@ -0,0 +1,45 @@
//
// CartridgeMegaBoy.h
// Clock Signal
//
// Created by Thomas Harte on 18/03/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#ifndef Atari2600_CartridgeMegaBoy_hpp
#define Atari2600_CartridgeMegaBoy_hpp
#include "Cartridge.hpp"
namespace Atari2600 {
class CartridgeMegaBoy: public Cartridge<CartridgeMegaBoy> {
public:
CartridgeMegaBoy(const std::vector<uint8_t> &rom) :
Cartridge(rom),
current_page_(0) {
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 == 0x1ff0) {
current_page_ = (current_page_ + 1) & 15;
rom_ptr_ = rom_.data() + current_page_ * 4096;
}
if(isReadOperation(operation)) {
*value = rom_ptr_[address & 4095];
}
}
private:
uint8_t *rom_ptr_;
uint8_t current_page_;
};
}
#endif /* CartridgeMegaBoy_h */

View File

@ -950,6 +950,7 @@
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>"; };
4BEAC07E1E7DF2D000EE56B2 /* CartridgeMegaBoy.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CartridgeMegaBoy.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>"; };
@ -1124,6 +1125,7 @@
4BEAC0791E7DD86E00EE56B2 /* CartridgeAtari32k.hpp */,
4BEAC07D1E7DF13E00EE56B2 /* CartridgeCBSRAMPlus.hpp */,
4BA443E71E7DB54700C86749 /* CartridgeCommaVid.hpp */,
4BEAC07E1E7DF2D000EE56B2 /* CartridgeMegaBoy.hpp */,
4BEAC07B1E7DE74200EE56B2 /* CartridgeParkerBros.hpp */,
4BEAC07C1E7DEA6B00EE56B2 /* CartridgeTigervision.hpp */,
4BE0699A1E7C9C5A00DD379F /* CartridgeUnpaged.hpp */,