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

DDI-1 Firmware: Chapter 3. AMSDOS (3/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

3.6 External Commands

|CPM

Action:

  • This command shuts down BASIC and AMSDOS and cold boots CP/M.

Parameters:

  • None.

Notes:

  • MC START PROGRAM is used so all ticker chains etc are lost.
  • The CP/M utility AMSDOS.COM performs the inverse function and restores AMSDOS and BASIC.
|DISC.IN

Action:

  • This command redirects the tape input firmware entries to their disc counterparts.

Parameters:

  • None

Notes:

  • The redirected firmware entries are:
    • CAS IN OPEN
    • CAS IN CLOSE
    • CAS IN ABANDON
    • CAS IN CHAR
    • CAS IN DIRECT
    • CAS RETURN
    • CAS TEST EOF
    • CAS CATALOG
|DISC.OUT

Action:

  • This command redirects the tape output firmware entries to their disc counterparts.

Parameters:

  • None.

Notes:

  • The redirected firmware entries are:
    • CAS OUT OPEN
    • CAS OUT CLOSE
    • CAS OUT ABANDON
    • CAS OUT CHAR
    • CAS OUT DIRECT
|DISC

Action:

  • This command redirects both the tape input and output firmware entries to their disc counterparts.

Parameters:

  • None

Notes:

The redirected firmware entries are:

  • CAS IN OPEN
  • CAS IN CLOSE
  • CAS IN ABANDON
  • CAS IN CHAR
  • CAS IN DIRECT
  • CAS RETURN
  • CAS TEST EOF
  • CAS CATALOG
  • CAS OUT OPEN
  • CAS OUT CLOSE
  • CAS OUT ABANDON
  • CAS OUT CHAR
  • CAS OUT DIRECT

|DISC is equivalent to the two commands |DISC.IN |DISC.OUT.

|TAPE.IN

Action:

  • This command restores the tape input firmware entries to the state they were before AMSDOS was initialized.

Parameters:

  • None.

Notes:

The restored firmware entries are:

  • CAS IN OPEN
  • CAS IN CLOSE
  • CAS IN ABANDON
  • CAS IN CHAR
  • CAS IN DIRECT
  • CAS RETURN
  • CAS TEST EOF
  • CAS CATALOG
|TAPE.OUT

Action:

  • This command restores the tape output firmware entries to the state they were before AMSDOS was initialized.

Parameters:

  • None.

Notes:

The restored firmware entries are:

  • CAS OUT OPEN
  • CAS OUT CLOSE
  • CAS OUT ABANDON
  • CAS OUT CHAR
  • CAS OUT DIRECT
|TAPE

Action:

  • This command restores the tape firmware entries to the state they were before

AMSDOS was initialized.

Parameters:

  • None.

Notes:

The restored firmware entries are:

  • CAS IN OPEN
  • CAS IN CLOSE
  • CAS IN ABANDON
  • CAS IN CHAR
  • CAS IN DIRECT
  • CAS RETURN
  • CAS TEST EOF
  • CAS CATALOG
  • CAS OUT OPEN
  • CAS OUT CLOSE
  • CAS OUT ABANDON
  • CAS OUT CHAR
  • CAS OUT DIRECT

|TAPE is equivalent to the two commands |TAPE.IN |TAPE.OUT

|A

Action:

  • Set the default drive to drive A.

Parameters:

  • None.

Notes:

  • This command is equivalent to the | DRIVE command with 'A' as a parameter.
  • This command will fail if AMSDOS is unable to determine the format of the disc in drive A. In which case the default drive will not be changed.
  • When AMSDOS is initialized the default drive is set to drive A.
|B

Action:

  • Set the default drive to drive B.

Parameters:

  • None.

Notes:

  • This command is equivalent to the |DRIVE command with ‘B' as a parameter.
  • The command will fail if AMSDOS is unable to determine the format of the disc in drive B. In which case the default drive is not changed.
  • When AMSDOS is initialized the default drive is set to drive A.
|DRIVEAction:
  • Set the current default drive.

Parameters:

  • One string parameter.

Notes:

  • The string parameter must be a single letter in the range ‘A'..‘P' or ‘a'..‘p'. Drives ‘C'..‘P' are for future enhancement.
  • The command will fail if AMSDOS is unable to determine the format of the disc in the requested drive. In which case the default drive will remain unchanged.
  • When AMSDOS is initialized the default drive is set to drive A.
  • In BASIC string parameters must be passed by address, e.g.

10 a$ = "A"
20 |DRIVE,@A$

|USER

Action:

  • Set the default user number.

Parameters:

  • One integer parameter.

Notes:

  • The user number must be in the range 0..15. Any other parameter will cause an error and the default user will remain unchanged.
  • When AMSDOS is initialized the default user number is set to 0.
|DIR

Action:

  • Display the disc directory.

Parameters:

  • One optional string parameter.

Notes:

  • The parameter is a filename, possibly containing wild cards, only those files which match this filename are displayed. If the parameter is omitted then ‘*. *' is assumed.
  • The total amount of free space on the disc is shown in Kbytes.
  • The directory is displayed in as many columns as will fit in the current text window (stream #0).
  • Files marked SYS are not shown.
  • Files without an extent zero are not shown.
  • Unlike CAS CATALOG (DISC) the directory is neither sorted nor are the sizes shown. The output is similar to that of the CP/M DIR command.
  • In BASIC string parameters must be passed by address, e.g.

10 F$ = "*.BAS"
20 |DIR,@F$

|ERA

Action:

  • Erase files.

Parameters:

  • One string parameter.

Notes:

  • The string parameter is a filename, possibly containing wild cards. All files which match this filename are erased.
  • A file which matches the filename but is marked R/O will not be erased. In this event a message is displayed for each 16K (extent) of the file.
  • If none of the files on the disc match the filename then an error message is displayed.
  • In BASIC string parameters must be passed by address, e.g.

10 F$="FILE.BAS"
20 |ERA,@F$

|REN

Action:

  • Rename a file.

Parameters:

  • Two string parameters.

Notes:

  • The first string parameter is the new name for the file. A file of this name must not already exist. The second parameter is the name of the file to be renamed.
  • Neither name may contain wild cards.
  • Both files must be on the same drive.
  • The files may be in different users.
  • If the file to be renamed is marked R/O then an error message is displayed and the file is not renamed.
  • The renamed file will have attributes R/W DIR regardless of the original file's attributes.
  • If the file to be renamed does not exist then an error message is displayed.
  • In BASIC string parameters must be passed by address, e.g.

10 OLDNAME$ = "OLDNAME.BAS"
20 NEWNAMES = "NEWNAME.BAS"
30 |REN,@NEWNAME$, @OLDNAME$

3.7 AMSDOS Messages

AMSDOS uses the CP/M BIOS in order to access the disc. Thus BIOS messages will be displayed in the event of a disc error. This section explains the meaning of the AMSDOS messages.

In the following < drive > means A or B. < Filename > means an AMSDOS filename.

Bad command

There is a syntax error in a command or filename.

< Filename > already exists

The user is trying to rename a file to a name which has already been used.

< Filename > not found

The user is trying to open for input, erase or rename a file that does not exist.

Drive < drive >: directory full

There are no more free directory entries (there are 64 directory entries per disc).

Drive < drive >: disc full

There are no more free disc blocks.

Drive < drive >: disc changed, closing < filename >

The user has changed the disc while files were still open on it.

< Filename > is read only

The user is trying to erase or rename a file which is marked read-only. May also be caused by closing a file when the existing version of the file is read-only.

3.8 BIOS Facilities Available To AMSDOS

AMSDOS uses the CP/M BIOS to access the disc. In order that a program running under AMSDOS may access the disc directly nine of the BIOS extended jumpblock routines are available.

The routines are accessed as external commands. To find the address of the required routine call KL FIND COMMAND. The command names are single control characters (Ctrl A. .Ctrl I) as these cannot be typed in from BASIC.

NOTE ** the BIOS extended jumpblock itself is not available, indeed it does not exist in an AMSDOS environment **.

The BIOS routines available and their command names are as follows:

  • SET MESSAGE Ctrl A (#01)
  • SETUP DISC Ctrl B(#02)
  • SELECT FORMAT Ctrl C (#03)
  • READ SECTOR Ctrl D (#04)
  • WRITE SECTOR Ctrl E (#05)
  • FORMAT TRACK Ctrl F(#06)
  • MOVE TRACK Ctrl G(#07)
  • GET DR STATUS Ctrl H(#08)
  • SET RETRY COUNT Ctrl I (#09)

See chapter 2.14 for the interfaces to these routines.

The word at #BE40 contains the address of the disc parameter header vector. Disc parameter headers and extended disc parameter blocks may be patched as required. (See Chapter 2.15 for details.)

Only the BIOS facilities mentioned here may be used from a program running under AMSDOS.

3.9 Store Requirements

When initialized AMSDOS reserves # 500 bytes of memory from the memory pool and the kernel reserves another 4 for its external command chaining information.

When loading a machine code program from disc into store using the AMSDOS routine CAS IN DIRECT it is important that AMSDOS's variables are not overwritten. This presents a problem since in general it is not possible to discover where these variables are! This is because variables for expansion ROMs are allocated dynamically. Note that this problem does not arise when loading from the cassette since the cassette manager's variables are in the firmware variable area.

AMSDOS reserves store from the top of the memory pool so the simplest solution is to always load machine code programs into the bottom of store. The program can then relocate itself to a higher address if required.

Alternatively the machine code program could be loaded in two stages: first load and run a small loader in the bottom of store. The action of MC BOOT PROGRAM will have shut down all RSXs and extension ROMs. The loader program should now initialize AMSDOS using KLINIT BACK thus forcing the AMSDOS variables to be wherever you so wish. The loader can now load the machine code program using the AMSDOS routines CAS OPEN IN, CAS IN DIRECT and CAS IN CLOSE together with MC START PROGRAM.

In order to initialize AMSDOS using KL INIT BACK, AMSDOS's ROM number is required. To determine AMSDOS's ROM number look at any of the intercepted cassette jumpblock entries with the DISC routines selected. Each entry is a far call, the address part of which points at a three byte far address, the third byte of the far address is the ROM number. This must obviously be done before AMSDOS is shut down.

Existing machine code programs, devoloped on cassette systems without any expansion ROMs, frequently only use store to # ABFF in order to avoid BASIC's variables. These can be easily modified to use AMSDOS. Write some machine code to initialize AMSDOS using KL INIT BACK. AMSDOS will reserve RAM down to #ABFC, almost the same as used by BASIC.

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

Page précédente : DDI-1 Firmware: Chapter 3. AMSDOS (2/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.7-desktop
Page créée en 072 millisecondes et consultée 425 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.