Fabrizio Caruso Posted February 23, 2018 Share Posted February 23, 2018 HiI 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 CLOADAttach loader file type RUNAttach second fileThis 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 2 Quote Link to comment Share on other sites More sharing options...
jaybird3rd Posted February 25, 2018 Share Posted February 25, 2018 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. Quote Link to comment Share on other sites More sharing options...
Bruce Abbott Posted February 26, 2018 Share Posted February 26, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.