CODINGDDI-1 Firmware: The Complete CPC 464 DISC Operating System ROM Specification

DDDI-1 Firmware: Chapter 3. AMSDOS (1/3)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

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.

3.1 Features

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.

  • Displaying the disc directory.
  • Erasing disc files.
  • Renaming disc files.
  • Selecting the default drive and user.
Whenever AMSDOS creates a new file it is always given a name with a type part of . $ $ $ regardless of the given name. When the file is closed any previous version of the file is renamed with a . B A K type part and the new version is renamed from .$$$ to its proper name. Any existing . BAK version is deleted. This gives an automatic one level file back-up.

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:

  • CAS IN OPEN
  • CAS IN CHAR
  • CAS IN DIRECT
  • CAS RETURN
  • CAS TEST EOF
  • CAS IN CLOSE
  • CAS IN ABANDON
  • CAS OUT OPEN
  • CAS OUT CHAR
  • CAS OUT DIRECT
  • CAS OUT CLOSE
  • CAS OUT ABANDON
  • CAS CATALOG
The remaining cassette firmware calls are not intercepted and remain unaffected.

The AMSDOS external commands are:

  • A Select default drive A:
  • B Select default drive B:
  • C PM Cold boot CP/M
  • DIR Display disc directory
  • DISC Redirect cassette routines to disc
  • DISC.IN Redirect cassette input routines to disc
  • DISC.OUT Redirect cassette output routines to disc
  • DRIVE Select default drive.
  • ERA Erase files
  • REN Rename a file
  • TAPE Redirect cassette routines to cassette
  • TAPE.IN Redirect cassette input routines to cassette
  • TAPE.OUT Redirect cassette output routines to cassette
  • USER Select default user
From BASIC all these commands must be preceded by a ‘|' and some require parameters.

3.2 Filenames

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

  • ANAME default user, drive and type
    10:ANOTHER.BAS default drive, explicit user number
  • 2A:WOMBAT.TXT all parts specified
  • * . * default user, default drive, all files
  • 5B : POSSUM . $$$ a name with non-significant spaces
  • a:aard?ark lowercase, AMSDOS will convert to upper case.
If given, the user number must be in the range 0.. 15, the drive letter must be A or B. If either the user or the drive is given they must be followed by a colon.

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.

3.3 File Headers

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:

  • bytes 0..63
    • Cassette header (see below)
  • bytes 64..66
    • Length of the file in bytes, excluding the header record. 24 bit number, least significant byte in lowest address
  • bytes 67..68
    • Sixteen bit checksum, sum of bytes 0..66
  • bytes 69..127
    • Undefined
The cassette header fields are used by AMSDOS as follows (see the main firmware documentation for the cassette use of the header):

filename

  • byte 0
    • user number, #00.. #0F
  • bytes 1..8
    • name part, padded with spaces
  • bytes 9.. 11
    • type part, padded with spaces
  • bytes 12..15 #00
The filename in the header is the filename used to create the file. If the actual name or user is subsequently changed this entry is not updated
  • block number
    • byte 16 not used, set to 0
  • last block
    • byte 17 not used, set to 0
  • file type
    • byte 18 as per cassette
  • data length
    • bytes 19..20 as per cassette
  • data location
    • bytes 19. .20 as per cassette
  • first block
    • byte 23 set to # FF, only used for output files
  • logical length
    • bytes 24. .25 as per cassette
  • entry address
    • bytes 26. .27 as per cassette
  • unallocated
    • bytes 28. .63 as per cassette
When a file without a header is opened for input a fake header is constructed in store as follows:
  • filename
    • byte0 user number, #00..#0F
    • bytes 1..8 name part, padded with spaces
    • bytes 9.. 11 type part, padded with spaces
    • bytes 12..15 0
  • file type
    • byte 18 # 16, unprotected ASCII version 1
  • data location
    • bytes 19..20 address of 2K buffer
  • first block
    • byte 23 #FF
All other fields are set to zero

3.4 Changing Discs

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.

★ AUTHOR: Paul OVERELL
★ NOTE: RÉF SOFT158A

Page précédente : DDI-1 Firmware: Chapter 2 - CP/M 2.2 and the BIOS (3/3)
Je participe au site:

» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.732-desktop
Page créée en 449 millisecondes et consultée 913 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.