Skip to content

Commit

Permalink
Added option DisplayTracks
Browse files Browse the repository at this point in the history
Displays a rough layout of data for a disk image on the Pi's HDMI screen.
  • Loading branch information
pi1541 committed Nov 17, 2019
1 parent 6542da7 commit ca10026
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/FileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,55 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI

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))
{
track = buffer[0];
Expand Down
2 changes: 2 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Options::Options(void)
, disableSD2IECCommands(0)
, supportUARTInput(0)
, graphIEC(0)
, displayTracks(0)
, quickBoot(0)
, showOptions(0)
, displayPNGIcons(0)
Expand Down Expand Up @@ -218,6 +219,7 @@ void Options::Process(char* buffer)
ELSE_CHECK_DECIMAL_OPTION(disableSD2IECCommands)
ELSE_CHECK_DECIMAL_OPTION(supportUARTInput)
ELSE_CHECK_DECIMAL_OPTION(graphIEC)
ELSE_CHECK_DECIMAL_OPTION(displayTracks)
ELSE_CHECK_DECIMAL_OPTION(quickBoot)
ELSE_CHECK_DECIMAL_OPTION(showOptions)
ELSE_CHECK_DECIMAL_OPTION(displayPNGIcons)
Expand Down
2 changes: 2 additions & 0 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Options : public TextParser
inline unsigned int GetSupportUARTInput() const { return supportUARTInput; }

inline unsigned int GraphIEC() const { return graphIEC; }
inline unsigned int DisplayTracks() const { return displayTracks; }
inline unsigned int QuickBoot() const { return quickBoot; }
inline unsigned int ShowOptions() const { return showOptions; }
inline unsigned int DisplayPNGIcons() const { return displayPNGIcons; }
Expand Down Expand Up @@ -128,6 +129,7 @@ class Options : public TextParser
unsigned int disableSD2IECCommands;
unsigned int supportUARTInput;
unsigned int graphIEC;
unsigned int displayTracks;
unsigned int quickBoot;
unsigned int showOptions;
unsigned int displayPNGIcons;
Expand Down

0 comments on commit ca10026

Please sign in to comment.