Merge branch 'master' into cleanup
This commit is contained in:
commit
ddfcdbe50b
15 changed files with 239 additions and 149 deletions
|
@ -352,7 +352,7 @@ Drive::Drive() : m_pVIA(0)
|
|||
|
||||
void Drive::Reset()
|
||||
{
|
||||
headTrackPos = 34; // Start with the head over track 18
|
||||
headTrackPos = 0; // Start with the head over track 19 (Very later Vorpal ie Cakifornia Games) need to have had the last head movement -ve
|
||||
CLOCK_SEL_AB = 3; // Track 18 will use speed zone 3 (encoder/decoder (ie UE7Counter) clocked at 1.2307Mhz)
|
||||
UpdateHeadSectorPosition();
|
||||
lastHeadDirection = 0;
|
||||
|
@ -390,8 +390,9 @@ void Drive::DumpTrack(unsigned track)
|
|||
void Drive::OnPortOut(void* pThis, unsigned char status)
|
||||
{
|
||||
Drive* pDrive = (Drive*)pThis;
|
||||
if (pDrive->motor)
|
||||
pDrive->MoveHead(status & 3);
|
||||
pDrive->motor = (status & 4) != 0;
|
||||
pDrive->MoveHead(status & 3);
|
||||
pDrive->CLOCK_SEL_AB = ((status >> 5) & 3);
|
||||
pDrive->LED = (status & 8) != 0;
|
||||
}
|
||||
|
|
|
@ -385,6 +385,7 @@ FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool di
|
|||
, roms(roms)
|
||||
, deviceID(deviceID)
|
||||
, displayPNGIcons(displayPNGIcons)
|
||||
, buttonChangedDevice(false)
|
||||
, screenMain(screenMain)
|
||||
, screenLCD(screenLCD)
|
||||
, scrollHighlightRate(scrollHighlightRate)
|
||||
|
@ -820,128 +821,167 @@ void FileBrowser::UpdateInputFolders()
|
|||
Keyboard* keyboard = Keyboard::Instance();
|
||||
InputMappings* inputMappings = InputMappings::Instance();
|
||||
|
||||
if (folder.entries.size() > 0)
|
||||
if (IEC_Bus::GetInputButtonHeld(4))
|
||||
{
|
||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||
bool dirty = false;
|
||||
|
||||
if (inputMappings->BrowseSelect())
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
if (current->filImage.fattrib & AM_DIR)
|
||||
{
|
||||
if (strcmp(current->filImage.fname, "..") == 0)
|
||||
{
|
||||
PopFolder();
|
||||
}
|
||||
else if (strcmp(current->filImage.fname, ".") != 0)
|
||||
{
|
||||
f_chdir(current->filImage.fname);
|
||||
RefreshFolderEntries();
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(current->filImage.fname, "..") == 0)
|
||||
{
|
||||
PopFolder();
|
||||
}
|
||||
else if (DiskImage::IsDiskImageExtention(current->filImage.fname))
|
||||
{
|
||||
DiskImage::DiskType diskType = DiskImage::GetDiskImageTypeViaExtention(current->filImage.fname);
|
||||
|
||||
// Should also be able to create a LST file from all the images currently selected in the caddy
|
||||
if (diskType == DiskImage::LST)
|
||||
{
|
||||
selectionsMade = SelectLST(current->filImage.fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the current selected
|
||||
AddToCaddy(current);
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
|
||||
if (selectionsMade)
|
||||
lastSelectionName = current->filImage.fname;
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_LOG("DEv8\r\n");
|
||||
GlobalSetDeviceID(8);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
else if (inputMappings->BrowseDone())
|
||||
else if (inputMappings->BrowseUp())
|
||||
{
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
DEBUG_LOG("DEv9\r\n");
|
||||
GlobalSetDeviceID(9);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
else if (inputMappings->BrowseDown())
|
||||
{
|
||||
GlobalSetDeviceID(10);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
//else if (keyboard->KeyPressed(KEY_TAB))
|
||||
//{
|
||||
// state = State_DiskCaddy;
|
||||
// dirty = true;
|
||||
//}
|
||||
else if (inputMappings->BrowseBack())
|
||||
{
|
||||
PopFolder();
|
||||
dirty = true;
|
||||
GlobalSetDeviceID(11);
|
||||
ShowDeviceAndROM();
|
||||
buttonChangedDevice = true;
|
||||
}
|
||||
else if (inputMappings->Exit())
|
||||
{
|
||||
ClearSelections();
|
||||
dirty = true;
|
||||
}
|
||||
else if (inputMappings->BrowseInsert())
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
dirty = AddToCaddy(current);
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseNewD64())
|
||||
{
|
||||
char newFileName[64];
|
||||
strncpy (newFileName, options.GetAutoBaseName(), 63);
|
||||
int num = folder.FindNextAutoName( newFileName );
|
||||
m_IEC_Commands.CreateD64(newFileName, "42", true);
|
||||
FolderChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned keySetIndex;
|
||||
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
||||
{
|
||||
unsigned keySetIndexBase = keySetIndex * 3;
|
||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
{
|
||||
if ( (keySetIndex < ROMs::MAX_ROMS) && (roms->ROMValid[keySetIndex]) )
|
||||
{
|
||||
roms->currentROMIndex = keySetIndex;
|
||||
roms->lastManualSelectedROMIndex = keySetIndex;
|
||||
DEBUG_LOG("Swap ROM %d %s\r\n", keySetIndex, roms->ROMNames[keySetIndex]);
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
|
||||
{
|
||||
GlobalSetDeviceID( keySetIndex+1 );
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirty = folder.CheckBrowseNavigation();
|
||||
}
|
||||
|
||||
if (dirty) RefeshDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inputMappings->BrowseBack())
|
||||
PopFolder();
|
||||
if (folder.entries.size() > 0)
|
||||
{
|
||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||
bool dirty = false;
|
||||
|
||||
if (inputMappings->BrowseSelect())
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
if (current->filImage.fattrib & AM_DIR)
|
||||
{
|
||||
if (strcmp(current->filImage.fname, "..") == 0)
|
||||
{
|
||||
PopFolder();
|
||||
}
|
||||
else if (strcmp(current->filImage.fname, ".") != 0)
|
||||
{
|
||||
f_chdir(current->filImage.fname);
|
||||
RefreshFolderEntries();
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(current->filImage.fname, "..") == 0)
|
||||
{
|
||||
PopFolder();
|
||||
}
|
||||
else if (DiskImage::IsDiskImageExtention(current->filImage.fname))
|
||||
{
|
||||
DiskImage::DiskType diskType = DiskImage::GetDiskImageTypeViaExtention(current->filImage.fname);
|
||||
|
||||
// Should also be able to create a LST file from all the images currently selected in the caddy
|
||||
if (diskType == DiskImage::LST)
|
||||
{
|
||||
selectionsMade = SelectLST(current->filImage.fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the current selected
|
||||
AddToCaddy(current);
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
|
||||
if (selectionsMade)
|
||||
lastSelectionName = current->filImage.fname;
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseDone())
|
||||
{
|
||||
selectionsMade = FillCaddyWithSelections();
|
||||
}
|
||||
//else if (keyboard->KeyPressed(KEY_TAB))
|
||||
//{
|
||||
// state = State_DiskCaddy;
|
||||
// dirty = true;
|
||||
//}
|
||||
else if (inputMappings->BrowseBack())
|
||||
{
|
||||
PopFolder();
|
||||
dirty = true;
|
||||
}
|
||||
else if (inputMappings->Exit())
|
||||
{
|
||||
ClearSelections();
|
||||
dirty = true;
|
||||
}
|
||||
else if (inputMappings->BrowseInsert())
|
||||
{
|
||||
if (buttonChangedDevice)
|
||||
{
|
||||
buttonChangedDevice = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
if (current)
|
||||
{
|
||||
dirty = AddToCaddy(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (inputMappings->BrowseNewD64())
|
||||
{
|
||||
char newFileName[64];
|
||||
strncpy (newFileName, options.GetAutoBaseName(), 63);
|
||||
int num = folder.FindNextAutoName( newFileName );
|
||||
m_IEC_Commands.CreateD64(newFileName, "42", true);
|
||||
FolderChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned keySetIndex;
|
||||
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
||||
{
|
||||
unsigned keySetIndexBase = keySetIndex * 3;
|
||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
{
|
||||
if ( (keySetIndex < ROMs::MAX_ROMS) && (roms->ROMValid[keySetIndex]) )
|
||||
{
|
||||
roms->currentROMIndex = keySetIndex;
|
||||
roms->lastManualSelectedROMIndex = keySetIndex;
|
||||
DEBUG_LOG("Swap ROM %d %s\r\n", keySetIndex, roms->ROMNames[keySetIndex]);
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
|
||||
{
|
||||
GlobalSetDeviceID( keySetIndex+1 );
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirty = folder.CheckBrowseNavigation();
|
||||
}
|
||||
|
||||
if (dirty) RefeshDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inputMappings->BrowseBack())
|
||||
PopFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,6 +230,7 @@ private:
|
|||
ROMs* roms;
|
||||
u8* deviceID;
|
||||
bool displayPNGIcons;
|
||||
bool buttonChangedDevice;
|
||||
|
||||
BrowsableList caddySelections;
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ unsigned InputMappings::directDiskSwapRequest = 0;
|
|||
|
||||
InputMappings::InputMappings()
|
||||
: keyboardBrowseLCDScreen(false)
|
||||
, insertButtonPressedPrev(false)
|
||||
, insertButtonPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,8 +49,13 @@ bool InputMappings::CheckButtonsBrowseMode()
|
|||
SetButtonFlag(DOWN_FLAG);
|
||||
else if (IEC_Bus::GetInputButtonPressed(3))
|
||||
SetButtonFlag(BACK_FLAG);
|
||||
else if (IEC_Bus::GetInputButtonPressed(4))
|
||||
//else if (IEC_Bus::GetInputButtonPressed(4))
|
||||
// SetButtonFlag(INSERT_FLAG);
|
||||
|
||||
insertButtonPressed = !IEC_Bus::GetInputButtonReleased(4);
|
||||
if (insertButtonPressedPrev && !insertButtonPressed)
|
||||
SetButtonFlag(INSERT_FLAG);
|
||||
insertButtonPressedPrev = insertButtonPressed;
|
||||
|
||||
return buttonFlags != 0;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,9 @@ protected:
|
|||
|
||||
bool keyboardBrowseLCDScreen;
|
||||
|
||||
bool insertButtonPressedPrev;
|
||||
bool insertButtonPressed;
|
||||
|
||||
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
||||
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
||||
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
||||
|
|
|
@ -27,12 +27,14 @@ extern "C"
|
|||
|
||||
unsigned char frame[SSD1306_128x64_BYTES];
|
||||
|
||||
SSD1306::SSD1306(int BSCMaster, u8 address, int flip, int type)
|
||||
SSD1306::SSD1306(int BSCMaster, u8 address, unsigned width, unsigned height, int flip, LCD_MODEL type)
|
||||
: BSCMaster(BSCMaster)
|
||||
, address(address)
|
||||
, type(type)
|
||||
, flip(flip)
|
||||
, contrast(127)
|
||||
, width(width)
|
||||
, height(height)
|
||||
{
|
||||
RPI_I2CInit(BSCMaster, 1);
|
||||
|
||||
|
@ -45,7 +47,7 @@ void SSD1306::InitHardware()
|
|||
SendCommand(SSD1306_CMD_DISPLAY_OFF); // 0xAE
|
||||
|
||||
SendCommand(SSD1306_CMD_MULTIPLEX_RATIO); // 0xA8
|
||||
SendCommand(0x3F); // SSD1306_LCDHEIGHT - 1
|
||||
SendCommand(height-1); // SSD1306_LCDHEIGHT - 1
|
||||
|
||||
SendCommand(SSD1306_CMD_SET_DISPLAY_OFFSET); // 0xD3 Vertical scroll position
|
||||
SendCommand(0x00); // no Offset
|
||||
|
@ -61,7 +63,10 @@ void SSD1306::InitHardware()
|
|||
}
|
||||
|
||||
SendCommand(SSD1306_CMD_SET_COM_PINS); // 0xDA Layout and direction
|
||||
SendCommand(0x12);
|
||||
if (type == LCD_1306_128x32)
|
||||
SendCommand(0x02);
|
||||
else
|
||||
SendCommand(0x12);
|
||||
|
||||
SetContrast(GetContrast());
|
||||
|
||||
|
@ -86,7 +91,7 @@ void SSD1306::InitHardware()
|
|||
|
||||
Home();
|
||||
|
||||
if (type != 1106)
|
||||
if (type != LCD_1106_128x64)
|
||||
SendCommand(SSD1306_CMD_DEACTIVATE_SCROLL); // 0x2E
|
||||
}
|
||||
|
||||
|
@ -115,23 +120,23 @@ void SSD1306::Home()
|
|||
MoveCursorByte(0, 0);
|
||||
}
|
||||
|
||||
void SSD1306::MoveCursorByte(u8 row, u8 col)
|
||||
void SSD1306::MoveCursorByte(u8 page, u8 col)
|
||||
{
|
||||
if (col > 127) { col = 127; }
|
||||
if (row > 7) { row = 7; }
|
||||
if (col > width-1) { col = width-1; }
|
||||
if (page > height/8-1) { page = height/8-1; }
|
||||
|
||||
if (type == 1106)
|
||||
if (type == LCD_1106_128x64)
|
||||
col += 2; // sh1106 uses columns 2..129
|
||||
|
||||
SendCommand(SSD1306_CMD_SET_PAGE | row); // 0xB0 page address
|
||||
SendCommand(SSD1306_CMD_SET_PAGE | page); // 0xB0 page address
|
||||
SendCommand(SSD1306_CMD_SET_COLUMN_LOW | (col & 0xf)); // 0x00 column address lower bits
|
||||
SendCommand(SSD1306_CMD_SET_COLUMN_HIGH | (col >> 4)); // 0x10 column address upper bits
|
||||
}
|
||||
|
||||
void SSD1306::RefreshScreen()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
unsigned i;
|
||||
for (i = 0; i < height/8; i++)
|
||||
{
|
||||
RefreshPage(i);
|
||||
}
|
||||
|
@ -151,9 +156,19 @@ void SSD1306::RefreshRows(u32 start, u32 amountOfRows)
|
|||
|
||||
void SSD1306::RefreshPage(u32 page)
|
||||
{
|
||||
if (page >= height/8)
|
||||
return;
|
||||
|
||||
// x32 displays use lower half (pages 2 and 3)
|
||||
if (type == LCD_1306_128x32)
|
||||
{
|
||||
page = page+4; // 0,1,2,3 -> 4,5,6,7
|
||||
page = page%4; // and wrap it so 4,5 -> 0,1
|
||||
}
|
||||
|
||||
int i;
|
||||
int start = page*128;
|
||||
int end = page*128 + 128;
|
||||
int start = page*width;
|
||||
int end = start + width;
|
||||
|
||||
MoveCursorByte(page, 0);
|
||||
for (i = start; i < end; i++)
|
||||
|
@ -183,7 +198,7 @@ void SSD1306::SetContrast(u8 value)
|
|||
contrast = value;
|
||||
SendCommand(SSD1306_CMD_SET_CONTRAST_CONTROL);
|
||||
SendCommand(value);
|
||||
if (type == 1306)
|
||||
if (type != LCD_1106_128x64) // dont fiddle vcomdeselect on 1106 displays
|
||||
SetVCOMDeselect( value >> 8);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class SSD1306
|
|||
public:
|
||||
// 128x32 0x3C
|
||||
// 128x64 0x3D or 0x3C (if SA0 is grounded)
|
||||
SSD1306(int BSCMaster = 1, u8 address = 0x3C, int flip = 0, int type=1306);
|
||||
SSD1306(int BSCMaster = 1, u8 address = 0x3C, unsigned width = 128, unsigned height = 64, int flip = 0, LCD_MODEL type=LCD_UNKNOWN);
|
||||
|
||||
void PlotCharacter(int x, int y, char ascii, bool inverse);
|
||||
void PlotText(int x, int y, char* str, bool inverse);
|
||||
|
@ -110,6 +110,8 @@ protected:
|
|||
int type;
|
||||
int flip;
|
||||
int contrast;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
#include "debug.h"
|
||||
#include "ssd_logo.h"
|
||||
|
||||
void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, int LCDType)
|
||||
void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, LCD_MODEL LCDType)
|
||||
{
|
||||
bpp = 1;
|
||||
|
||||
if (widthDesired < 128)
|
||||
widthDesired = 128;
|
||||
if (heightDesired < 64)
|
||||
heightDesired = 64;
|
||||
if (heightDesired < 32)
|
||||
heightDesired = 32;
|
||||
if (widthDesired > 128)
|
||||
widthDesired = 128;
|
||||
if (heightDesired > 64)
|
||||
|
@ -39,7 +39,7 @@ void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int B
|
|||
width = widthDesired;
|
||||
height = heightDesired;
|
||||
|
||||
ssd1306 = new SSD1306(BSCMaster, LCDAddress, LCDFlip, LCDType);
|
||||
ssd1306 = new SSD1306(BSCMaster, LCDAddress, width, height, LCDFlip, LCDType);
|
||||
ssd1306->ClearScreen();
|
||||
ssd1306->RefreshScreen();
|
||||
ssd1306->DisplayOn();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "ScreenBase.h"
|
||||
#include "SSD1306.h"
|
||||
#include "options.h"
|
||||
|
||||
class ScreenLCD : public ScreenBase
|
||||
{
|
||||
|
@ -32,7 +33,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void Open(u32 width, u32 height, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, int LCDType);
|
||||
void Open(u32 width, u32 height, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, LCD_MODEL LCDType);
|
||||
|
||||
void ClearArea(u32 x1, u32 y1, u32 x2, u32 y2, RGBA colour);
|
||||
void Clear(RGBA colour);
|
||||
|
|
|
@ -582,9 +582,10 @@ public:
|
|||
}
|
||||
|
||||
static bool GetInputButtonPressed(int buttonIndex) { return InputButton[buttonIndex] && !InputButtonPrev[buttonIndex]; }
|
||||
static bool GetInputButtonReleased(int buttonIndex) { return !InputButton[buttonIndex] && InputButtonPrev[buttonIndex]; }
|
||||
static bool GetInputButtonReleased(int buttonIndex) { return InputButton[buttonIndex] == false; }
|
||||
static bool GetInputButton(int buttonIndex) { return InputButton[buttonIndex]; }
|
||||
static bool GetInputButtonRepeating(int buttonIndex) { return inputRepeat[buttonIndex] != inputRepeatPrev[buttonIndex]; }
|
||||
static bool GetInputButtonHeld(int buttonIndex) { return inputRepeatThreshold[buttonIndex] >= INPUT_BUTTON_DEBOUNCE_THRESHOLD + (INPUT_BUTTON_REPEAT_THRESHOLD * 2); }
|
||||
|
||||
static bool OutputLED;
|
||||
static bool OutputSound;
|
||||
|
|
24
src/main.cpp
24
src/main.cpp
|
@ -46,7 +46,7 @@ extern "C"
|
|||
#include "ssd_logo.h"
|
||||
|
||||
unsigned versionMajor = 1;
|
||||
unsigned versionMinor = 8;
|
||||
unsigned versionMinor = 9;
|
||||
|
||||
// When the emulated CPU starts we execute the first million odd cycles in non-real-time (ie as fast as possible so the emulated 1541 becomes responsive to CBM-Browser asap)
|
||||
// During these cycles the CPU is executing the ROM self test routines (these do not need to be cycle accurate)
|
||||
|
@ -365,26 +365,30 @@ void InitialiseLCD()
|
|||
int i2cLcdOnContrast = options.I2CLcdOnContrast();
|
||||
int i2cLcdDimContrast = options.I2CLcdDimContrast();
|
||||
int i2cLcdDimTime = options.I2CLcdDimTime();
|
||||
int i2cLcdModel = options.I2CLcdModel();
|
||||
LCD_MODEL i2cLcdModel = options.I2CLcdModel();
|
||||
|
||||
if (i2cLcdModel)
|
||||
{
|
||||
int width = 128;
|
||||
int height = 64;
|
||||
if (i2cLcdModel == LCD_1306_128x32)
|
||||
height = 32;
|
||||
screenLCD = new ScreenLCD();
|
||||
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, i2cLcdModel);
|
||||
screenLCD->Open(width, height, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, i2cLcdModel);
|
||||
screenLCD->SetContrast(i2cLcdOnContrast);
|
||||
screenLCD->ClearInit(0); // sh1106 needs this
|
||||
|
||||
bool logo_done = false;
|
||||
if (strcasecmp(options.GetLcdLogoName(), "1541ii") == 0)
|
||||
if ( (height == 64) && (strcasecmp(options.GetLcdLogoName(), "1541ii") == 0) )
|
||||
{
|
||||
screenLCD->PlotRawImage(logo_ssd_1541ii, 0, 0, 128, 64);
|
||||
screenLCD->PlotRawImage(logo_ssd_1541ii, 0, 0, width, height);
|
||||
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
|
||||
screenLCD->PrintText(0, 16, 0, tempBuffer, 0xffffffff);
|
||||
logo_done = true;
|
||||
}
|
||||
else if (strcasecmp(options.GetLcdLogoName(), "1541classic") == 0)
|
||||
else if (( height == 64) && (strcasecmp(options.GetLcdLogoName(), "1541classic") == 0) )
|
||||
{
|
||||
screenLCD->PlotRawImage(logo_ssd_1541classic, 0, 0, 128, 64);
|
||||
screenLCD->PlotRawImage(logo_ssd_1541classic, 0, 0, width, height);
|
||||
logo_done = true;
|
||||
}
|
||||
else if (f_stat(options.GetLcdLogoName(), &filLcdIcon) == FR_OK && filLcdIcon.fsize <= LCD_LOGO_MAX_SIZE)
|
||||
|
@ -398,7 +402,7 @@ void InitialiseLCD()
|
|||
u32 bytesRead;
|
||||
f_read(&fp, LcdLogoFile, LCD_LOGO_MAX_SIZE, &bytesRead);
|
||||
f_close(&fp);
|
||||
screenLCD->PlotRawImage(LcdLogoFile, 0, 0, 128, 64);
|
||||
screenLCD->PlotRawImage(LcdLogoFile, 0, 0, width, height);
|
||||
logo_done = true;
|
||||
}
|
||||
}
|
||||
|
@ -406,8 +410,8 @@ void InitialiseLCD()
|
|||
if (!logo_done)
|
||||
{
|
||||
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
|
||||
int x = (128 - 8*strlen(tempBuffer) ) /2;
|
||||
int y = (64-16)/2;
|
||||
int x = (width - 8*strlen(tempBuffer) ) /2;
|
||||
int y = (height-16)/2;
|
||||
screenLCD->PrintText(0, x, y, tempBuffer, 0x0);
|
||||
}
|
||||
screenLCD->RefreshScreen();
|
||||
|
|
|
@ -145,7 +145,7 @@ Options::Options(void)
|
|||
, i2cScan(0)
|
||||
, i2cLcdFlip(0)
|
||||
, i2cLcdOnContrast(127)
|
||||
, i2cLcdModel(0)
|
||||
, i2cLcdModel(LCD_UNKNOWN)
|
||||
, scrollHighlightRate(0.125f)
|
||||
, keyboardBrowseLCDScreen(0)
|
||||
{
|
||||
|
@ -241,9 +241,11 @@ void Options::Process(char* buffer)
|
|||
{
|
||||
strncpy(LCDName, pValue, 255);
|
||||
if (strcasecmp(pValue, "ssd1306_128x64") == 0)
|
||||
i2cLcdModel = 1306;
|
||||
i2cLcdModel = LCD_1306_128x64;
|
||||
else if (strcasecmp(pValue, "ssd1306_128x32") == 0)
|
||||
i2cLcdModel = LCD_1306_128x32;
|
||||
else if (strcasecmp(pValue, "sh1106_128x64") == 0)
|
||||
i2cLcdModel = 1106;
|
||||
i2cLcdModel = LCD_1106_128x64;
|
||||
|
||||
}
|
||||
else if ((strcasecmp(pOption, "ROM") == 0) || (strcasecmp(pOption, "ROM1") == 0))
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef OPTIONS_H
|
||||
#define OPTIONS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
class TextParser
|
||||
{
|
||||
public:
|
||||
|
@ -77,7 +79,7 @@ public:
|
|||
inline unsigned int I2CLcdOnContrast() const { return i2cLcdOnContrast; }
|
||||
inline unsigned int I2CLcdDimContrast() const { return i2cLcdDimContrast; }
|
||||
inline unsigned int I2CLcdDimTime() const { return i2cLcdDimTime; }
|
||||
inline unsigned int I2CLcdModel() const { return i2cLcdModel; }
|
||||
inline LCD_MODEL I2CLcdModel() const { return i2cLcdModel; }
|
||||
|
||||
inline const char* GetLcdLogoName() const { return LcdLogoName; }
|
||||
|
||||
|
@ -123,7 +125,8 @@ private:
|
|||
unsigned int i2cLcdOnContrast;
|
||||
unsigned int i2cLcdDimContrast;
|
||||
unsigned int i2cLcdDimTime;
|
||||
unsigned int i2cLcdModel;
|
||||
// unsigned int i2cLcdModel;
|
||||
LCD_MODEL i2cLcdModel = LCD_UNKNOWN;
|
||||
|
||||
float scrollHighlightRate;
|
||||
|
||||
|
|
|
@ -892,12 +892,14 @@ static int stbi__mad3sizes_valid(int a, int b, int c, int add)
|
|||
stbi__addsizes_valid(a*b*c, add);
|
||||
}
|
||||
|
||||
#ifndef STBI_NO_LINEAR
|
||||
// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow
|
||||
static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)
|
||||
{
|
||||
return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&
|
||||
stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);
|
||||
}
|
||||
#endif
|
||||
|
||||
// mallocs with size overflow checking
|
||||
static void *stbi__malloc_mad2(int a, int b, int add)
|
||||
|
@ -912,11 +914,13 @@ static void *stbi__malloc_mad3(int a, int b, int c, int add)
|
|||
return stbi__malloc(a*b*c + add);
|
||||
}
|
||||
|
||||
#ifndef STBI_NO_LINEAR
|
||||
static void *stbi__malloc_mad4(int a, int b, int c, int d, int add)
|
||||
{
|
||||
if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;
|
||||
return stbi__malloc(a*b*c*d + add);
|
||||
}
|
||||
#endif
|
||||
|
||||
// stbi__err - error
|
||||
// stbi__errpf - error returning pointer to float
|
||||
|
|
|
@ -9,5 +9,11 @@ typedef unsigned long long u64;
|
|||
|
||||
typedef signed long long s64;
|
||||
|
||||
typedef enum {
|
||||
LCD_UNKNOWN,
|
||||
LCD_1306_128x64,
|
||||
LCD_1306_128x32,
|
||||
LCD_1106_128x64,
|
||||
} LCD_MODEL;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue