Jump to content
IGNORED

[Aquarius] How to load an Assembly program with the Aquarius


Recommended Posts

Hi

I have developed CROSS CHASE,

https://github.com/Fabrizio-Caruso/CROSS-CHASE

which is a massively multi-platform 8-bit game that runs on nearly anything with 8 bits including the Mattel Aquarius (+4k and +16k versions supported).

I have done this through Z88DK which produces two files: a BASIC loader and a file containing the actual Assembly code.
The load procedure looks like this:
type CLOAD
Attach loader file
type RUN
Attach second file

This is a bit inconvenient. I would like to just have one single file to load.

Is there a "good" way to just use a single file?

A "bad" way would be to embed the Assembly into the BASIC with DATA lines because it would eat too much RAM.

Where in memory does CLOAD load the code?

Fabrizio

  • Like 2
Link to comment
Share on other sites

See my response here. If I remember correctly, the compiler used by Z88DK compiles the code to run from expanded RAM, which on the Aquarius begins at address $4000, and the bootloader simply copies the code from tape into RAM and then jumps to $4000 to begin execution. If the compiler can be configured to use address $C010 instead, it should be possible to compile a binary which can run directly from the cartridge like Mattel's first-party Aquarius games, which would be much faster (the reason the program can't start at $C000 is because the first 16 bytes of the cartridge are reserved for a simple cartridge validation signature). If that's not possible, an alternative would be to write a simple cartridge-based bootloader which copies the code from the cartridge into RAM and then jumps into it, as I describe in the other post. The only problem with that approach is that (on real hardware) it would require a Mini Expander, since you'd need to plug in the program cartridge AND a memory module.

Link to comment
Share on other sites

You can append binary code to the end of a BASIC tape file and it will be loaded in with the program, but there is a catch - the end of the tape file is marked with 10 zero bytes, so if your code has 10 consecutive zero bytes in it the tape loader will quit at that point. If you can ensure that the binary doesn't have any more than 9 consecutive zero bytes in it then you're fine, otherwise you have to mangle the data and restore it after loading.

 

CLOAD loads BASIC programs into the memory location stored in $384F,50 (14415,6). In a stock Aquarius this will be $3901, but extended BASIC needs more system variable space so it moves the start of BASIC up to a higher memory location. That means any code you embed in the file will also be moved up, so you can't rely on it being at a fixed memory location. The solution is to compile your code for a location that is guaranteed to be beyond the end of the BASIC loader (eg. $4000), then in your loader move the code to its correct location before jumping into it.

 

On a real Aquarius loading from tape is very slow and unreliable, so it might be better to put it in a cartridge ROM.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...