Implemented #163 display the ROM file name and Device Id on the LCD

This commit is contained in:
Stephen White 2019-12-27 16:09:59 +11:00
parent 7437e9e16c
commit 67c82503e6
5 changed files with 42 additions and 9 deletions

View File

@ -26,6 +26,8 @@ extern "C"
#include "rpi-gpio.h" // For SetACTLed #include "rpi-gpio.h" // For SetACTLed
} }
extern u8 deviceID;
static const u32 screenPosXCaddySelections = 240; static const u32 screenPosXCaddySelections = 240;
static const u32 screenPosYCaddySelections = 280; static const u32 screenPosYCaddySelections = 280;
static char buffer[256] = { 0 }; static char buffer[256] = { 0 };
@ -353,10 +355,12 @@ void DiskCaddy::ShowSelectedImage(u32 index)
x = 0; x = 0;
y = 0; y = 0;
snprintf(buffer, 256, " D %d/%d %c " snprintf(buffer, 256, "D%02d D%d/%d %c %s"
, deviceID
, index + 1 , index + 1
, numberOfImages , numberOfImages
, GetImage(index)->GetReadOnly() ? 'R' : ' ' , GetImage(index)->GetReadOnly() ? 'R' : ' '
, roms ? roms->GetSelectedROMName() : ""
); );
screenLCD->PrintText(false, x, y, buffer, 0, RGBA(0xff, 0xff, 0xff, 0xff)); screenLCD->PrintText(false, x, y, buffer, 0, RGBA(0xff, 0xff, 0xff, 0xff));
y += screenLCD->GetFontHeight(); y += screenLCD->GetFontHeight();

View File

@ -22,6 +22,7 @@
#include <vector> #include <vector>
#include "DiskImage.h" #include "DiskImage.h"
#include "Screen.h" #include "Screen.h"
#include "ROMs.h"
class DiskCaddy class DiskCaddy
{ {
@ -32,14 +33,16 @@ public:
, screen(0) , screen(0)
#endif #endif
, screenLCD(0) , screenLCD(0)
, roms(0)
{ {
} }
void SetScreen(Screen* screen, ScreenBase* screenLCD) void SetScreen(Screen* screen, ScreenBase* screenLCD, ROMs* roms)
{ {
#if not defined(EXPERIMENTALZERO) #if not defined(EXPERIMENTALZERO)
this->screen = screen; this->screen = screen;
#endif #endif
this->screenLCD = screenLCD; this->screenLCD = screenLCD;
this->roms = roms;
} }
bool Empty(); bool Empty();
@ -114,6 +117,7 @@ private:
ScreenBase* screen; ScreenBase* screen;
#endif #endif
ScreenBase* screenLCD; ScreenBase* screenLCD;
ROMs* roms;
}; };
#endif #endif

View File

@ -1438,7 +1438,7 @@ void FileBrowser::ClearSelections()
void FileBrowser::ShowDeviceAndROM() void FileBrowser::ShowDeviceAndROM()
{ {
ShowDeviceAndROM( roms->ROMNames[roms->currentROMIndex] ); ShowDeviceAndROM(roms->GetSelectedROMName());
} }
void FileBrowser::ShowDeviceAndROM( const char* ROMName ) void FileBrowser::ShowDeviceAndROM( const char* ROMName )
@ -1447,16 +1447,31 @@ void FileBrowser::ShowDeviceAndROM( const char* ROMName )
u32 textColour = RGBA(0, 0, 0, 0xff); u32 textColour = RGBA(0, 0, 0, 0xff);
u32 bgColour = RGBA(0xff, 0xff, 0xff, 0xff); u32 bgColour = RGBA(0xff, 0xff, 0xff, 0xff);
u32 x = 0; // 43 * 8 u32 x = 0; // 43 * 8
#if not defined(EXPERIMENTALZERO) u32 y;
u32 y = screenMain->ScaleY(STATUS_BAR_POSITION_Y) - 20;
snprintf(buffer, 256, "Device %2d %*s\r\n" #if not defined(EXPERIMENTALZERO)
y = screenMain->ScaleY(STATUS_BAR_POSITION_Y) - 20;
snprintf(buffer, 256, "Device %2d %*s"
, *deviceID , *deviceID
, roms->GetLongestRomNameLen() , roms->GetLongestRomNameLen()
, ROMName , ROMName
); );
screenMain->PrintText(false, x, y, buffer, textColour, bgColour); screenMain->PrintText(false, x, y, buffer, textColour, bgColour);
#endif #endif
if (screenLCD)
{
x = 0;
y = 0;
snprintf(buffer, 256, "D%2d %s"
, *deviceID
, ROMName
);
screenLCD->PrintText(false, x, y, buffer, textColour, bgColour);
screenLCD->SwapBuffers();
}
} }
void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForIcon) void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForIcon)

View File

@ -24,6 +24,11 @@
class ROMs class ROMs
{ {
public: public:
ROMs() :
currentROMIndex(0)
{
}
void SelectROM(const char* ROMName); void SelectROM(const char* ROMName);
inline u8 Read(u16 address) inline u8 Read(u16 address)
@ -53,6 +58,10 @@ public:
unsigned GetLongestRomNameLen() { return longestRomNameLen; } unsigned GetLongestRomNameLen() { return longestRomNameLen; }
unsigned UpdateLongestRomNameLen(unsigned maybeLongest); unsigned UpdateLongestRomNameLen(unsigned maybeLongest);
const char* GetSelectedROMName() const
{
return ROMNames[currentROMIndex];
}
protected: protected:
unsigned longestRomNameLen; unsigned longestRomNameLen;
}; };

View File

@ -554,6 +554,7 @@ void UpdateScreen()
IEC_Bus::WaitMicroSeconds(100); IEC_Bus::WaitMicroSeconds(100);
snprintf(tempBuffer, tempBufferSize, "D%02d %02d.%d", deviceID, (oldTrack >> 1) + 1, oldTrack & 1 ? 5 : 0);
screenLCD->PrintText(false, 0, 0, tempBuffer, 0, RGBA(0xff, 0xff, 0xff, 0xff)); screenLCD->PrintText(false, 0, 0, tempBuffer, 0, RGBA(0xff, 0xff, 0xff, 0xff));
// screenLCD->SetContrast(255.0/79.0*track); // screenLCD->SetContrast(255.0/79.0*track);
screenLCD->RefreshRows(0, 1); screenLCD->RefreshRows(0, 1);
@ -1176,7 +1177,7 @@ void emulator()
roms.lastManualSelectedROMIndex = 0; roms.lastManualSelectedROMIndex = 0;
diskCaddy.SetScreen(&screen, screenLCD); diskCaddy.SetScreen(&screen, screenLCD, &roms);
fileBrowser = new FileBrowser(inputMappings, &diskCaddy, &roms, &deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate()); fileBrowser = new FileBrowser(inputMappings, &diskCaddy, &roms, &deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate());
pi1541.Initialise(); pi1541.Initialise();