2017-03-18 22:21:01 +00:00
|
|
|
//
|
|
|
|
// CartridgeParkerBros.h
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 18/03/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-03-18 22:21:01 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Atari2600_CartridgeParkerBros_hpp
|
|
|
|
#define Atari2600_CartridgeParkerBros_hpp
|
|
|
|
|
|
|
|
#include "Cartridge.hpp"
|
|
|
|
|
|
|
|
namespace Atari2600 {
|
2017-08-16 15:56:52 +00:00
|
|
|
namespace Cartridge {
|
2017-03-18 22:21:01 +00:00
|
|
|
|
2017-08-16 16:39:15 +00:00
|
|
|
class ParkerBros: public BusExtender {
|
2017-03-18 22:21:01 +00:00
|
|
|
public:
|
2017-11-11 20:28:40 +00:00
|
|
|
ParkerBros(uint8_t *rom_base, std::size_t rom_size) :
|
2017-08-16 16:39:15 +00:00
|
|
|
BusExtender(rom_base, rom_size) {
|
|
|
|
rom_ptr_[0] = rom_base + 4096;
|
2017-03-18 22:21:01 +00:00
|
|
|
rom_ptr_[1] = rom_ptr_[0] + 1024;
|
|
|
|
rom_ptr_[2] = rom_ptr_[1] + 1024;
|
|
|
|
rom_ptr_[3] = rom_ptr_[2] + 1024;
|
|
|
|
}
|
|
|
|
|
2017-05-15 02:08:15 +00:00
|
|
|
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
2017-03-18 22:21:01 +00:00
|
|
|
address &= 0x1fff;
|
|
|
|
if(!(address & 0x1000)) return;
|
|
|
|
|
|
|
|
if(address >= 0x1fe0 && address < 0x1ff8) {
|
|
|
|
int slot = (address >> 3)&3;
|
2017-08-16 16:39:15 +00:00
|
|
|
rom_ptr_[slot] = rom_base_ + ((address & 7) * 1024);
|
2017-03-18 22:21:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(isReadOperation(operation)) {
|
|
|
|
*value = rom_ptr_[(address >> 10)&3][address & 1023];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t *rom_ptr_[4];
|
|
|
|
};
|
|
|
|
|
2017-08-16 15:56:52 +00:00
|
|
|
}
|
2017-03-18 22:21:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Atari2600_CartridgeParkerBros_hpp */
|