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

Function CmdDisk

source/Debugger/Debug.cpp:3928–4058  ·  view source on GitHub ↗

Usage: DISK SLOT [#] // Show [or set] the current slot of the Disk II I/F card (for all other cmds to act on) DISK INFO // Info for current drive DISK # EJECT // Unmount disk DISK # PROTECT # // Write-protect disk on/off DISK # " " //

Source from the content-addressed store, hash-verified

3926// Examples:
3927// DISK INFO
3928Update_t CmdDisk (int nArgs)
3929{
3930 static UINT currentSlot = SLOT6;
3931
3932 if (! nArgs)
3933 return HelpLastCommand();
3934
3935 // check for info or slot command
3936 int iParam = 0;
3937 FindParam(g_aArgs[1].sArg, MATCH_EXACT, iParam, _PARAM_DISK_BEGIN, _PARAM_DISK_END);
3938
3939 if (iParam == PARAM_DISK_SET_SLOT)
3940 {
3941 if (nArgs > 2)
3942 return HelpLastCommand();
3943
3944 if (nArgs > 1)
3945 {
3946 UINT slot = g_aArgs[2].nValue;
3947 if (slot < SLOT1 || slot > SLOT7)
3948 return HelpLastCommand();
3949
3950 currentSlot = slot;
3951 }
3952
3953 ConsoleBufferPushFormat("Current Disk II slot = %d", currentSlot);
3954 return ConsoleUpdate();
3955 }
3956
3957 if (GetCardMgr().QuerySlot(currentSlot) != CT_Disk2)
3958 return ConsoleDisplayErrorFormat("No Disk II card in slot-%d", currentSlot);
3959
3960 Disk2InterfaceCard& diskCard = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(currentSlot));
3961
3962 if (iParam == PARAM_DISK_INFO)
3963 {
3964 if (nArgs > 1)
3965 return HelpLastCommand();
3966
3967 Disk_Status_e eDiskState;
3968 LPCTSTR sDiskState = diskCard.GetCurrentState(eDiskState);
3969 BYTE nShiftReg = diskCard.GetCurrentShiftReg();
3970
3971 static const char *aDiskStatusCHC[NUM_DISK_STATUS] =
3972 {
3973 CHC_INFO "%s" CHC_DEFAULT " " CHC_NUM_HEX " " // DISK_STATUS_OFF
3974 ,CHC_COMMAND "%s" CHC_DEFAULT " << " CHC_NUM_HEX "%02X" // DISK_STATUS_READ
3975 ,CHC_ERROR "%s" CHC_DEFAULT " >> " CHC_NUM_HEX "%02X" // DISK_STATUS_WRITE
3976 ,CHC_WARNING "%s" CHC_DEFAULT " >| " CHC_NUM_HEX "%02X" // DISK_STATUS_PROT
3977 ,CHC_INFO "%s" CHC_DEFAULT " " CHC_NUM_HEX " " // DISK_STATUS_EMPTY
3978 ,CHC_INFO "%s" CHC_DEFAULT " " CHC_NUM_HEX " " // DISK_STATUS_SPIN
3979 };
3980
3981 std::string Format(
3982 /*CHC_DEFAULT*/ "FW" CHC_NUM_DEC "%2d" CHC_ARG_SEP ":"
3983 CHC_DEFAULT " D" CHC_NUM_DEC "%d"
3984 CHC_DEFAULT " T$" CHC_NUM_HEX "%s" CHC_ARG_SEP ","
3985 CHC_DEFAULT " Phase $" CHC_NUM_HEX "%s" CHC_ARG_SEP ","

Callers

nothing calls this directly

Calls 15

HelpLastCommandFunction · 0.85
FindParamFunction · 0.85
ConsoleBufferPushFormatFunction · 0.85
ConsolePrintFormatFunction · 0.85
QuerySlotMethod · 0.80
GetCurrentStateMethod · 0.80
GetCurrentShiftRegMethod · 0.80
GetCurrentFirmwareMethod · 0.80
GetCurrentDriveMethod · 0.80
GetCurrentTrackStringMethod · 0.80
GetCurrentPhaseStringMethod · 0.80

Tested by

no test coverage detected