19 , diskManipulator(config.getReactor().getDiskManipulator())
30bool IDEHD::isPacketDevice()
35std::string_view IDEHD::getDeviceName()
37 return "OPENMSX HARD DISK";
40void IDEHD::fillIdentifyBlock(AlignedBuffer& buf)
43 const uint16_t heads = 16;
44 const uint16_t sectors = 32;
45 auto cylinders = narrow<uint16_t>(totalSectors /
size_t(heads * sectors));
51 buf[47 * 2 + 1] = 0x80;
55 buf[49 * 2 + 1] = 0x0A;
61unsigned IDEHD::readBlockStart(AlignedBuffer& buf,
unsigned count)
67 *aligned_cast<SectorBuffer*>(buf));
68 ++transferSectorNumber;
70 }
catch (MSXException&) {
76void IDEHD::writeBlockComplete(AlignedBuffer& buf,
unsigned count)
79 assert((
count % 512) == 0);
80 size_t num =
count / 512;
81 for (
auto i :
xrange(num)) {
83 *aligned_cast<SectorBuffer*>(buf + 512 * i));
85 }
catch (MSXException&) {
90void IDEHD::executeCommand(
byte cmd)
92 if (0x10 <= cmd && cmd < 0x20) {
111 transferSectorNumber = sectorNumber;
133template<
typename Archive>
137 ar.template serializeBase<HD>(*
this);
138 ar.template serializeBase<AbstractIDEDevice>(*
this);
139 ar.serialize(
"transferSectorNumber", transferSectorNumber);
void startWriteTransfer(unsigned count)
Indicates the start of a write data transfer.
static constexpr byte UNC
void startLongReadTransfer(unsigned count)
Indicates the start of a read data transfer which uses blocks.
virtual void executeCommand(byte cmd)
Starts execution of an IDE command.
void setSectorNumber(unsigned lba)
Writes a 28-bit LBA sector number in the registers.
void setByteCount(unsigned count)
Writes the byte count of a packet transfer in the registers.
unsigned getNumSectors() const
Gets the number of sectors indicated by the sector count register.
void abortReadTransfer(byte error)
Aborts the read transfer in progress.
void setError(byte error)
Indicates an error: sets error register, error flag, aborts transfers.
void abortWriteTransfer(byte error)
Aborts the write transfer in progress.
static constexpr byte IDNF
unsigned getSectorNumber() const
Creates an LBA sector address from the contents of the sectorNumReg, cylinderLowReg,...
MSXMotherBoard & getMotherBoard() const
void unregisterDrive(DiskContainer &drive)
void registerDrive(DiskContainer &drive, std::string_view prefix)
void serialize(Archive &ar, unsigned version)
IDEHD(const IDEHD &)=delete
std::string_view getMachineID() const
void readSector(size_t sector, SectorBuffer &buf)
size_t getNbSectors() const
void writeSector(size_t sector, const SectorBuffer &buf)
void writeL32(void *p, uint32_t x)
void writeL16(void *p, uint16_t x)
ALWAYS_INLINE unsigned count(const uint8_t *pIn, const uint8_t *pMatch, const uint8_t *pInLimit)
This file implemented 3 utility functions:
REGISTER_POLYMORPHIC_INITIALIZER(Pluggable, CassettePlayer, "CassettePlayer")
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
TemporaryString tmpStrCat(Ts &&... ts)
constexpr auto xrange(T e)