12 , hasEnable(config.getChildDataAsBool(
"hasEnable", true))
14 reset(EmuTime::dummy());
22 if (refs.size() != 1) {
24 "need reference to VDP device.");
26 vdp =
dynamic_cast<VDP*
>(refs[0]);
28 throw MSXException(
"Invalid ADVRAM configuration: device '",
29 refs[0]->
getName(),
"' is not a VDP device.");
32 mask = std::min(vram->
getSize(), 128u * 1024) - 1;
47 enabled = ((port & 0x8000) != 0);
48 planar = ((port & 0x4000) != 0);
50 planar = ((port & 0x0100) != 0);
58 baseAddr = (value & 0x07) << 14;
61unsigned ADVram::calcAddress(
word address)
const
63 unsigned addr = (address & 0x3FFF) | baseAddr;
65 addr = ((addr & 1) << 16) | (addr >> 1);
72 return enabled ? vram->
cpuRead(calcAddress(address), time) : 0xFF;
78 vram->
cpuWrite(calcAddress(address), value, time);
82template<
typename Archive>
85 ar.template serializeBase<MSXDevice>(*
this);
86 ar.serialize(
"baseAddr", baseAddr,
#define REGISTER_MSXDEVICE(CLASS, NAME)
Implementation of direct cpu access to VRAM.
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte at a certain time to a given location in the video ram.
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port, set mapper register.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location in the video ram at a certain time.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port, change mode bits.
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
ADVram(const DeviceConfig &config)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
virtual const std::string & getName() const
Returns a human-readable name for this device.
const Devices & getReferences() const
Get the device references that are specified for this device.
byte cpuRead(unsigned address, EmuTime::param time)
Read a byte from VRAM though the CPU interface.
unsigned getSize() const
Returns the size of VRAM in bytes.
void cpuWrite(unsigned address, byte value, EmuTime::param time)
Write a byte to VRAM through the CPU interface.
VDPVRAM & getVRAM()
Get the VRAM object for this VDP.
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)