OXYGENHUB
◆ main openmsx / src / MSXVictorHC9xSystemControl.cc
1.9 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "MSXVictorHC9xSystemControl.hh"
2
3
#include "serialize.hh"
4
5
#include <cassert>
6
7
// This implementation is documented in the HC-95 service manual:
8
//
9
// System control:
10
// 7FFD  I/O      bit 0    NMI CONTROL         "0" ENABLE
11
//       I/O      bit 1    INT CONTROL         "1" ENABLE
12
//       I/O      bit 2    WAIT CONTROL        "0" ENABLE
13
//       I/O      bit 3    JVC MODE ACK FLAG   "1" JVC ACK
14
//       I/O      bit 4    FDC DREQ CONTROL    "1" ENABLE
15
//       I/O      bit 5    RS-232C FLAG        "1" ENABLE
16
//       I        bit 6    TURBO MODE FLAG     "1" TURBO
17
//       I        bit 7    JVC MODE FLAG       "0" JVC MODE
18
19
// turbo mode is determined by a physical switch on the machine (hence readonly)
20
21
namespace openmsx {
22
23
MSXVictorHC9xSystemControl::MSXVictorHC9xSystemControl(const DeviceConfig& config)
24
	: MSXDevice(config)
25
{
26
}
27
28
byte MSXVictorHC9xSystemControl::readMem(uint16_t address, EmuTime time)
29
{
30
	return peekMem(address, time);
31
}
32
33
byte MSXVictorHC9xSystemControl::peekMem(uint16_t address, EmuTime /*time*/) const
34
{
35
	(void)address; // avoid warning for non-assert compiles
36
	assert (address == 0x7FFD);
37
	return systemControlRegister;
38
}
39
40
void MSXVictorHC9xSystemControl::writeMem(uint16_t address, byte value, EmuTime /*time*/) {
41
	(void)address; // avoid warning for non-assert compiles
42
	assert (address == 0x7FFD);
43
	systemControlRegister = (value & 0x3F) | 0x80;
44
}
45
46
bool MSXVictorHC9xSystemControl::allowUnaligned() const
47
{
48
	// OK, because this device doesn't call any 'fillDeviceXXXCache()'functions.
49
	return true;
50
}
51
52
template<typename Archive>
53
void MSXVictorHC9xSystemControl::serialize(Archive& ar, unsigned /*version*/)
54
{
55
	ar.template serializeBase<MSXDevice>(*this);
56
	ar.serialize("systemControlRegister", systemControlRegister);
57
}
58
59
INSTANTIATE_SERIALIZE_METHODS(MSXVictorHC9xSystemControl);
60
REGISTER_MSXDEVICE(MSXVictorHC9xSystemControl, "VictorHC9xSystemControl");
61
62
} // namespace openmsx