2017-03-18 14:46:46 -04:00
|
|
|
//
|
|
|
|
// CartridgeCommaVid.h
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 18/03/2017.
|
2018-05-13 15:19:52 -04:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-03-18 14:46:46 -04:00
|
|
|
//
|
|
|
|
|
2024-01-16 23:34:46 -05:00
|
|
|
#pragma once
|
2017-03-18 14:46:46 -04:00
|
|
|
|
2017-08-16 12:57:32 -04:00
|
|
|
#include "Cartridge.hpp"
|
|
|
|
|
2023-05-10 16:02:18 -05:00
|
|
|
namespace Atari2600::Cartridge {
|
2017-03-18 14:46:46 -04:00
|
|
|
|
2017-08-16 12:39:15 -04:00
|
|
|
class CommaVid: public BusExtender {
|
2024-12-01 21:44:14 -05:00
|
|
|
public:
|
|
|
|
CommaVid(const uint8_t *const rom_base, const std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
|
|
|
|
|
|
|
void perform_bus_operation(
|
|
|
|
const CPU::MOS6502::BusOperation operation,
|
|
|
|
uint16_t address,
|
|
|
|
uint8_t *const value
|
|
|
|
) {
|
|
|
|
if(!(address & 0x1000)) return;
|
|
|
|
address &= 0x1fff;
|
|
|
|
|
|
|
|
if(address < 0x1400) {
|
|
|
|
if(isReadOperation(operation)) *value = ram_[address & 1023];
|
|
|
|
return;
|
|
|
|
}
|
2017-03-18 14:46:46 -04:00
|
|
|
|
2024-12-01 21:44:14 -05:00
|
|
|
if(address < 0x1800) {
|
|
|
|
ram_[address & 1023] = *value;
|
|
|
|
return;
|
2017-03-18 14:46:46 -04:00
|
|
|
}
|
|
|
|
|
2024-12-01 21:44:14 -05:00
|
|
|
if(isReadOperation(operation)) *value = rom_base_[address & 2047];
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t ram_[1024];
|
2017-03-18 14:46:46 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|