Superdrive: support disk-in-drive status.

This commit is contained in:
Maxim Poliakovski 2022-02-06 03:25:35 +01:00
parent 00093bdc95
commit dea863b6e6
2 changed files with 9 additions and 4 deletions

View File

@ -31,6 +31,7 @@ using namespace MacSuperdrive;
MacSuperDrive::MacSuperDrive()
{
this->media_kind = MediaKind::high_density;
this->has_disk = 0; // drive is empty
}
void MacSuperDrive::command(uint8_t addr, uint8_t value)
@ -61,6 +62,8 @@ uint8_t MacSuperDrive::status(uint8_t addr)
return 1; // yes, Superdrive is double sided
case StatusAddr::Drive_Exists:
return 0; // tell the world I'm here
case StatusAddr::Disk_In_Drive:
return this->has_disk ^ 1; // reverse logic (active low)!
case StatusAddr::Media_Kind:
return this->media_kind;
default:

View File

@ -30,10 +30,11 @@ namespace MacSuperdrive {
/** Apple Drive status request addresses. */
enum StatusAddr : uint8_t {
MFM_Support = 5,
Double_Sided = 6,
Drive_Exists = 7,
Media_Kind = 0xF
MFM_Support = 5,
Double_Sided = 6,
Drive_Exists = 7,
Disk_In_Drive = 8,
Media_Kind = 0xF
};
/** Apple Drive command addresses. */
@ -57,6 +58,7 @@ public:
private:
uint8_t media_kind;
uint8_t has_disk;
};
}; // namespace MacSuperdrive