While working on the game, I occasionnaly test it on various configurations, including the
bare bone A500 without any RAM expansion.
That means that the game should run with only
512Kb of CHIP RAM.
This shouldn't be an issue for this
genre of classic adventure game, but remember that everything is done using the
AmigaOS calls, and even on an A500 the game is supposed to be
OS-Friendly.
I tried to reclaim memory occupied by the CLI/SHELL screen + window opened by AmigaOS1.3 when booting the game (the game starts using a regular startup sequence) but it turns out the game itself cannot invoke CloseWorkBench() or even EndCli(). 1st option will fail silently, 2nd option will shutdown the game (as it seems to be a child taks of the CLI that we are trying to end).
Anyways... I used a fallback strategy : add21k, aka add44k, aka add36k.
All of these tools use the same trick :
remove one of the bitplanes from the CLI/Workbench screen to free as much memory as possible.
I found one of these on Aminet, and it includes the source code :
https://aminet.net/package.php?package=util/misc/add36k.lzhSo I decided to borrow the routine and add it to the R-Page engine.
The result looks like this :
/// Add36k does nearly the same as 'subbp' or 'add21k', exept that it does not
/// only free 21kb of memory (one std. workbench plane), but in fact 36kb of
/// memory (that is one plane and 250 lines of the others).
/// Original code by Alexander Rawass
VOID add36k(struct IntuitionBase *ibase)
{
long pl0,pl1,plb,ple;
struct Screen *scr;
struct BitMap *bm;
struct Window *win;
ULONG origheight;
if (ibase != NULL)
{
scr = ibase->ActiveScreen;
win = ibase->ActiveWindow;
origheight=scr->Height;
SizeWindow(win,0,-150);
Delay(1*50);
scr->Height=50;
scr->Depth=1;
bm=&scr->BitMap;
bm->Rows=50;
bm->Depth=1;
pl0=bm->Planes[0];
pl1=bm->Planes[1];
bm->Planes[1]=NULL;
plb=pl0+(640*50/8);
ple=pl1+(640*origheight/8);
RemakeDisplay();
FreeMem(plb,ple-plb);
}
}
Once added to the project, it allows the game to allocate more memory to its internal cache. That means the player will have to wait less time when going from a place to another, as the screens/places he visited will remain longer in memory, thus reducing the disk access.
In the end, I might spare this extra memory for something else. Stay tuned!
Without add36k, the screen cache is 90Kb large :
When calling add36k, the screen cache is 135Kb large :
