Added option DisplayTracks

Displays a rough layout of data for a disk image on the Pi's HDMI screen.
This commit is contained in:
Stephen White 2019-11-17 14:54:30 +11:00
parent 6542da7c6d
commit ca10026ade
3 changed files with 53 additions and 0 deletions

View file

@ -1473,6 +1473,55 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
ClearScreen(); ClearScreen();
if (options.DisplayTracks())
{
for (track = 0; track < HALF_TRACK_COUNT; track += 2)
{
int yoffset = screenMain->ScaleY(400);
unsigned index;
unsigned length = diskImage->TrackLength(track);
unsigned countSync = 0;
u8 shiftReg = 0;
for (index = 0; index < length / 8; ++index)
{
RGBA colour;
unsigned count1s = 0;
bool sync = false;
int bit;
for (bit = 0; bit < 64; ++bit)
{
if (bit % 8 == 0)
shiftReg = diskImage->GetNextByte(track, index * 8 + bit / 8);
if (shiftReg & 0x80)
{
count1s++;
countSync++;
if (countSync == 10)
sync = true;
}
else
{
countSync = 0;
}
shiftReg <<= 1;
}
if (sync)
colour = RGBA(0xff, 0x00, 0x00, 0xFF);
else
colour = RGBA(0x00, (unsigned char)((float)count1s / 64.0f * 255.0f), 0x00, 0xFF);
screenMain->DrawRectangle(index, (track >> 1) * 4 + yoffset, index + 1, (track >> 1) * 4 + 4 + yoffset, colour);
}
}
}
track = 18;
if (diskImage->GetDecodedSector(track, sectorNo, buffer)) if (diskImage->GetDecodedSector(track, sectorNo, buffer))
{ {
track = buffer[0]; track = buffer[0];

View file

@ -128,6 +128,7 @@ Options::Options(void)
, disableSD2IECCommands(0) , disableSD2IECCommands(0)
, supportUARTInput(0) , supportUARTInput(0)
, graphIEC(0) , graphIEC(0)
, displayTracks(0)
, quickBoot(0) , quickBoot(0)
, showOptions(0) , showOptions(0)
, displayPNGIcons(0) , displayPNGIcons(0)
@ -218,6 +219,7 @@ void Options::Process(char* buffer)
ELSE_CHECK_DECIMAL_OPTION(disableSD2IECCommands) ELSE_CHECK_DECIMAL_OPTION(disableSD2IECCommands)
ELSE_CHECK_DECIMAL_OPTION(supportUARTInput) ELSE_CHECK_DECIMAL_OPTION(supportUARTInput)
ELSE_CHECK_DECIMAL_OPTION(graphIEC) ELSE_CHECK_DECIMAL_OPTION(graphIEC)
ELSE_CHECK_DECIMAL_OPTION(displayTracks)
ELSE_CHECK_DECIMAL_OPTION(quickBoot) ELSE_CHECK_DECIMAL_OPTION(quickBoot)
ELSE_CHECK_DECIMAL_OPTION(showOptions) ELSE_CHECK_DECIMAL_OPTION(showOptions)
ELSE_CHECK_DECIMAL_OPTION(displayPNGIcons) ELSE_CHECK_DECIMAL_OPTION(displayPNGIcons)

View file

@ -60,6 +60,7 @@ public:
inline unsigned int GetSupportUARTInput() const { return supportUARTInput; } inline unsigned int GetSupportUARTInput() const { return supportUARTInput; }
inline unsigned int GraphIEC() const { return graphIEC; } inline unsigned int GraphIEC() const { return graphIEC; }
inline unsigned int DisplayTracks() const { return displayTracks; }
inline unsigned int QuickBoot() const { return quickBoot; } inline unsigned int QuickBoot() const { return quickBoot; }
inline unsigned int ShowOptions() const { return showOptions; } inline unsigned int ShowOptions() const { return showOptions; }
inline unsigned int DisplayPNGIcons() const { return displayPNGIcons; } inline unsigned int DisplayPNGIcons() const { return displayPNGIcons; }
@ -128,6 +129,7 @@ private:
unsigned int disableSD2IECCommands; unsigned int disableSD2IECCommands;
unsigned int supportUARTInput; unsigned int supportUARTInput;
unsigned int graphIEC; unsigned int graphIEC;
unsigned int displayTracks;
unsigned int quickBoot; unsigned int quickBoot;
unsigned int showOptions; unsigned int showOptions;
unsigned int displayPNGIcons; unsigned int displayPNGIcons;