MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / SmartPortCmdStatus

Method SmartPortCmdStatus

source/Harddisk.cpp:1077–1203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1075}
1076
1077BYTE HarddiskInterfaceCard::SmartPortCmdStatus(HardDiskDrive* pHDD, const ULONG nExecutedCycles)
1078{
1079 // Make Firmware version: eg. 1.30.18.0 => 130.18
1080 UINT fwVerMajorCheck = g_AppleWinVersion[0] * 100 + g_AppleWinVersion[1];
1081 _ASSERT(fwVerMajorCheck < 256);
1082 if (fwVerMajorCheck >= 256) fwVerMajorCheck = 255;
1083 UINT fwVerMinorCheck = g_AppleWinVersion[2];
1084 _ASSERT(fwVerMinorCheck < 256);
1085 if (fwVerMinorCheck >= 256) fwVerMinorCheck = 255;
1086 const BYTE fwVerMajor = fwVerMajorCheck;
1087 const BYTE fwVerMinor = fwVerMinorCheck;
1088
1089 //
1090
1091 BYTE r = DEVICE_OK;
1092 std::vector<BYTE> status;
1093
1094 if (m_unitNum == 0) // Unit-0: SmartPort Controller
1095 {
1096 BYTE numDevices = GetNumConnectedDevices();
1097
1098 switch (m_statusCode)
1099 {
1100 case SP_Cmd_status_STATUS:
1101 case SP_Cmd_status_GETDIB:
1102 {
1103 // SmartPort driver status (8 bytes)
1104 status.push_back(numDevices);
1105 for (UINT i = 0; i < 7; i++)
1106 status.push_back(0); // reserved
1107 if (m_statusCode == SP_Cmd_status_STATUS)
1108 break;
1109 // Device Information Block (DIB)
1110 std::string idStr = "AppleWin SP";
1111 SetIdString(status, idStr);
1112 status.push_back(0x00); // device type (0x00: Apple II memory expansion card)
1113 status.push_back(0x00); // device subtype (0x00: Apple II memory expansion card)
1114 status.push_back(fwVerMajor); // f/w version (major)
1115 status.push_back(fwVerMinor); // f/w version (minor)
1116 break;
1117 }
1118 case SP_Cmd_status_GETDCB:
1119 case SP_Cmd_status_GETNL:
1120 default:
1121 pHDD->m_error = 1;
1122 r = BADCTL;
1123 break;
1124 }
1125 }
1126 else // Unit > 0: SmartPort Devices
1127 {
1128 switch (m_statusCode)
1129 {
1130 case SP_Cmd_status_STATUS:
1131 case SP_Cmd_status_GETDIB:
1132 {
1133 // Device status (4 bytes)
1134 const bool isImageLoaded = m_hardDiskDrive[m_unitNum - 1].m_imageloaded;

Callers

nothing calls this directly

Calls 2

CpuWriteFunction · 0.85

Tested by

no test coverage detected