PUTBASIC only works to a disc image, so do that, PUTBASIC, extract the file from .ssd, INCBIN, assemble after it, SAVE concatenation!
Locally, I've added INCBASIC which hopefully includes the tokenized BASIC into "memory" at the current assembly point.
I've only given it ONE test as I have to go out, but though I would share my changes here to see what people think.
I've added INCBASIC next to PUTBASIC:
{ "PUTBASIC", &LineParser::HandlePutBasic, 0 },
{ "INCBASIC", &LineParser::HandleIncBasic, 0 },
Renamed HandlePutBasic to HandleIncPutBasic and passed in a bool to choose which behaviour.
void LineParser::HandleIncPutBasic(bool inc)
void LineParser::HandleIncBasic() {HandleIncPutBasic(true);}
void LineParser::HandlePutBasic() {HandleIncPutBasic(false);}
and then changed the end of the old HandlePutBasic function to add the tokenised code, copying from INCBIN!
Code: Select all
if (inc || GlobalData::Instance().IsSecondPass())// && GlobalData::Instance().UsesDiscImage() )
{
Uint8* buffer = new Uint8[ 0x10000 ];
int fileSize;
bool bSuccess = ImportBASIC( hostFilename.c_str(), buffer, &fileSize );
if (!bSuccess)
{
if (GetBASICErrorNum() == 2)
{
AsmException_AssembleError_FileOpen e(this);
e.SetString( m_line );
e.SetColumn( m_column );
throw e;
}
else
{
std::string message = hostFilename + ": " + GetBASICError();
throw AsmException_UserError( m_line, m_column, message );
}
}
if (inc)
{
for (int i = 0; i < fileSize; ++i)
{
ObjectCode::Instance().Assemble1(buffer[i], this);
}
}
else if (GlobalData::Instance().UsesDiscImage())
{
// disc image version of the save
GlobalData::Instance().GetDiscImage()->AddFile( beebFilename.c_str(),
reinterpret_cast< unsigned char* >( buffer ),
0xFFFF1900,
0xFFFF8023,
fileSize );
}
delete [] buffer;
}