Repo: https://github.com/drmortalwombat/oscar64.git
Notes:
drmortalwombat (oscar64 author) gave me the advice (in this FR: https://github.com/drmortalwombat/oscar64/issues/183) to follow the TMACH_ATARI and TMACH_X16 machine-type enums, in order to get a feeling for the additions needed to add Oric support.
Here, a bread-crumb trail and notes I've made so far regarding what changes are needed to add Oric support - I'm hoping some of the Oric deep crew will pitch in with their ideas/corrections to my ideas, as I don't have a lot of confidence on any of this yet - it *seems as though it would be quite simple to add Oric support*, with the two most difficult things being to ensure the Zero Page System Variable indexes are correct, that the various Memory regions are correctly defined, and that an approprite writeTapFile() function be written, which could possibly be sourced from/compared with that of OSDK's existing functions:
Zero Page System Variable Indexes:
Code: Select all
//Compiler.cpp:55
bool Compiler::ParseSource(void)
{
if (mTargetMachine == TMACH_ATARI)
{
BC_REG_WORK_Y = 0x80;
BC_REG_WORK = 0x81;
BC_REG_FPARAMS = 0x8b;
BC_REG_FPARAMS_END = 0x97;
BC_REG_IP = 0x97;
BC_REG_ACCU = 0x99;
BC_REG_ADDR = 0x9d;
BC_REG_STACK = 0xa1;
BC_REG_LOCALS = 0xa3;
BC_REG_TMP = 0xa5;
BC_REG_TMP_SAVED = 0xc5;
}
Code: Select all
if (mTargetMachine == TMACH_ORIC) {
BC_REG_WORK = $00;
BC_REG_WORK_Y = $02;
BC_REG_FPARAMS = $20;
BC_REG_FPARAMS_END = $2F;
BC_REG_IP = $30;
BC_REG_ACCU = $34;
BC_REG_ADDR = $36; // .. $37;
BC_REG_STACK = $40; // ..$5F;
BC_REG_LOCALS = $60; // ..-$7F;
BC_REG_TMP = $04;
BC_REG_TMP_SAVED = $08;
}
Zero-Page Compiler Variable space:
Code: Select all
Compiler.cpp:504
// bool Compiler::GenerateCode(void) ...
LinkerRegion* regionZeroPage = mLinker->FindRegion(identZeroPage);
if (!regionZeroPage)
{
if (mTargetMachine == TMACH_ATARI)
regionZeroPage = mLinker->AddRegion(identZeroPage, 0x00e0, 0x00ff);
else if (mCompilerOptions & (COPT_EXTENDED_ZERO_PAGE | COPT_TARGET_NES))
regionZeroPage = mLinker->AddRegion(identZeroPage, 0x0080, 0x00ff);
else
regionZeroPage = mLinker->AddRegion(identZeroPage, 0x00f7, 0x00ff);
}
Code: Select all
if (mTargetMachine == TMACH_ORIC) {
regionZeroPage = mLinker->AddRegion(identZeroPage, 0x0080, 0x00FF);
}
Code: Select all
Compiler.cpp:1310
if (mTargetMachine == TMACH_ATARI)
{
strcat_s(prgPath, "xex");
if (mCompilerOptions & COPT_VERBOSE)
printf("Writing <%s>\n", prgPath);
mLinker->WriteXexFile(prgPath);
}
Set the BASIC Start region for Oric:
Code: Select all
oscar64.c00:447
else if (!strcmp(targetMachine, "x16"))
{
strcpy_s(basicStart, "0x0801");
compiler->mTargetMachine = TMACH_X16;
compiler->AddDefine(Ident::Unique("__X16__"), "1");
}
Code: Select all
oscar64.c00:447
else if (!strcmp(targetMachine, "oric"))
{
strcpy_s(basicStart, "0x0501");
compiler->mTargetMachine = TMACH_ORIC;
}
Okay, that is my first (albeit quite glib) pass at breadcrumb trailing the tweaks needed to add Oric support to Oscar64 - would be great to hear some feedback from those of you more knowledgeable, and maybe we can see about adding Oric support in the Oscar64 compiler, relatively quickly ..