mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-28 02:32:08 +00:00
. The auto-switch is done on each reset, or on inserting a disk at the start-up screen (MODE_LOGO). . The Window's title include '(S6-13)' if DiskII card has 13-sector f/w. . The debugger's 'disk info' cmd will show FW13 or FW16 depending on f/w.
This commit is contained in:
parent
ac603dcd10
commit
21d16d3a0c
@ -1181,6 +1181,10 @@
|
||||
RelativePath=".\resource\Disk2.rom"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource\Disk2-13sector.rom"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="RESOURCE\DISKOFF.BMP"
|
||||
>
|
||||
|
@ -308,7 +308,8 @@ END
|
||||
// FIRMWARE
|
||||
//
|
||||
|
||||
IDR_DISK2_FW FIRMWARE "Disk2.rom"
|
||||
IDR_DISK2_13SECTOR_FW FIRMWARE "Disk2-13sector.rom"
|
||||
IDR_DISK2_16SECTOR_FW FIRMWARE "Disk2.rom"
|
||||
IDR_SSC_FW FIRMWARE "SSC.rom"
|
||||
IDR_HDDRVR_FW FIRMWARE "Hddrvr.bin"
|
||||
IDR_PRINTDRVR_FW FIRMWARE "Parallel.rom"
|
||||
|
BIN
resource/DISK2-13sector.rom
Normal file
BIN
resource/DISK2-13sector.rom
Normal file
Binary file not shown.
@ -34,7 +34,6 @@
|
||||
#define IDD_TFE_SETTINGS_DIALOG 131
|
||||
#define IDR_PRINTDRVR_FW 132
|
||||
#define IDD_PROPPAGE_ADVANCED 132
|
||||
#define IDR_DISK2_FW 133
|
||||
#define IDR_SSC_FW 134
|
||||
#define IDR_MOCKINGBOARD_D_FW 135
|
||||
#define IDR_MOUSEINTERFACE_FW 136
|
||||
@ -48,6 +47,8 @@
|
||||
#define IDC_CHECK_CONFIRM_REBOOT 146
|
||||
#define IDR_TK3000_2E_ROM 147
|
||||
#define IDR_TKCLOCK_FW 148
|
||||
#define IDR_DISK2_13SECTOR_FW 149
|
||||
#define IDR_DISK2_16SECTOR_FW 150
|
||||
#define IDC_KEYB_BUFFER_ENABLE 1005
|
||||
#define IDC_SAVESTATE 1006
|
||||
#define IDC_SAVESTATE_ON_EXIT 1007
|
||||
|
@ -3768,7 +3768,8 @@ Update_t CmdDisk ( int nArgs)
|
||||
goto _Help;
|
||||
|
||||
char buffer[200] = "";
|
||||
ConsoleBufferPushFormat(buffer, "D%d at T$%s, phase $%s, offset $%X, mask $%02X, extraCycles %.2f, %s",
|
||||
ConsoleBufferPushFormat(buffer, "FW%2d: D%d at T$%s, phase $%s, offset $%X, mask $%02X, extraCycles %.2f, %s",
|
||||
diskCard.GetCurrentFirmware(),
|
||||
diskCard.GetCurrentDrive() + 1,
|
||||
diskCard.GetCurrentTrackString().c_str(),
|
||||
diskCard.GetCurrentPhaseString().c_str(),
|
||||
|
104
source/Disk.cpp
104
source/Disk.cpp
@ -64,6 +64,7 @@ Disk2InterfaceCard::Disk2InterfaceCard(void) :
|
||||
m_diskLastCycle = 0;
|
||||
m_diskLastReadLatchCycle = 0;
|
||||
m_enhanceDisk = true;
|
||||
m_is13SectorFirmware = false;
|
||||
|
||||
ResetLogicStateSequencer();
|
||||
|
||||
@ -228,33 +229,6 @@ void Disk2InterfaceCard::CheckSpinning(const ULONG uExecutedCycles)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
Disk_Status_e Disk2InterfaceCard::GetDriveLightStatus(const int drive)
|
||||
{
|
||||
if (IsDriveValid( drive ))
|
||||
{
|
||||
FloppyDrive* pDrive = &m_floppyDrive[ drive ];
|
||||
|
||||
if (pDrive->m_spinning)
|
||||
{
|
||||
if (pDrive->m_disk.m_bWriteProtected)
|
||||
return DISK_STATUS_PROT;
|
||||
|
||||
if (pDrive->m_writelight)
|
||||
return DISK_STATUS_WRITE;
|
||||
else
|
||||
return DISK_STATUS_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DISK_STATUS_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
return DISK_STATUS_OFF;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
bool Disk2InterfaceCard::IsDriveValid(const int drive)
|
||||
{
|
||||
return (drive >= 0 && drive < NUM_DRIVES);
|
||||
@ -595,6 +569,31 @@ const std::string & Disk2InterfaceCard::DiskGetFullPathName(const int drive)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
Disk_Status_e Disk2InterfaceCard::GetDriveLightStatus(const int drive)
|
||||
{
|
||||
if (IsDriveValid( drive ))
|
||||
{
|
||||
FloppyDrive* pDrive = &m_floppyDrive[ drive ];
|
||||
|
||||
if (pDrive->m_spinning)
|
||||
{
|
||||
if (pDrive->m_disk.m_bWriteProtected)
|
||||
return DISK_STATUS_PROT;
|
||||
|
||||
if (pDrive->m_writelight)
|
||||
return DISK_STATUS_WRITE;
|
||||
else
|
||||
return DISK_STATUS_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DISK_STATUS_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
return DISK_STATUS_OFF;
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::GetLightStatus(Disk_Status_e *pDisk1Status, Disk_Status_e *pDisk2Status)
|
||||
{
|
||||
if (pDisk1Status)
|
||||
@ -662,6 +661,9 @@ ImageError_e Disk2InterfaceCard::InsertDisk(const int drive, LPCTSTR pszImageFil
|
||||
{
|
||||
GetImageTitle(pszImageFilename, pFloppy->m_imagename, pFloppy->m_fullname);
|
||||
Video_ResetScreenshotCounter(pFloppy->m_imagename);
|
||||
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
InitFirmware(GetCxRomPeripheral());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1469,6 +1471,9 @@ void Disk2InterfaceCard::Reset(const bool bIsPowerCycle)
|
||||
|
||||
FrameRefreshStatus(DRAW_LEDS, false);
|
||||
}
|
||||
|
||||
InitFirmware(GetCxRomPeripheral());
|
||||
FrameRefreshStatus(DRAW_TITLE, false);
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::ResetSwitches(void)
|
||||
@ -1697,28 +1702,51 @@ bool Disk2InterfaceCard::DriveSwap(void)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
// TODO: LoadRom_Disk_Floppy()
|
||||
void Disk2InterfaceCard::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
bool Disk2InterfaceCard::GetFirmware(LPCSTR lpName, BYTE* pDst)
|
||||
{
|
||||
const UINT DISK2_FW_SIZE = APPLE_SLOT_SIZE;
|
||||
|
||||
HRSRC hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_DISK2_FW), "FIRMWARE");
|
||||
HRSRC hResInfo = FindResource(NULL, lpName, "FIRMWARE");
|
||||
if(hResInfo == NULL)
|
||||
return;
|
||||
return false;
|
||||
|
||||
DWORD dwResSize = SizeofResource(NULL, hResInfo);
|
||||
if(dwResSize != DISK2_FW_SIZE)
|
||||
return;
|
||||
return false;
|
||||
|
||||
HGLOBAL hResData = LoadResource(NULL, hResInfo);
|
||||
if(hResData == NULL)
|
||||
return;
|
||||
return false;
|
||||
|
||||
BYTE* pData = (BYTE*) LockResource(hResData); // NB. Don't need to unlock resource
|
||||
if(pData == NULL)
|
||||
if (!pData)
|
||||
return false;
|
||||
|
||||
memcpy(pDst, pData, DISK2_FW_SIZE);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::InitFirmware(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
if (pCxRomPeripheral == NULL)
|
||||
return;
|
||||
|
||||
memcpy(pCxRomPeripheral + uSlot*APPLE_SLOT_SIZE, pData, DISK2_FW_SIZE);
|
||||
ImageInfo* pImage = m_floppyDrive[DRIVE_1].m_disk.m_imagehandle;
|
||||
|
||||
m_is13SectorFirmware = ImageIsBootSectorFormatSector13(pImage);
|
||||
|
||||
if (m_is13SectorFirmware)
|
||||
memcpy(pCxRomPeripheral + m_slot*APPLE_SLOT_SIZE, m_13SectorFirmware, DISK2_FW_SIZE);
|
||||
else
|
||||
memcpy(pCxRomPeripheral + m_slot*APPLE_SLOT_SIZE, m_16SectorFirmware, DISK2_FW_SIZE);
|
||||
}
|
||||
|
||||
// TODO: LoadRom_Disk_Floppy()
|
||||
void Disk2InterfaceCard::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
{
|
||||
bool res = GetFirmware(MAKEINTRESOURCE(IDR_DISK2_13SECTOR_FW), m_13SectorFirmware);
|
||||
_ASSERT(res);
|
||||
|
||||
res = GetFirmware(MAKEINTRESOURCE(IDR_DISK2_16SECTOR_FW), m_16SectorFirmware);
|
||||
_ASSERT(res);
|
||||
|
||||
// Note: We used to disable the track stepping delay in the Disk II controller firmware by
|
||||
// patching $C64C with $A9,$00,$EA. Now not doing this since:
|
||||
@ -1730,6 +1758,8 @@ void Disk2InterfaceCard::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
RegisterIoHandler(uSlot, &Disk2InterfaceCard::IORead, &Disk2InterfaceCard::IOWrite, NULL, NULL, this, NULL);
|
||||
|
||||
m_slot = uSlot;
|
||||
|
||||
InitFirmware(pCxRomPeripheral);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -144,6 +144,7 @@ public:
|
||||
void NotifyInvalidImage(const int drive, LPCTSTR pszImageFilename, const ImageError_e Error);
|
||||
bool GetProtect(const int drive);
|
||||
void SetProtect(const int drive, const bool bWriteProtect);
|
||||
UINT GetCurrentFirmware(void) { return m_is13SectorFirmware ? 13 : 16; }
|
||||
int GetCurrentDrive(void);
|
||||
int GetCurrentTrack(void);
|
||||
float GetCurrentPhase(void);
|
||||
@ -195,6 +196,8 @@ private:
|
||||
void SetSequencerFunction(WORD addr);
|
||||
void DumpSectorWOZ(FloppyDisk floppy);
|
||||
void DumpTrackWOZ(FloppyDisk floppy);
|
||||
bool GetFirmware(LPCSTR lpName, BYTE* pDst);
|
||||
void InitFirmware(LPBYTE pCxRomPeripheral);
|
||||
|
||||
void SaveSnapshotFloppy(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
||||
void SaveSnapshotDriveUnit(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
||||
@ -218,6 +221,11 @@ private:
|
||||
|
||||
//
|
||||
|
||||
static const UINT DISK2_FW_SIZE = 256;
|
||||
BYTE m_13SectorFirmware[DISK2_FW_SIZE];
|
||||
BYTE m_16SectorFirmware[DISK2_FW_SIZE];
|
||||
bool m_is13SectorFirmware;
|
||||
|
||||
WORD m_currDrive;
|
||||
FloppyDrive m_floppyDrive[NUM_DRIVES];
|
||||
BYTE m_floppyLatch;
|
||||
|
@ -118,3 +118,17 @@ void Disk2CardManager::Destroy(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Disk2CardManager::IsAnyFirmware13Sector(void)
|
||||
{
|
||||
for (UINT i = 0; i < NUM_SLOTS; i++)
|
||||
{
|
||||
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
|
||||
{
|
||||
// If any Disk2 card has 13-sector firmware then return true
|
||||
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetCurrentFirmware() == 13)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -13,4 +13,5 @@ public:
|
||||
void SetEnhanceDisk(bool enhanceDisk);
|
||||
void LoadLastDiskImage(void);
|
||||
void Destroy(void);
|
||||
bool IsAnyFirmware13Sector(void);
|
||||
};
|
||||
|
@ -246,6 +246,11 @@ BYTE ImageGetOptimalBitTiming(ImageInfo* const pImageInfo)
|
||||
return pImageInfo ? pImageInfo->optimalBitTiming : 32;
|
||||
}
|
||||
|
||||
bool ImageIsBootSectorFormatSector13(ImageInfo* const pImageInfo)
|
||||
{
|
||||
return pImageInfo ? pImageInfo->bootSectorFormat == CWOZHelper::bootSector13 : false;
|
||||
}
|
||||
|
||||
UINT ImagePhaseToTrack(ImageInfo* const pImageInfo, const float phase, const bool limit/*=true*/)
|
||||
{
|
||||
if (!pImageInfo)
|
||||
|
@ -84,5 +84,6 @@ bool ImageIsWOZ(ImageInfo* const pImageInfo);
|
||||
BYTE ImageGetOptimalBitTiming(ImageInfo* const pImageInfo);
|
||||
UINT ImagePhaseToTrack(ImageInfo* const pImageInfo, const float phase, const bool limit=true);
|
||||
UINT ImageGetMaxNibblesPerTrack(ImageInfo* const pImageInfo);
|
||||
bool ImageIsBootSectorFormatSector13(ImageInfo* const pImageInfo);
|
||||
|
||||
void GetImageTitle(LPCTSTR pPathname, std::string & pImageName, std::string & pFullName);
|
||||
|
@ -57,6 +57,7 @@ ImageInfo::ImageInfo()
|
||||
pImageBuffer = NULL;
|
||||
pWOZTrackMap = NULL;
|
||||
optimalBitTiming = 0;
|
||||
bootSectorFormat = CWOZHelper::bootUnknown;
|
||||
maxNibblesPerTrack = 0;
|
||||
}
|
||||
|
||||
@ -1938,6 +1939,7 @@ bool CImageHelperBase::WOZUpdateInfo(ImageInfo* pImageInfo, DWORD& dwOffset)
|
||||
|
||||
pImageInfo->optimalBitTiming = m_WOZHelper.GetOptimalBitTiming();
|
||||
pImageInfo->maxNibblesPerTrack = m_WOZHelper.GetMaxNibblesPerTrack();
|
||||
pImageInfo->bootSectorFormat = m_WOZHelper.GetBootSectorFormat();
|
||||
|
||||
m_WOZHelper.InvalidateInfo();
|
||||
return true;
|
||||
@ -2196,7 +2198,7 @@ BYTE* CWOZHelper::CreateEmptyDisk(DWORD& size)
|
||||
memset(&pWOZ->info.v1.creator[0], ' ', sizeof(pWOZ->info.v1.creator));
|
||||
memcpy(&pWOZ->info.v1.creator[0], creator.c_str(), creator.size()); // don't include null
|
||||
pWOZ->info.diskSides = 1;
|
||||
pWOZ->info.bootSectorFormat = InfoChunkv2::bootUnknown; // could be INIT'd to 13 or 16 sector
|
||||
pWOZ->info.bootSectorFormat = bootUnknown; // could be INIT'd to 13 or 16 sector
|
||||
pWOZ->info.optimalBitTiming = InfoChunkv2::optimalBitTiming5_25;
|
||||
pWOZ->info.compatibleHardware = 0; // unknown
|
||||
pWOZ->info.requiredRAM = 0; // unknown
|
||||
|
@ -37,6 +37,7 @@ struct ImageInfo
|
||||
BYTE* pImageBuffer;
|
||||
BYTE* pWOZTrackMap; // WOZ only (points into pImageBuffer)
|
||||
BYTE optimalBitTiming; // WOZ only
|
||||
BYTE bootSectorFormat; // WOZ only
|
||||
UINT maxNibblesPerTrack;
|
||||
|
||||
ImageInfo();
|
||||
@ -210,6 +211,7 @@ public:
|
||||
bool IsWriteProtected(void) { return m_pInfo->v1.writeProtected == 1; }
|
||||
BYTE GetOptimalBitTiming(void) { return (m_pInfo->v1.version >= 2) ? m_pInfo->optimalBitTiming : InfoChunkv2::optimalBitTiming5_25; }
|
||||
UINT GetMaxNibblesPerTrack(void) { return (m_pInfo->v1.version >= 2) ? m_pInfo->largestTrack*CWOZHelper::BLOCK_SIZE : WOZ1_TRACK_SIZE; }
|
||||
BYTE GetBootSectorFormat(void) { return (m_pInfo->v1.version >= 2) ? m_pInfo->bootSectorFormat : bootUnknown; }
|
||||
void InvalidateInfo(void) { m_pInfo = NULL; }
|
||||
BYTE* CreateEmptyDisk(DWORD& size);
|
||||
#if _DEBUG
|
||||
@ -236,6 +238,11 @@ public:
|
||||
static const BYTE TMAP_TRACK_EMPTY = 0xFF;
|
||||
static const UINT16 TRK_DEFAULT_BLOCK_COUNT_5_25 = 13; // $D is default for TRKv2.blockCount
|
||||
|
||||
static const BYTE bootUnknown = 0;
|
||||
static const BYTE bootSector16 = 1;
|
||||
static const BYTE bootSector13 = 2;
|
||||
static const BYTE bootSectorBoth = 3;
|
||||
|
||||
struct WOZChunkHdr
|
||||
{
|
||||
UINT32 id;
|
||||
@ -303,11 +310,6 @@ private:
|
||||
UINT16 requiredRAM; // in K (1024 bytes)
|
||||
UINT16 largestTrack; // in blocks (512 bytes)
|
||||
|
||||
static const BYTE bootUnknown = 0;
|
||||
static const BYTE bootSector16 = 1;
|
||||
static const BYTE bootSector13 = 2;
|
||||
static const BYTE bootSectorBoth = 3;
|
||||
|
||||
static const BYTE optimalBitTiming5_25 = 32;
|
||||
};
|
||||
|
||||
|
@ -274,11 +274,12 @@ static void GetAppleWindowTitle()
|
||||
g_pAppTitle += " - ";
|
||||
|
||||
if( IsVideoStyle(VS_HALF_SCANLINES) )
|
||||
{
|
||||
g_pAppTitle += " 50% ";
|
||||
}
|
||||
g_pAppTitle += g_apVideoModeDesc[ g_eVideoType ];
|
||||
|
||||
if (g_CardMgr.GetDisk2CardMgr().IsAnyFirmware13Sector())
|
||||
g_pAppTitle += " (S6-13) ";
|
||||
|
||||
if (g_hCustomRomF8 != INVALID_HANDLE_VALUE)
|
||||
g_pAppTitle += TEXT(" (custom rom)");
|
||||
else if (sg_PropertySheet.GetTheFreezesF8Rom() && IS_APPLE2)
|
||||
|
@ -372,6 +372,11 @@ LanguageCardUnit* GetLanguageCard(void)
|
||||
return g_pLanguageCard;
|
||||
}
|
||||
|
||||
LPBYTE GetCxRomPeripheral(void)
|
||||
{
|
||||
return pCxRomPeripheral; // Can be NULL if at MODE_LOGO
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
static BYTE __stdcall IORead_C00x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
||||
|
@ -101,3 +101,5 @@ UINT GetRamWorksActiveBank(void);
|
||||
void SetSaturnMemorySize(UINT banks);
|
||||
void SetMemMainLanguageCard(LPBYTE ptr, bool bMemMain=false);
|
||||
class LanguageCardUnit* GetLanguageCard(void);
|
||||
|
||||
LPBYTE GetCxRomPeripheral(void);
|
||||
|
Loading…
Reference in New Issue
Block a user