mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-28 02:32:08 +00:00
Debugger DISK INFO QoL (#1212)
* Bump debugger version 2.9.1.19 * Cleanup * Debugger: Update DISK INFO to display disk info across 2 lines of text * Debugger: Fix ConsolePrint() to wrap long lines of text * Debugger: Update DISK INFO to show last nibble for non WOZ floppy image * Replace optional pointer with reference in GetCurrentState() * Add Log.h to Disk.h * Cleanup GetCurrentState() * Cleanup whitespace * Add single line output for DISK INFO foundation. Still need CONFIG DISK # * 2.9.1.21 Added: DISK INFO [#]
This commit is contained in:
parent
f8da683d45
commit
e1b0b20aad
@ -1,4 +1,8 @@
|
||||
/*
|
||||
2.9.1.20 Fixed: Changed DISK INFO to have 1 line abbreviation for disk state
|
||||
2.9.1.19 Added: QoL to DISK INFO.
|
||||
Colorized numbers and status to improve readability.
|
||||
Also shows the .WOZ current shift register.
|
||||
2.9.1.18 Fixed: NTSC LOAD was failing to import BMPs exported from GIMP.
|
||||
To export a 64x256 bitmap from GIMP:
|
||||
1. File, Export As...
|
||||
|
@ -53,7 +53,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#define MAKE_VERSION(a,b,c,d) ((a<<24) | (b<<16) | (c<<8) | (d))
|
||||
|
||||
// See /docs/Debugger_Changelog.txt for full details
|
||||
const int DEBUGGER_VERSION = MAKE_VERSION(2,9,1,18);
|
||||
const int DEBUGGER_VERSION = MAKE_VERSION(2,9,1,20);
|
||||
|
||||
|
||||
// Public _________________________________________________________________________________________
|
||||
@ -3640,7 +3640,7 @@ Update_t CmdFlag (int nArgs)
|
||||
// DISK # PROTECT # // Write-protect disk on/off
|
||||
// DISK # "<filename>" // Mount filename as floppy disk
|
||||
// TODO:
|
||||
// DISK # READ <Track> <Sector> <NumSec> <Addr> // Read Track/Sector(s)
|
||||
// DISK # READ <Track> <Sector> <NumSec> <Addr> // Read Track/Sector(s)
|
||||
// DISK # READ <Track> <Sector> Addr:Addr // Read Track/Sector(s)
|
||||
// DISK # WRITE <Track> <Sector> Addr:Addr // Write Track/Sector(s)
|
||||
// Examples:
|
||||
@ -3681,17 +3681,43 @@ Update_t CmdDisk (int nArgs)
|
||||
|
||||
if (iParam == PARAM_DISK_INFO)
|
||||
{
|
||||
if (nArgs > 2)
|
||||
if (nArgs > 1)
|
||||
return HelpLastCommand();
|
||||
|
||||
ConsoleBufferPushFormat("FW%2d: D%d at T$%s, phase $%s, bitOffset $%04X, extraCycles %.2f, %s",
|
||||
Disk_Status_e eDiskState;
|
||||
LPCTSTR sDiskState = diskCard.GetCurrentState(eDiskState);
|
||||
BYTE nShiftReg = diskCard.GetCurrentShiftReg();
|
||||
|
||||
static const char *aDiskStatusCHC[NUM_DISK_STATUS] =
|
||||
{
|
||||
CHC_INFO "%s" CHC_DEFAULT " " CHC_NUM_HEX " " // DISK_STATUS_OFF
|
||||
,CHC_COMMAND "%s" CHC_DEFAULT " << " CHC_NUM_HEX "%02X" // DISK_STATUS_READ
|
||||
,CHC_ERROR "%s" CHC_DEFAULT " >> " CHC_NUM_HEX "%02X" // DISK_STATUS_WRITE
|
||||
,CHC_WARNING "%s" CHC_DEFAULT " >| " CHC_NUM_HEX "%02X" // DISK_STATUS_PROT
|
||||
,CHC_INFO "%s" CHC_DEFAULT " " CHC_NUM_HEX " " // DISK_STATUS_EMPTY
|
||||
,CHC_INFO "%s" CHC_DEFAULT " " CHC_NUM_HEX " " // DISK_STATUS_SPIN
|
||||
};
|
||||
|
||||
std::string Format(
|
||||
/*CHC_DEFAULT*/ "FW" CHC_NUM_DEC "%2d" CHC_ARG_SEP ":"
|
||||
CHC_DEFAULT " D" CHC_NUM_DEC "%d"
|
||||
CHC_DEFAULT " T$" CHC_NUM_HEX "%s" CHC_ARG_SEP ","
|
||||
CHC_DEFAULT " Phase $" CHC_NUM_HEX "%s" CHC_ARG_SEP ","
|
||||
CHC_DEFAULT " bitOffset $" CHC_ADDRESS "%04X" CHC_ARG_SEP ","
|
||||
CHC_DEFAULT " Cycles " CHC_NUM_DEC "%.2f" CHC_ARG_SEP ", "
|
||||
);
|
||||
Format += aDiskStatusCHC[eDiskState];
|
||||
|
||||
ConsolePrintFormat(
|
||||
Format.c_str(),
|
||||
diskCard.GetCurrentFirmware(),
|
||||
diskCard.GetCurrentDrive() + 1,
|
||||
diskCard.GetCurrentTrackString().c_str(),
|
||||
diskCard.GetCurrentPhaseString().c_str(),
|
||||
diskCard.GetCurrentBitOffset(),
|
||||
diskCard.GetCurrentExtraCycles(),
|
||||
diskCard.GetCurrentState()
|
||||
sDiskState,
|
||||
nShiftReg
|
||||
);
|
||||
|
||||
return ConsoleUpdate();
|
||||
|
@ -127,30 +127,40 @@ void ConsolePrint ( const char * pText )
|
||||
// Convert color string to native console color text
|
||||
// Ignores g_nConsoleDisplayWidth
|
||||
char c;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
const char *pSrc = pText;
|
||||
conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
||||
|
||||
const int MAX_PUSH_HEIGHT = 16;
|
||||
|
||||
conchar_t g = 0;
|
||||
bool bHaveColor = false;
|
||||
char cColor = 0;
|
||||
|
||||
while ((x < CONSOLE_WIDTH) && (c = *pSrc))
|
||||
while ((y < MAX_PUSH_HEIGHT) && (c = *pSrc))
|
||||
{
|
||||
if ((c == '\n') || (x >= (CONSOLE_WIDTH - 1)))
|
||||
if ((c == '\n') || (x >= g_nConsoleDisplayWidth))
|
||||
{
|
||||
*pDst = 0;
|
||||
x = 0;
|
||||
y++;
|
||||
|
||||
if (cColor)
|
||||
bHaveColor = true; // wrap color to next line
|
||||
|
||||
if (g_nConsoleBuffer >= CONSOLE_BUFFER_HEIGHT)
|
||||
{
|
||||
ConsoleBufferToDisplay();
|
||||
ConsoleBufferToDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_nConsoleBuffer++;
|
||||
}
|
||||
}
|
||||
pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
||||
|
||||
if (c == '\n')
|
||||
pSrc++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -192,7 +202,7 @@ void ConsolePrint ( const char * pText )
|
||||
{
|
||||
if (bHaveColor)
|
||||
{
|
||||
g = ConsoleColor_MakeColor( cColor, c );
|
||||
g = ConsoleColor_MakeColor( cColor, c );
|
||||
bHaveColor = false;
|
||||
}
|
||||
*pDst = g;
|
||||
|
@ -64,7 +64,7 @@
|
||||
// Console Help Color
|
||||
#define CHC_DEFAULT "`0"
|
||||
#define CHC_USAGE "`3"
|
||||
#define CHC_CATEGORY "`6"
|
||||
#define CHC_CATEGORY "`6" // Cyan
|
||||
#define CHC_COMMAND "`2" // Green
|
||||
#define CHC_KEY "`1" // Red
|
||||
#define CHC_ARG_MAND "`7" // < >
|
||||
|
@ -100,13 +100,15 @@ Disk2InterfaceCard::~Disk2InterfaceCard(void)
|
||||
bool Disk2InterfaceCard::GetEnhanceDisk(void) { return m_enhanceDisk; }
|
||||
void Disk2InterfaceCard::SetEnhanceDisk(bool bEnhanceDisk) { m_enhanceDisk = bEnhanceDisk; }
|
||||
|
||||
int Disk2InterfaceCard::GetCurrentDrive(void) { return m_currDrive; }
|
||||
int Disk2InterfaceCard::GetCurrentTrack(void) { return ImagePhaseToTrack(m_floppyDrive[m_currDrive].m_disk.m_imagehandle, m_floppyDrive[m_currDrive].m_phasePrecise, false); }
|
||||
float Disk2InterfaceCard::GetCurrentPhase(void) { return m_floppyDrive[m_currDrive].m_phasePrecise; }
|
||||
UINT Disk2InterfaceCard::GetCurrentBitOffset(void) { return m_floppyDrive[m_currDrive].m_disk.m_bitOffset; }
|
||||
UINT Disk2InterfaceCard::GetCurrentBitOffset (void) { return m_floppyDrive[m_currDrive].m_disk.m_bitOffset; }
|
||||
double Disk2InterfaceCard::GetCurrentExtraCycles(void) { return m_floppyDrive[m_currDrive].m_disk.m_extraCycles; }
|
||||
float Disk2InterfaceCard::GetCurrentPhase (void) { return m_floppyDrive[m_currDrive].m_phasePrecise; }
|
||||
int Disk2InterfaceCard::GetCurrentDrive (void) { return m_currDrive; }
|
||||
BYTE Disk2InterfaceCard::GetCurrentShiftReg (void) { return m_shiftReg; }
|
||||
int Disk2InterfaceCard::GetCurrentTrack (void) { return ImagePhaseToTrack(m_floppyDrive[m_currDrive].m_disk.m_imagehandle, m_floppyDrive[m_currDrive].m_phasePrecise, false); }
|
||||
|
||||
float Disk2InterfaceCard::GetPhase(const int drive) { return m_floppyDrive[drive].m_phasePrecise; }
|
||||
int Disk2InterfaceCard::GetTrack(const int drive) { return ImagePhaseToTrack(m_floppyDrive[drive].m_disk.m_imagehandle, m_floppyDrive[drive].m_phasePrecise, false); }
|
||||
int Disk2InterfaceCard::GetTrack(const int drive) { return ImagePhaseToTrack(m_floppyDrive[drive].m_disk.m_imagehandle, m_floppyDrive[drive].m_phasePrecise, false); }
|
||||
|
||||
std::string Disk2InterfaceCard::FormatIntFracString(float phase, bool hex)
|
||||
{
|
||||
@ -130,24 +132,34 @@ std::string Disk2InterfaceCard::GetCurrentPhaseString(void)
|
||||
return FormatIntFracString(m_floppyDrive[m_currDrive].m_phasePrecise, true);
|
||||
}
|
||||
|
||||
LPCTSTR Disk2InterfaceCard::GetCurrentState(void)
|
||||
LPCTSTR Disk2InterfaceCard::GetCurrentState(Disk_Status_e& eDiskState_)
|
||||
{
|
||||
if (m_floppyDrive[m_currDrive].m_disk.m_imagehandle == NULL)
|
||||
return "Empty";
|
||||
|
||||
{
|
||||
eDiskState_ = DISK_STATUS_EMPTY;
|
||||
}
|
||||
else
|
||||
if (!m_floppyMotorOn)
|
||||
{
|
||||
if (m_floppyDrive[m_currDrive].m_spinning > 0)
|
||||
return "Off (spinning)";
|
||||
{
|
||||
eDiskState_ = DISK_STATUS_SPIN;
|
||||
}
|
||||
else
|
||||
return "Off";
|
||||
{
|
||||
eDiskState_ = DISK_STATUS_OFF;
|
||||
}
|
||||
}
|
||||
else if (m_seqFunc.writeMode)
|
||||
{
|
||||
if (m_floppyDrive[m_currDrive].m_disk.m_bWriteProtected)
|
||||
return "Writing (write protected)";
|
||||
{
|
||||
eDiskState_ = DISK_STATUS_PROT;
|
||||
}
|
||||
else
|
||||
return "Writing";
|
||||
{
|
||||
eDiskState_ = DISK_STATUS_WRITE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -159,8 +171,22 @@ LPCTSTR Disk2InterfaceCard::GetCurrentState(void)
|
||||
return "Reading write protect state (not write protected)";
|
||||
}
|
||||
else*/
|
||||
return "Reading";
|
||||
{
|
||||
eDiskState_ = DISK_STATUS_READ;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *aDiskStateMiniDesc[NUM_DISK_STATUS] =
|
||||
{
|
||||
"Off" // DISK_STATUS_OFF
|
||||
,"R" // DISK_STATUS_READ
|
||||
,"W" // DISK_STATUS_WRITE
|
||||
,"WP" // DISK_STATUS_PROT
|
||||
,"n/a" // DISK_STATUS_EMPTY
|
||||
,"Spin" // DISK_STATUS_SPIN
|
||||
};
|
||||
|
||||
return aDiskStateMiniDesc[eDiskState_];
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -764,7 +790,7 @@ Disk_Status_e Disk2InterfaceCard::GetDriveLightStatus(const int drive)
|
||||
}
|
||||
}
|
||||
|
||||
return DISK_STATUS_OFF;
|
||||
return DISK_STATUS_EMPTY;
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::GetLightStatus(Disk_Status_e *pDisk1Status, Disk_Status_e *pDisk2Status)
|
||||
@ -1123,6 +1149,9 @@ void __stdcall Disk2InterfaceCard::ReadWrite(WORD pc, WORD addr, BYTE bWrite, BY
|
||||
#endif
|
||||
}
|
||||
|
||||
// GH #1212 We have a non .WOZ disk, mirror so that GetCurrentShiftReg() returns last nibble read
|
||||
m_shiftReg = m_floppyLatch;
|
||||
|
||||
if (++pFloppy->m_byte >= pFloppy->m_nibbles)
|
||||
pFloppy->m_byte = 0;
|
||||
|
||||
|
@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Card.h"
|
||||
#include "Log.h"
|
||||
#include "DiskLog.h"
|
||||
#include "DiskFormatTrack.h"
|
||||
#include "DiskImage.h"
|
||||
@ -159,18 +160,21 @@ public:
|
||||
|
||||
bool IsConditionForFullSpeed(void);
|
||||
void NotifyInvalidImage(const int drive, LPCTSTR pszImageFilename, const ImageError_e Error);
|
||||
UINT GetCurrentFirmware(void) { return m_is13SectorFirmware ? 13 : 16; }
|
||||
int GetCurrentDrive(void);
|
||||
int GetCurrentTrack(void);
|
||||
float GetCurrentPhase(void);
|
||||
|
||||
UINT GetCurrentBitOffset(void);
|
||||
UINT GetCurrentFirmware(void) { return m_is13SectorFirmware ? 13 : 16; }
|
||||
double GetCurrentExtraCycles(void);
|
||||
float GetCurrentPhase(void);
|
||||
int GetCurrentDrive(void);
|
||||
BYTE GetCurrentShiftReg(void);
|
||||
int GetCurrentTrack(void);
|
||||
|
||||
float GetPhase(const int drive);
|
||||
int GetTrack(const int drive);
|
||||
static std::string FormatIntFracString(float phase, bool hex);
|
||||
std::string GetCurrentTrackString(void);
|
||||
std::string GetCurrentPhaseString(void);
|
||||
LPCTSTR GetCurrentState(void);
|
||||
LPCTSTR GetCurrentState(Disk_Status_e& eDiskState_);
|
||||
bool UserSelectNewDiskImage(const int drive, LPCSTR pszFilename="");
|
||||
bool DriveSwap(void);
|
||||
bool IsDriveConnected(int drive) { return m_floppyDrive[drive].m_isConnected; }
|
||||
|
@ -45,10 +45,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
enum Disk_Status_e
|
||||
{
|
||||
DISK_STATUS_OFF ,
|
||||
DISK_STATUS_OFF , // motor is off
|
||||
DISK_STATUS_READ ,
|
||||
DISK_STATUS_WRITE,
|
||||
DISK_STATUS_PROT ,
|
||||
DISK_STATUS_PROT , // NOTE: GetDriveLightStatus() and GetCurrentState() return slightly different states
|
||||
DISK_STATUS_EMPTY, // See: GetCurrentState(); no disk image mounted
|
||||
DISK_STATUS_SPIN , // See: GetCurrentState(), motor has been turned off, spinning before stopping
|
||||
NUM_DISK_STATUS
|
||||
};
|
||||
|
||||
|
@ -68,8 +68,9 @@ static const DWORD g_aDiskFullScreenColorsLED[ NUM_DISK_STATUS ] =
|
||||
RGB( 0, 0, 0), // DISK_STATUS_OFF BLACK
|
||||
RGB( 0,255, 0), // DISK_STATUS_READ GREEN
|
||||
RGB(255, 0, 0), // DISK_STATUS_WRITE RED
|
||||
RGB(255,128, 0) // DISK_STATUS_PROT ORANGE
|
||||
// RGB( 0, 0,255) // DISK_STATUS_PROT -blue-
|
||||
RGB(255,128, 0), // DISK_STATUS_PROT ORANGE
|
||||
RGB( 0, 0,255), // DISK_STATUS_EMPTY -blue-
|
||||
RGB( 0,128,128) // DISK_STATUS_SPIN -cyan-
|
||||
};
|
||||
|
||||
void Win32Frame::SetAltEnterToggleFullScreen(bool mode)
|
||||
@ -227,6 +228,8 @@ void Win32Frame::CreateGdiObjects(void)
|
||||
g_hDiskWindowedLED[ DISK_STATUS_READ ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKREAD_BITMAP"));
|
||||
g_hDiskWindowedLED[ DISK_STATUS_WRITE] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKWRITE_BITMAP"));
|
||||
g_hDiskWindowedLED[ DISK_STATUS_PROT ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKPROT_BITMAP"));
|
||||
g_hDiskWindowedLED[ DISK_STATUS_EMPTY] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKOFF_BITMAP"));
|
||||
g_hDiskWindowedLED[ DISK_STATUS_SPIN ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKREAD_BITMAP"));
|
||||
|
||||
btnfacebrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
|
||||
btnfacepen = CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNFACE));
|
||||
|
Loading…
Reference in New Issue
Block a user