10 , rom(
getName(),
"Kanji ROM", config)
11 , isLascom(config.getChildData(
"type", {}) ==
"lascom")
12 , highAddressMask(config.getChildData(
"type", {}) ==
"hangul" ? 0x7F : 0x3F)
14 int size = rom.getSize();
16 throw MSXException(
"MSXKanji: wrong kanji ROM, it should be either 128kB or 256kB.");
18 if ((highAddressMask == 0x7F) && (
size != 0x40000)) {
19 throw MSXException(
"MSXKanji: for hangul type, the font ROM must be 256kB.");
22 reset(EmuTime::dummy());
33 switch (port & 0x03) {
35 adr1 = (adr1 & 0x1f800) | ((value & 0x3f) << 5);
38 adr1 = (adr1 & 0x007e0) | ((value & highAddressMask) << 11);
41 adr2 = (adr2 & 0x3f800) | ((value & 0x3f) << 5);
44 adr2 = (adr2 & 0x207e0) | ((value & 0x3f) << 11);
51 byte result =
peekIO(port, time);
52 switch (port & 0x03) {
59 adr1 = (adr1 & ~0x1f) | ((adr1 + 1) & 0x1f);
62 adr2 = (adr2 & ~0x1f) | ((adr2 + 1) & 0x1f);
71 switch (port & 0x03) {
78 result = rom[adr1 & (rom.
getSize() - 1)];
89 template<
typename Archive>
92 ar.template serializeBase<MSXDevice>(*
this);
93 ar.serialize(
"adr1", adr1,
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
void reset(EmuTime::param time) override
This method is called on reset.
void serialize(Archive &ar, unsigned version)
MSXKanji(const DeviceConfig &config)
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
string getName(KeyCode keyCode)
Translate key code to key name.
This file implemented 3 utility functions:
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
size_t size(std::string_view utf8)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)