Jump to content


[AQUARIUS] Micro-Expander: RAM, ROM, AY-8910 and more!

77 replies to this topic

#76 Bruce Abbott OFFLINE  

Bruce Abbott

    Star Raider

  • Topic Starter
  • 98 posts

Posted Thu Apr 13, 2017 7:16 PM

Making good progress tidying up the firmware. The debugger is sorted, USB disk handling is now more robust, and directory listings now pause when the screen is full. I added a HEX$() function to convert 16 bit integers to hexadecimal strings.


I tried to implement subdirectories, but it was harder than I thought. The CH376 changes to the subdirectory when it is opened, but forgets about it after opening a file. So I will have to cache the directory names and traverse the full path every time. I am thinking one directory level will be enough, then I only have to find 8 bytes to store its name (note: long names will not be supported!).


The debugger steals a bit over 2k of RAM for internal use. There's still almost 32k free so this hasn't been a problem for me. However I will provide an option to disable the debugger for those who want the maximum possible RAM available in BASIC. The micro-expander takes a 64k EPROM but only uses 16K of it, so you could have 4 different firmware versions selectable via the jumpers on the board. One pair might be needed to select between NTSC and PAL, then the other two would be debugger on/off. Alternatively the debugger could be disabled from the splash screen or via a BASIC command.


There is still ~1.8k of free space in the 16K ROM, so If anyone has any ideas for improvements or additions, now is the time to speak up! 


Attached is a current snapshot of the source code (it totals just under 10,000 lines of Z80 assembly language), and a ROM image which can be run in Virtual Aquarius (note: anything that tries to access USB won't work in the simulator!). Since Virtual Aquarius doesn't have a built-in debugger, this ROM could be quite useful for software development. 

Attached Files

Edited by Bruce Abbott, Thu Apr 13, 2017 7:16 PM.

#77 Bruce Abbott OFFLINE  

Bruce Abbott

    Star Raider

  • Topic Starter
  • 98 posts

Posted Sun Apr 23, 2017 5:21 PM

And now... subdirectories!!!





Attached Thumbnails

  • rootdir.jpg
  • subdir.jpg
  • subdirs.jpg

#78 Bruce Abbott OFFLINE  

Bruce Abbott

    Star Raider

  • Topic Starter
  • 98 posts

Posted Sat Apr 29, 2017 6:23 AM

Subdirectories are working well, and the system is now a lot more tolerant of disk errors. Testing showed up a few old bugs which I fixed today. Can't think of much else to add so it's time to wrap up the firmware and write some documentation.


Here's a list of BASIC enhancements:-


File commands:

DIR  ["wildcard"] - print disk directory on screen. Optional wildcard filter eg. "*.BAS"

CAT - print list of files on screen, 3 files per line. 

LOAD "filename" [address] - load BASIC program or binary data/code

SAVE "filename" [address, length] - save BASIC program or binary data/code

KILL "filename" - delete file from disk

RUN "filename" - run BASIC or machine code program

CD "path" - change directory


LOAD accepts BASIC programs and arrays with CAQ tape file headers (extension ".CAQ"). BASIC programs and arrays are also saved with a CAQ header, but can be named with whatever extension you want (".BAS" recommended for BASIC programs). 


RUN accepts a filename without extension. If the file is not found then first ".BAS" and then ".BIN" will be added and another attempt made. This saves some typing when running programs from disk! The closing '"' is not required unless more arguments follow, which saves more typing!


CD accepts a single subdirectory or full path. ".." = up one level. "/" = root directory. CD with no argument shows the current path.



CD "subdir"

CD "subdir/subdir2/subdir3"

CD ".."

CD "/"

CD "/subdir"



NOTE: "\" is not supported!


CTRL-O = ~ (tilde). This character is required for entering MSDOS equivalents of long filenames. Alternatively you can type '=', which will be translated into '~' when the filename is processed.


Other commands and functions:

CALL  address - call machine code program

DEBUG - invoke debugger

EDIT line_number - edit BASIC line with insert, delete, cursor movement keys

HEX$(number) - convert 16 bit integer to hexadecimal string


The command line also has enhanced editing. Keys are:-

CTRL-P = cursor left

CTRL-/  = cursor right

CTRL-\  = delete char under cursor

CTL-R   = recall last line (no more having to type the whole line again!)


Commands and functions stolen from BLBASIC







OUT port




Many ROM routines can be called by user programs through vectors placed at the beginning of the ROM starting at $C000. These have fixed addresses and so are guaranteed to not move around in future firmware versions.


It's now 12:15am and I've been up since 3:00am yesterday - time to get some sleep! But the Aquarius is playing a nice collection of AY music, and I don't want to stop it...


0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users