openMSX
MSXVictorHC9xSystemControl.cc
Go to the documentation of this file.
2 #include "serialize.hh"
3 #include <cassert>
4 
5 // This implementation is documented in the HC-95 service manual:
6 //
7 // System control:
8 // 7FFD I/O bit 0 NMI CONTROL "0" ENABLE
9 // I/O bit 1 INT CONTROL "1" ENABLE
10 // I/O bit 2 WAIT CONTROL "0" ENABLE
11 // I/O bit 3 JVC MODE ACK FLAG "1" JVC ACK
12 // I/O bit 4 FDC DREQ CONTROL "1" ENABLE
13 // I/O bit 5 RS-232C FLAG "1" ENABLE
14 // I bit 6 TURBO MODE FLAG "1" TURBO
15 // I bit 7 JVC MODE FLAG "0" JVC MODE
16 
17 // turbo mode is determined by a physical switch on the machine (hence readonly)
18 
19 namespace openmsx {
20 
22  : MSXDevice(config)
23 {
24  systemControlRegister = 0x80;
25 }
26 
27 byte MSXVictorHC9xSystemControl::readMem(word address, EmuTime::param time)
28 {
29  return peekMem(address, time);
30 }
31 
32 byte MSXVictorHC9xSystemControl::peekMem(word address, EmuTime::param /*time*/) const
33 {
34  (void)address; // avoid warning for non-assert compiles
35  assert (address == 0x7FFD);
36  return systemControlRegister;
37 }
38 
39 void MSXVictorHC9xSystemControl::writeMem(word address, byte value, EmuTime::param /*time*/) {
40  (void)address; // avoid warning for non-assert compiles
41  assert (address == 0x7FFD);
42  systemControlRegister = (value & 0x3F) | (0x80);
43 }
44 
46 {
47  // OK, because this device doesn't call any 'fillDeviceXXXCache()'functions.
48  return true;
49 }
50 
51 template<typename Archive>
52 void MSXVictorHC9xSystemControl::serialize(Archive& ar, unsigned /*version*/)
53 {
54  ar.template serializeBase<MSXDevice>(*this);
55  ar.serialize("systemControlRegister", systemControlRegister);
56 }
57 
59 REGISTER_MSXDEVICE(MSXVictorHC9xSystemControl, "VictorHC9xSystemControl");
60 
61 } // namespace openmsx
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
byte peekMem(word address, EmuTime::param time) const override
Read a byte from a given memory location.
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.
void serialize(Archive &ar, unsigned version)
bool allowUnaligned() const override
By default we don't allow unaligned <mem> specifications in the config file.
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
MSXVictorHC9xSystemControl(const DeviceConfig &config)
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:998