23 , rs232Rom(getName() +
" RS232C ROM",
"rom", config,
"rs232")
24 , wordProcessorRom(getName() +
" Word Processor ROM",
"rom", config,
"wordpro")
25 , sram(getName() +
" SRAM", 0x800, config)
26 , copyButtonPressed(getCommandController(),
"copy_button_pressed",
27 "pressed status of the COPY button", false)
29 reset(EmuTime::dummy());
38bool MSXToshibaTcx200x::sramEnabled()
const
40 return (controlReg & 0b0110'0000) == 0b0110'0000;
44byte MSXToshibaTcx200x::getSelectedSegment()
const
46 return controlReg & 0b0000'0011;
51 if (address == 0x7FFF) {
52 return byte(controlReg | ((copyButtonPressed.
getBoolean() ? 0 : 1) << 7));
53 }
else if ((0x4000 <= address) && (address < 0x7FFF)) {
54 return rs232Rom[address - 0x4000];
55 }
else if ((0x8000 <= address) && (address < 0xC000)) {
58 return sram[address & (sram.
size() - 1)];
60 return wordProcessorRom[(address - 0x8000) + getSelectedSegment() * 0x4000];
74 if (address == 0x7FFF) {
75 controlReg = value & 0b0110'0011;
77 }
else if ((0x8000 <= address) && (address < 0xC000) && sramEnabled()) {
78 sram.
write(address & (sram.
size() - 1), value);
86 }
else if ((0x4000 <= start) && (start < 0x7FFF)) {
87 return &rs232Rom[start - 0x4000];
88 }
else if ((0x8000 <= start) && (start < 0xC000)) {
90 return &sram[start & (sram.
size() - 1)];
92 return &wordProcessorRom[(start - 0x8000) + getSelectedSegment() * 0x4000];
102 }
else if ((0x8000 <= start) && (start < 0xC000) && sramEnabled()) {
109template<
typename Archive>
112 ar.template serializeBase<MSXDevice>(*
this);
113 ar.serialize(
"sram", sram,
114 "controlReg", controlReg);
#define REGISTER_MSXDEVICE(CLASS, NAME)
bool getBoolean() const noexcept
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
static std::array< byte, 0x10000 > unmappedRead
static std::array< byte, 0x10000 > unmappedWrite
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
void writeMem(word address, byte value, EmuTime::param time) override
Write a given byte to a given location at a certain time to this device.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
MSXToshibaTcx200x(const DeviceConfig &config)
byte * getWriteCacheLine(word start) override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
void write(size_t addr, byte value)
This file implemented 3 utility functions:
uint8_t byte
8 bit unsigned integer
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)