★ CODING ★ DDI-1 Firmware: The Complete CPC 464 DISC Operating System ROM Specification ★![]() |
DDDI-1 Firmware: Chapter 3. AMSDOS (1/3) |
Chapter 3 - AMSDOS AMSDOS is a disc operating system for the AMSTRAD CPC464 fitted with the DDI-1 floppy disc interface. AMSDOS enables BASIC programs to access disc files in a similar manner to cassette files, indeed existing programs which currently use the cassette should be able to use disc files with little or no modification. The main source of incompatability will be filenames in that, for AMSDOS, filenames must conform to CP/M standards whereas cassette filenames are far less restricted. AMSDOS has been designed to complement CP/M, not to compete with it. They share the same file structure and can read and write each other's files. AMSDOS resides in the same ROM as the CP/M BIOS. AMSDOS provides the following facilities: Switching the cassette input and output streams (ft9) to and from disc. Thus all the facilities available on cassette become available on disc.
For example if the disc contains the files FRED.BAS and FRED.BAK and user issues the command OPENOUT "FRED. BAS" then AMSDOS will create a new file called FRED.$$$. When the command CLOSEOUT is issued the existing FRED.BAK is deleted, FRED.BAS is renamed to FRED.BAK and FRED.$$$ is renamed to FRED.BAS All AMSDOS facilities are implemented either by intercepting the cassette firmware calls or by external commands. The intercepted firmware calls are:
The AMSDOS external commands are:
AMSDOS filenames are upwards compatible with CP/M 2.2 filenames in that the user number may also be specified and non-significant spaces are permitted before and after the name and any embedded punctuation. Examples
The following characters may be used in the name and type parts: letters digits !"#$ & 1 + -3 f v > -C ~ Any other characters will cause the command to fail with the message: Bad command The characters '?' and '*' are wildcards (see the CP/M Operating System Manual). The name part may be up to 8 characters long. The type part may be up to 3 characters long. When parsing a filename AMSDOS will shift lower case letters into upper case and remove bit 7. If the user or drive is omitted then the current default values are assumed. These are user settable. If the type part is omitted then a default type is assumed. This depends on the context in which the name is being used, but usually the default type part of three spaces is assumed. Cassette files are subdivided into 2K blocks each of which is preceded by a header. CP/M files do not have headers. AMSDOS files may, or may not, have a header depending on the contents of the file. This will not cause problems for programs written in BASIC but is an important difference between cassette and disc files. Unprotected ASCII files do not have headers. All other AMSDOS files have a single header in the first 128 bytes of the file, the header record. These headers are detected by checksumming the first 67 bytes of the record. If the checksum is as expected then a header is present, if not then there is no header. Thus it is unlikely, but possible, that a file without a header could be mistaken for one with a header. The format of the header record is as follows:
filename
Under AMSDOS a disc may be changed, or removed, whenever the drive is not being accessed and neither the input nor output files are open on that drive. Unlike CP/M there is no need to ‘log in' a disc. Changing a disc while it is still being written to may corrupt the data on the disc. If a disc is changed while there are still files open on it then, as soon as AMSDOS detects this, all the open files on the drive will be abandoned and an error message produced. Any data yet to be written will be lost and the latest directory entry will not be written to disc. However, AMSDOS can only detect this change when it reads the directory, which it does every 16K of the file and whenever a file is opened or closed. Thus, potentially, 16K of data could be corrupted by changing a disc while there are still files open on it. Note that if there is any doubt as to whether or not there are files open on a drive issuing any of the BASIC commands CAT, RUN, LOAD, CHAIN, MERGE or CHAINMERGE will abandon both the input and output files.
|