2017-03-18 18:46:46 +00:00
|
|
|
//
|
|
|
|
// CartridgeCommaVid.h
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 18/03/2017.
|
|
|
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Atari2600_CartridgeCommaVid_hpp
|
|
|
|
#define Atari2600_CartridgeCommaVid_hpp
|
|
|
|
|
2017-08-16 16:57:32 +00:00
|
|
|
#include "Cartridge.hpp"
|
|
|
|
|
2017-03-18 18:46:46 +00:00
|
|
|
namespace Atari2600 {
|
2017-08-16 15:56:52 +00:00
|
|
|
namespace Cartridge {
|
2017-03-18 18:46:46 +00:00
|
|
|
|
2017-08-16 16:39:15 +00:00
|
|
|
class CommaVid: public BusExtender {
|
2017-03-18 18:46:46 +00:00
|
|
|
public:
|
2017-11-11 20:28:40 +00:00
|
|
|
CommaVid(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
2017-08-16 16:57:32 +00:00
|
|
|
|
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 18:46:46 +00:00
|
|
|
if(!(address & 0x1000)) return;
|
|
|
|
address &= 0x1fff;
|
|
|
|
|
|
|
|
if(address < 0x1400) {
|
|
|
|
if(isReadOperation(operation)) *value = ram_[address & 1023];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(address < 0x1800) {
|
|
|
|
ram_[address & 1023] = *value;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-16 16:39:15 +00:00
|
|
|
if(isReadOperation(operation)) *value = rom_base_[address & 2047];
|
2017-03-18 18:46:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t ram_[1024];
|
|
|
|
};
|
|
|
|
|
2017-08-16 15:56:52 +00:00
|
|
|
}
|
2017-03-18 18:46:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Atari2600_CartridgeCommaVid_hpp */
|