openMSX
FraelSwitchableROM.cc
Go to the documentation of this file.
2#include "serialize.hh"
3
4/*
5 * Information as reverse engineered by FRS:
6 *
7 * Curiously, the machine works without the boot-logo+firmware ROM, because the
8 * MainBIOS checks for its presence. If it's not there, it just skips the logo and
9 * the menu. Maybe they were planning a cheaper version without that ROM.
10 *
11 * The boot-logo+firmware ROM is selected by the bit7 of the I/O port 90h. This is
12 * the same port that has the strobe bit (bit-1) in normal MSX computers. Besides
13 * the extra bit, the rest of the printer port seems to be pretty ordinary.
14 *
15 * Bit7=0: Select Frael MainBIOS ROM on slot-0
16 * Bit7=1: Select the boot-logo+firmware ROM on slot-0
17 */
18
19namespace openmsx {
20
22 : MSXDevice(config)
23 , basicBiosRom(getName() + " BASIC/BIOS", "rom", config, "basicbios")
24 , firmwareRom (getName() + " firmware" , "rom", config, "firmware" )
25{
26 reset(EmuTime::dummy());
27}
28
29void FraelSwitchableROM::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
30{
31 bool newValue = value & 0x80;
32 if (newValue != firmwareSelected) {
33 firmwareSelected = newValue;
35 }
36}
37
38void FraelSwitchableROM::reset(EmuTime::param /*time*/)
39{
40 firmwareSelected = false;
42}
43
44byte FraelSwitchableROM::readMem(word address, EmuTime::param /*time*/)
45{
46 return *getReadCacheLine(address);
47}
48
50{
51 return firmwareSelected ? &firmwareRom[start & (firmwareRom.size() - 1)] :
52 &basicBiosRom[start & (basicBiosRom.size() - 1)];
53}
54
55template<typename Archive>
56void FraelSwitchableROM::serialize(Archive& ar, unsigned /*version*/)
57{
58 ar.template serializeBase<MSXDevice>(*this);
59 ar.serialize("firmwareSelected", firmwareSelected);
60}
63
64} // namespace openmsx
FraelSwitchableROM(const DeviceConfig &DeviceConfig)
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
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.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time) override
This method is called on reset.
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:34
void invalidateDeviceRCache()
Definition: MSXDevice.hh:211
auto size() const
Definition: Rom.hh:36
std::string getName(KeyCode keyCode)
Translate key code to key name.
Definition: Keys.cc:730
This file implemented 3 utility functions:
Definition: Autofire.cc:9
REGISTER_MSXDEVICE(ChakkariCopy, "ChakkariCopy")
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:1021