A FAT filesystem rom for the Amstrad CPC X-Mass expansion.
* Hardware: An Amstrad CPC with a ROM board and a X-Mass expansion.
* Software: AcmeDOS must be placed in any rom place before the Amsdos rom.
##BASIC commands compatibility
CLOSEIN, CLOSEOUT, LOAD, OPENIN, OPENOUT, RUN", SAVE, MERGE
##Amsdos RSXs compatibility
|DRIVE, |DIR, |ERA, |REN
|^D (Read Sector), |^E (Write Sector), |^F (Format Track)
##Firmware calls compatibility
CAS_IN_OPEN, CAS_IN_CLOSE, CAS_IN_ABANDON, CAS_IN_DIRECT,
CAS_OUT_OPEN, CAS_OUT_CLOSE, CAS_OUT_ABANDON, CAS_OUT_CHAR,
CAS_IN_CHAR, CAS_OUT_DIRECT, CAS_RETURN, CAS_TEST_EOF,
CAS_CATALOG (not 100% compatible).
##Extra RSX Commands
|HD, |D, |CD, |MD, |RD, |RM, |FORMAT, |CPH (*1), |UDIR (*2)
Not enabled yet:
|CP, |MV, |DD
(*1) |CPH is not more a 5 minutes dirty hack, now it's a 10 minutes dirty hack and it will copy (amsdos compatible) files of unlimited file size (CPC speaking) from floppies to the HD. But as the gremlins, you need to follow the rules:
1.- Make a folder where you want to put the files (|MD)
2.- Enter in the folder (|CD)
3.- Go to the floppy drive (|A or |B)
4.- MAKE A CAT! (sorry i was lazy :P... but it's in the todo list)
5.- And transfer all the files that you want, using with |CPH,"filename"
Note: This command can be used now in your own programs for making simple HD installers for your amsdos friendly software. The command only will use for its buffers 2,5 KBs of RAM before HIMEM. For example, a simply basic installer for the Pac-Man Emulator would be:
10 |D:|MD,"PACMAN":|CD,"PACMAN":REM Make destination folder
20 |A:CAT:REM The pacman floppy is in the drive A
30 |CPH,"PACMAN.BIN":|CPH,"PACMAN.6E":|CPH,"PACMAN.6F":|CPH,"PACMAN.6H":|CPH,"PACMAN.6J":REM Copy files
40 PRINT "PAC-MAN Emulator was installed in your X-MASS!"
(*2) |UDIR: Send a catalogue to an user routine. We need to remember that the original idea is supporting every CPC machine, and for compatibility i tried to be careful with the use of RAM. Because that we don't use any extra ram buffer is not being used by Amsdos, and our CAS_CATALOG implementation doesn't put the files and folder in the typical 2 KB buffer that Amsdos asks. We simply print each entry when they are read in the catalogue.
That means programs using the data that CAS_CATALOG put in that buffer are not going to be compatible with this software. In this moment, only our graphic viewer uses this undocumented feature. In our todo list there is a CAS_CATALOG_OLD function that would try to be more compatible with software using the original firmware call, but only if there is enough software to justify this.
But for new software you can use our |UDIR rsx for handling the catalogue entries, it works like this:
1.- You have 3 bytes starting in $BEA3, where you set a JP $hhll ($C3,$ll,$hh) to your routine. If there is a 0 in $BEA3, |UDIR will do nothing. Those bytes are in the zone of the X-MASS variables and it will be initialized to 0 with every reset.
2.- Your routine is going to be called with every catalogue entry and it will receive those two parameters:
* HL = Location of null terminated file/folder name string
* B = File flag (1 = directory, 0 = file)
At the same time, if you need it, you can get the size in bytes of the file. This is located in:
* FILESIZE_CACHE_LSW EQU BASIC_INPUT_AREA + $100 - 4
* FILESIZE_CACHE_MSW EQU BASIC_INPUT_AREA + $100 - 2
The only bad thing is BASIC_INPUT_AREA is in $AC8A in firmware 1.1, but it's in $ACA4 in firmware 1.0 (CPC 464 with original rom).
Maybe i should send this using IX and DE.
3.- Your routine needs to return with RET and in this moment you can use every register freely, but maybe this could change in the future.
* We follow the Amsdos filename loader, that means RUN"filename will try to load a file using this name, in case there is not file with this name, it will try first for filename.bas and then for filename.bin... boring code for something that you can fix with a simple rename... and saving 4 bytes in a file loader is not a clever optimization, it's being lazy :P
* By interoperability with other OS and protecting the nerd, we are limiting the filenames at only using ASCII chars during save operations. But the loading operations support files with funny names and CAT will interpret control codes for showing amazing Cat Arts. In this moment, we are using this feature for fast configuration of palettes, screen modes, windows, etc... using a folder with special filenames.
* If you reset the CPC after using a program, you could get a crash when you are using any HD command. Usually it's because the program corrupted the AcmeDOS variables ram zone, and then AcmeDOS will access to a sector in the HD that it's not part of the FAT. The fix is easy, only introduce |CD,"\" or |CD,"/" (unix and win users happy!) for going to the root of the drive (nice tip by Bernhard). Why is not initialized the sector number with every reset? Because when a binary file is executed with RUN"filename, the firmware will initialized the upper roms before giving the control to the program; that means we would lose the active folder and every additional file read/write operation would go to the root, and no multipart or save game would load, for example.
* It looks some people has never used an RSX in his life (lovely zx users!) and hate to read any manual at all, for them, this mini guide to the standard RSXs:
|HD, |D : For select the HD as active drive for the system.
|DRIVE,"drive" : Select a drive as the new active drive, the drive
string can be "D" or "HD" for selecting the
X-Mass drive. Any other value will be redirected
to the firmware for being handled by AMSDOS or
PARADOS. Amsdos only checks for "A" or "B", and
show "bad command" for anything else; and Parados
handles one extra case, if you don't pass any
parameters, then the internal Parados file tool is
|FORMAT : Fast Format the X-Mass drive.
|CD,"folder" : Change to that folder.
|CD,"/" or "\" : Go to the root folder.
|CD,"." : Stay in the actual folder.
|CD,".." : Change to previous folder.
|CD : Show the actual path.
|MD,"folder" : Make a new folder.
|RD,"folder" : Remove the folder (only if it's empty).
|REN,"new","old": Change the name of a folder (new name goes first).
|ERA,"file" : Remove a file
|RM,"file" : Remove a file
|REN,"new","old": Change the name of a file
|DIR, CAT : Show a catalogue of the active folder
* Fix all the bugs that people are going to find.
* Enable the RSX command for making disk images.
* Support deeper paths in DIR and CD commands.
* Add the copy (CP) and move (MV) commands for manipulating files in the HD, although the release of that amazing file commander will do this work obsolete.
* Handle Amsdos wildcards and drive selection in the filenames.
* Finish the c style stdio api for programs killing the firmware.
V0.7.9B: CAS OUT CHAR implemented (and amazing madram trick added to CPH).
V0.7.6B: Silly bug fixed and countdown to CAS OUT CHAR started.
V0.7.5B: 'Tony Stark' Edition (undocumented CAS IN CHAR features added).
V0.7.4B: 'Lord of the Rings' Edition (only one program to rule them all :P).
V0.7.3B: 'Notepad+4 CPC Edition' (more bugs fixed in CAS_IN_CHAR).
V0.7.2B: Adding more error messages and fixing minor bugs.
V0.7.1B: Add support to |CPH for copying Ascii files.
V0.7.0B: Implementation of CAS_IN_CHAR, CAS_RETURN and CAS_TEST_EOF.
V0.6.4B: Fixing the flags returned by CAS_IN_DIRECT with certain files.
V0.6.3B: Better fix for the previous bug.
V0.6.2B: Fixing the spurious bug in the root dir reposition after formatting the drive.
V0.6.1B: Fixed the '|MD, something' bug.
V0.6B: First public beta (Dedicated to Jens and Bernhard for all their amazing beta tests).