Fixed bug with a 128 (in 128 mode) not booting.

Also added the option for a 128 to auto load FB128.
This commit is contained in:
Stephen White 2018-08-12 14:40:06 +10:00
parent e7b477dbe3
commit be5b1a0312
6 changed files with 74 additions and 2 deletions

View File

@ -36,6 +36,9 @@ OnResetChangeToStartingFolder = 1
// If you use FB64 (CBMFileBrowser) and want to use a fast loader cartridge (AR6, EFL, FC3) to load it then use this option to autmatically mount it.
//AutoMountImage = fb.d64 // You MUST have a disk image in \1541 with this filename
// If you are using a FB128 in 128 mode you can get FB128 to auto boot using this option
//AutoBootFB128 = 1
// If you would ever like to disable browse mode completely ypu can do so here
//DisableSD2IECCommands = 1

View File

@ -235,6 +235,7 @@ IEC_Commands::IEC_Commands()
{
deviceID = 8;
usingVIC20 = false;
autoBootFB128 = false;
Reset();
starFileName = 0;
}
@ -1718,8 +1719,66 @@ void IEC_Commands::OpenFile()
Channel& channel = channels[secondary];
if (channel.command[0] == '#')
{
Channel& channelCommand = channels[15];
// Direct acces is unsupported. Without a mounted disk image tracks and sectors have no meaning.
//DEBUG_LOG("Driect access\r\n");
if (strcmp((char*)channelCommand.buffer, "U1:13 0 01 00") == 0)
{
// This is a 128 trying to auto boot
memset(channel.buffer, 0, 256);
channel.cursor = 256;
if (autoBootFB128)
{
int index = 0;
channel.buffer[0] = 'C';
channel.buffer[1] = 'B';
channel.buffer[2] = 'M';
index += 3;
index += 4;
channel.buffer[index++] = 'P';
channel.buffer[index++] = 'I';
channel.buffer[index++] = '1';
channel.buffer[index++] = '5';
channel.buffer[index++] = '4';
channel.buffer[index++] = '1';
channel.buffer[index++] = ' ';
channel.buffer[index++] = 'F';
channel.buffer[index++] = 'B';
channel.buffer[index++] = '1';
channel.buffer[index++] = '2';
channel.buffer[index++] = '8';
index++;
channel.buffer[index++] = 'F';
channel.buffer[index++] = 'B';
channel.buffer[index++] = '1';
channel.buffer[index++] = '2';
channel.buffer[index++] = '8';
index++;
channel.buffer[index++] = 0xa2;
channel.buffer[index] = (index + 5);
index++;
channel.buffer[index++] = 0xa0;
channel.buffer[index++] = 0xb;
channel.buffer[index++] = 0x4c;
channel.buffer[index++] = 0xa5;
channel.buffer[index++] = 0xaf;
channel.buffer[index++] = 'R';
channel.buffer[index++] = 'U';
channel.buffer[index++] = 'N';
channel.buffer[index++] = '\"';
channel.buffer[index++] = 'F';
channel.buffer[index++] = 'B';
channel.buffer[index++] = '1';
channel.buffer[index++] = '2';
channel.buffer[index++] = '8';
channel.buffer[index++] = '\"';
}
if (SendBuffer(channel, true))
return;
}
}
else if (channel.command[0] == '$')
{
@ -1771,7 +1830,7 @@ void IEC_Commands::OpenFile()
{
if (strcasecmp(cwd, "/1541") == 0)
{
DEBUG_LOG("use star %s\r\n", starFileName);
//DEBUG_LOG("use star %s\r\n", starFileName);
strncpy(filename, starFileName, sizeof(filename) - 1);
}
}

View File

@ -71,6 +71,8 @@ public:
void SetDeviceId(u8 id) { deviceID = id; }
u8 GetDeviceId() { return deviceID; }
void SetAutoBootFB128(bool autoBootFB128) { this->autoBootFB128 = autoBootFB128; }
void Reset(void);
void SimulateIECBegin(void);
UpdateAction SimulateIECUpdate(void);
@ -157,6 +159,7 @@ protected:
bool receivedCommand : 1;
bool receivedEOI : 1; // End Or Identify
bool usingVIC20 : 1; // When sending data we need to wait longer for the 64 as its VICII may be stealing its cycles. VIC20 does not have this problem and can accept data faster.
bool autoBootFB128 : 1;
u8 deviceID;
u8 secondaryAddress;

View File

@ -46,7 +46,7 @@ extern "C"
#include "ssd_logo.h"
unsigned versionMajor = 1;
unsigned versionMinor = 11;
unsigned versionMinor = 12;
// 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)
@ -685,6 +685,8 @@ void emulator()
fileBrowser->DisplayRoot();
pi1541.Initialise();
m_IEC_Commands.SetAutoBootFB128(options.AutoBootFB128());
emulating = false;
while (1)

View File

@ -138,6 +138,7 @@ Options::Options(void)
, invertIECOutputs(1)
, splitIECLines(0)
, ignoreReset(0)
, autoBootFB128(0)
, screenWidth(1024)
, screenHeight(768)
, i2cBusMaster(1)
@ -214,6 +215,7 @@ void Options::Process(char* buffer)
ELSE_CHECK_DECIMAL_OPTION(invertIECOutputs)
ELSE_CHECK_DECIMAL_OPTION(splitIECLines)
ELSE_CHECK_DECIMAL_OPTION(ignoreReset)
ELSE_CHECK_DECIMAL_OPTION(autoBootFB128)
ELSE_CHECK_DECIMAL_OPTION(screenWidth)
ELSE_CHECK_DECIMAL_OPTION(screenHeight)
ELSE_CHECK_DECIMAL_OPTION(i2cBusMaster)

View File

@ -69,6 +69,8 @@ public:
inline unsigned int InvertIECOutputs() const { return invertIECOutputs; }
inline unsigned int IgnoreReset() const { return ignoreReset; }
inline unsigned int AutoBootFB128() const { return autoBootFB128; }
inline unsigned int ScreenWidth() const { return screenWidth; }
inline unsigned int ScreenHeight() const { return screenHeight; }
@ -114,6 +116,7 @@ private:
unsigned int invertIECOutputs;
unsigned int splitIECLines;
unsigned int ignoreReset;
unsigned int autoBootFB128;
unsigned int screenWidth;
unsigned int screenHeight;