Mimo's Quest

Compiling for CPC
Compilation was initially done through WinApe's assembler, and then issuing a CALL command to the beginning of the code. As the game increased in size and took longer to load into memory from disc, a loader was needed to display a picture for the player while they waited for the game to load. I had to learn about AMSDOS headers, and how to make a binary file executable.

As the size of the code increased compilation started to overwrite BASIC firmware commands, so I could no longer SAVE or CALL the compiled code. I had to rely on WinApe's internal SAVE DIRECT command to write the compiled code to disc.

These are the main portions of code that need compiled to run the game.

  • loader2.asm - This is the loader for the 64k and 128k version of the game.
  • main128k.asm - This is the main program.
  • tilegraphicsmain128k.asm - The graphics data module (128k and cartridge).
  • spritegraphics4_128k.asm - The sprite data module (128k and cartridge).
  • dictionary_128k.asm - The dictionary data module (128k and cartridge).
  • boot2.asm - Loader for the cartridge game.
  • pluscartfuncs2.asm - Extra functions for the cartridge game.
There are switches at the start of each file which should be enabled or disabled depending on which system you are compiling for. If you are compiling for 64k, then only the compilebinary switch should be enabled. If you are compiling for 128k, then the is128k switch should also be enabled. Each of the modules need to be compiled individually for the 128k version of the game, with care taken to make sure the SAVE DIRECT command covers the entire compiled area of code.

Compiling for Plus
Compiling and testing a cartridge for the Plus machines was a little cumbersome, as it involved running several other commands to make the code readable by WinApe, so I decided to make a bash script to take care of this. RASM assembler is used to compile the loader, the main code and modules, with the -amper switch to enable compatibility with WinApe. Care is needed to make sure the appropriate compilecart and other switches are enabled.

The tilegraphics module also has additional switches which need set to specify which tileset is being compiled. There are three tilesets. The standard tileset, the western tileset and the winter tileset. In the 64k and 128k versions of the game, the tilesets are modified programmatically to achieve different climates, but it is not possible to modify the cartidge ROM so separate tilesets are used instead. Likewise, the extra function code for the cartridge version is accessed directly from the ROM, so care must be taken not to use self-modifying code and pointers to main game functions can only be accessed through a data area of RAM set aside by the program.

The main program code is then split into 16k chunks using the linux SPLIT command. Then the RomInject tool is used to to insert the boot code, the loading picture, the game code and the modules into the correct cartridge slots. This creates a binary file that can be used to burn to an EPROM chip to use on actual Plus hardware. Finally, BuildCPR is used to put the resulting binary file into a fileformat that WinApe can recognize.

My Linux bash script
cd /home/chris/Desktop/MimoSource/
./makecartridge/rasm.exe -amper main128k.asm
#./makecartridge/rasm.exe -amper pluscartfuncs2.asm CARTFUNC
#./makecartridge/rasm.exe -amper tilegraphicsmain128k.asm TILES
#./makecartridge/rasm.exe -amper spritegraphics4_128k.asm SPRITES
#./makecartridge/rasm.exe -amper dictionary_128k.asm DICT

split -b 16k rasmoutput.bin game_mimo_ # SPLIT INTO 16K CHUNKS - THIS GETS COPIED TO RAM WHEN CART LOADS
cd makecartridge

rm ./boot.bin
rm ./mycart.bin

./rasm.exe -amper boot2.asm boot
./rominject -p 0 -o 0 /home/chris/Desktop/MimoSource/boot.bin ./mycart.bin
./rominject -p 1 -o 0 mimopic.bin ./mycart.bin
./rominject -p 2 -o 0 /home/chris/Desktop/MimoSource/game_mimo_aa ./mycart.bin #0000-3FFF CODE
./rominject -p 3 -o 0 /home/chris/Desktop/MimoSource/game_mimo_ab ./mycart.bin #4000-7FFF CODE
./rominject -p 5 -o 0 /home/chris/Desktop/MimoSource/TILES.bin ./mycart.bin
./rominject -p 6 -o 0 /home/chris/Desktop/MimoSource/SPRITES.bin ./mycart.bin
./rominject -p 7 -o 0 /home/chris/Desktop/MimoSource/DICT.bin ./mycart.bin
./rominject -p 8 -o 0 /home/chris/Desktop/MimoSource/TILES001.bin ./mycart.bin # TILES FOR SNOW REGION
./rominject -p 9 -o 0 /home/chris/Desktop/MimoSource/TILES002.bin ./mycart.bin # TILES FOR WESTERN REGION
./rominject -p 10 -o 0 /home/chris/Desktop/MimoSource/CARTFUNC.bin ./mycart.bin # CART FUNCTIONS

rm ./MimosQuest.cpr
rm /media/chris/SAMSUNG/Data/Emulator/WinAPE2021/ROM/MimosQuest.cpr
./buildcpr ./mycart.bin ./MimosQuest.cpr
cp ./MimosQuest.cpr /media/chris/SAMSUNG/Data/Emulator/WinAPE2021/ROM/MimosQuest.cpr

Operation Desert Storm BASIC game

Operation Desert Storm BASIC game

Mimo's Quest