openMSX
BeerIDE.hh
Go to the documentation of this file.
1#ifndef BEERIDE_HH
2#define BEERIDE_HH
3
4// Based on the blueMSX implementation:
5// Source: /cygdrive/d/Private/_SVNROOT/bluemsx/blueMSX/Src/Memory/romMapperBeerIDE.c,v Revision: 1.9 Date: 2008-03-31 19:42:22
6
7/*
8PPI NAME IDE PIN
9--- ---- -------
10PA0 HD0 17 D0
11PA1 HD1 15 D1
12PA2 HD2 13 D2
13PA3 HD3 11 D3
14PA4 HD4 9 D4
15PA5 HD5 7 D5
16PA6 HD6 5 D6
17PA7 HD7 3 D7
18
19PB0 HD8 4 D8
20PB1 HD9 6 D9
21PB2 HD10 8 D10
22PB3 HD11 10 D11
23PB4 HD12 12 D12
24PB5 HD13 14 D13
25PB6 HD14 16 D14
26PB7 HD15 18 D15
27
28PC0 HA0 35 A0
29PC1 HA1 33 A1
30PC2 HA2 36 A2
31PC3 N/A
32PC4 N/A
33PC5 HCS 37 /CS0
34PC6 HWR 23 /IOWR
35PC7 HRD 25 /IORD
36*/
37
38
39#include "MSXDevice.hh"
40#include "I8255Interface.hh"
41#include "I8255.hh"
42#include "Rom.hh"
43#include <memory>
44
45namespace openmsx {
46
47class IDEDevice;
48
49class BeerIDE final : public MSXDevice, public I8255Interface
50{
51public:
52 explicit BeerIDE(const DeviceConfig& config);
53 ~BeerIDE() override;
54
55 void reset(EmuTime::param time) override;
56
57 [[nodiscard]] byte readMem(word address, EmuTime::param time) override;
58 [[nodiscard]] const byte* getReadCacheLine(word start) const override;
59
60 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
61 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
62 void writeIO(word port, byte value, EmuTime::param time) override;
63
64 template<typename Archive>
65 void serialize(Archive& ar, unsigned version);
66
67private:
68 void changeControl(byte value, EmuTime::param time);
69
70 // I8255Interface
71 [[nodiscard]] byte readA(EmuTime::param time) override;
72 [[nodiscard]] byte readB(EmuTime::param time) override;
73 [[nodiscard]] nibble readC0(EmuTime::param time) override;
74 [[nodiscard]] nibble readC1(EmuTime::param time) override;
75 [[nodiscard]] byte peekA(EmuTime::param time) const override;
76 [[nodiscard]] byte peekB(EmuTime::param time) const override;
77 [[nodiscard]] nibble peekC0(EmuTime::param time) const override;
78 [[nodiscard]] nibble peekC1(EmuTime::param time) const override;
79 void writeA(byte value, EmuTime::param time) override;
80 void writeB(byte value, EmuTime::param time) override;
81 void writeC0(nibble value, EmuTime::param time) override;
82 void writeC1(nibble value, EmuTime::param time) override;
83
84private:
85 I8255 i8255;
86 Rom rom;
87 std::unique_ptr<IDEDevice> device;
88 word dataReg;
89 byte controlReg;
90};
91
92} // namespace openmsx
93
94#endif
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
Definition BeerIDE.cc:52
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.
Definition BeerIDE.cc:57
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
Definition BeerIDE.cc:47
void reset(EmuTime::param time) override
This method is called on reset.
Definition BeerIDE.cc:23
byte readMem(word address, EmuTime::param time) override
Read a byte from a location at a certain time from this device.
Definition BeerIDE.cc:31
const byte * getReadCacheLine(word start) const override
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition BeerIDE.cc:39
void serialize(Archive &ar, unsigned version)
Definition BeerIDE.cc:144
~BeerIDE() override
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition MSXDevice.hh:36
This file implemented 3 utility functions:
Definition Autofire.cc:11
uint8_t nibble
4 bit integer
Definition openmsx.hh:23
uint16_t word
16 bit unsigned integer
Definition openmsx.hh:29