Difference between revisions of "AMSDOS"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
* [[AMSDOS Hidden RSX Functions]]
 
* [[AMSDOS Hidden RSX Functions]]
 
* [[AMSDOS Memory Map]]
 
* [[AMSDOS Memory Map]]
 +
 +
<br>
  
 
== AMSDOS command reference ==
 
== AMSDOS command reference ==
  
=== |A ===
+
{| class="wikitable"
 +
! Command
 +
! Operation
 +
|-
 +
| '''&#124;A''' || Makes drive A: the default disk drive. The result equals that of DRIVE with parameter A. On a CPC664, CPC6128 or 6128plus, normally the built-in disk drive is A:.
 +
|-
 +
| '''&#124;B''' || Makes drive B: the default disk drive. The result equals that of DRIVE with parameter B. On a CPC664, CPC6128 or 6128plus, normally the built-in disk drive is A:.
 +
|-
 +
| '''&#124;CPM''' || Boots a disk operating system from a system disk. CPCs came with CP/M 2.2 (CPC464, CPC664, CPC6128) and/or CP/M Plus (CPC6128, 6128plus). The command has no effect if no system disk is inserted. Some games also used this method in order to be started. Note that CPCs could be modified on the PCB in order to automatically perform the same thing as &#124;CPM on power up.
 +
|-
 +
| '''&#124;DIR''' || &#124;DIR[,&lt;text argument&gt;]  <br /> &#124;DIR,"*.BAS" <br /> Shows the contents of the current disk (in CP/M style) as well as the free disk space. If &lt;text argument&gt; is omitted, *.* is assumed.
 +
|-
 +
| '''&#124;DISC''' || Equals the commands &#124;DISC.IN plus &#124;DISC.OUT
 +
|-
 +
| '''&#124;DISC.IN''' || Switches to disk as file input media.
 +
|-
 +
| '''&#124;DISC.OUT''' || Switches to disk as file output media.
 +
|-
 +
| '''&#124;DRIVE''' || &#124;DRIVE,&lt;text argument&gt; <br /> &#124;DRIVE,"A" <br /> Sets the default drive. This command only works when there is a readable disk in the chosen drive.
 +
|-
 +
| '''&#124;ERA''' || &#124;ERA,&lt;text argument&gt; <br /> &#124;ERA,"*.BAK" <br /> Erases all files matching the text argument which aren't set as read-only. Wildcards can be used.
 +
|-
 +
| '''&#124;REN''' || &#124;REN,&lt;text argument&gt;,&lt;text argument&gt; <br /> &#124;REN,"NEWNAME.BAS","OLDNAME.BAS" <br /> Renames a file. A file with the new file name may not already exist. Wildcards aren't allowed. For &lt;text argument&gt;, the USER parameter can also be used: <br /> &#124;REN,"0:NEW.BAS","15:OLD.BAS" <br /> The file OLD.BAS from USER 15 will be renamed to NEW.BAS and assigned to USER 0, regardless which USER number was chosen before.
 +
|-
 +
| '''&#124;TAPE''' || Equals the commands &#124;TAPE.IN plus &#124;TAPE.OUT
 +
|-
 +
| '''&#124;TAPE.IN''' || Uses the tape recorder as file input media.
 +
|-
 +
| '''&#124;TAPE.OUT''' || Uses the tape recorder as file output media.
 +
|-
 +
| '''&#124;USER''' || &#124;USER,&lt;integer expression&gt; <br /> &#124;USER,3 <br /> Chooses, which of the 16 possible sections of the directory (from 0 to 15) applies to disk commands (e.g. CAT, LOAD, &#124;DIR, a.s.o.). A file can be moved from one user number to another using the &#124;REN command. E.g. <br /> &#124;REN,"15:EXAMPLE.BAS","0:EXAMPLE.BAS" <br /> moves the file EXAMPLE.BAS from USER 0 to USER 15 without changing its name.
 +
|}
  
Makes drive A: the default disk drive. The result equals that of |DRIVE with parameter A. On a CPC664, CPC6128 or 6128plus, normally the built-in disk drive is A:.
+
Note: In fact, more user areas exist. Deleted files for example are in reality only moved to USER 229 (hexadecimal &amp;E5).
  
=== |B ===
+
You can choose another user with a POKE into AMSDOS variables. For example, '''poke &a701,&e5''' provides access to the deleted files or USER 229 (recycle bin). |Ren,"0:filename.typ","filename.typ" moves the deleted file filename.typ from USER 229 to USER 0. Another example, '''poke &a701,&a2''' provides access to USER 162.
  
Makes drive B: the default disk drive. The result equals that of |DRIVE with parameter B. On a CPC664, CPC6128 or 6128plus, normally the built-in disk drive is A:.
+
<br>
  
=== |CPM ===
+
== Intercepted Firmware Calls ==
  
Boots a disk operating system from a system disk. CPCs came with CP/M 2.2 (CPC464, CPC664, CPC6128) and/or CP/M Plus (CPC6128, 6128plus). The command has no effect if no system disk is inserted. Some games also used this method in order to be started. Note that CPCs could be modified on the PCB in order to automatically perform the same thing as |CPM on power up.
+
Besides these external commands, AMSDOS facilities are implemented by intercepting these cassette firmware calls:
 +
*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 OUT CATALOG
  
=== |DIR ===
+
The remaining cassette firmware calls are not intercepted and remain unaffected.
  
|DIR[,&lt;text argument&gt;]
+
<br>
 
+
|DIR,"*.BAS"
+
 
+
Shows the contents of the current disk (in CP/M style) as well as the free disk space. If &lt;text argument&gt; is omitted, *.* is assumed.
+
 
+
=== |DISC ===
+
 
+
Equals the commands |DISC.IN plus |DISC.OUT
+
 
+
=== |DISC.IN ===
+
 
+
Switches to disk as file input media.
+
 
+
=== |DISC.OUT ===
+
 
+
Switches to disk as file output media.
+
 
+
=== |DRIVE ===
+
 
+
|DRIVE,&lt;text argument&gt;
+
 
+
|DRIVE,"A"
+
 
+
Sets the default drive. This command only works when there is a readable disk in the chosen drive.
+
 
+
=== |ERA ===
+
 
+
|ERA,&lt;text argument&gt;
+
 
+
|ERA,"*.BAK"
+
 
+
Erases all files matching the text argument which aren't set as read-only. Wildcards can be used.
+
 
+
=== |REN ===
+
 
+
|REN,&lt;text argument&gt;,&lt;text argument&gt;
+
 
+
|REN,"NEWNAME.BAS","OLDNAME.BAS"
+
 
+
Renames a file. A file with the new file name may not already exist. Wildcards aren't allowed. For &lt;text argument&gt;, the USER parameter can also be used (see [[AMSDOS#.7CUSER||USER]]):
+
 
+
|REN,"0:NEW.BAS","15:OLD.BAS"
+
 
+
the file OLD.BAS from USER 15 will be renamed to NEW.BAS and assigned to USER 0, regardless which USER number was chosen before.
+
 
+
=== |TAPE ===
+
 
+
Equals the commands |TAPE.IN plus |TAPE.OUT
+
 
+
=== |TAPE.IN ===
+
 
+
Uses the tape recorder as file input media.
+
 
+
=== |TAPE.OUT ===
+
 
+
Uses the tape recorder as file output media.
+
 
+
=== |USER ===
+
 
+
|USER,&lt;integer expression&gt;
+
 
+
|USER,3
+
 
+
Chooses, which of the 16¹ possible sections of the directory (from 0 to 15) applies to disk commands (e.g. CAT, LOAD, |DIR, a.s.o.). A file can be moved from one user number to another using the |REN command. E.g.
+
 
+
|REN,"15:EXAMPLE.BAS","0:EXAMPLE.BAS"
+
 
+
moves the file EXAMPLE.BAS from USER 0 to USER 15 without changing its name.
+
 
+
¹: In fact, more user areas exist. Deleted files for example are in reality only moved to USER 229 (hexadecimal &amp;E5). You can choose another user with a POKE into AMSDOS variables.
+
  
 
== CAS TEST EOF ==
 
== CAS TEST EOF ==
Line 102: Line 78:
 
* If the opened file doesn't have a header then hard EOF is signaled at the end of the current record (Each record is 128 bytes). e.g. if reading a file without a header which is meant to be 2 bytes long, hard eof will not be signalled until byte 128.  
 
* If the opened file doesn't have a header then hard EOF is signaled at the end of the current record (Each record is 128 bytes). e.g. if reading a file without a header which is meant to be 2 bytes long, hard eof will not be signalled until byte 128.  
 
* If the opened file does have a header then hard EOF is signaled at the end of the data defined by the header. (i.e. if there is a header and the file has length 2, hard EOF is signalled when reading the third byte).
 
* If the opened file does have a header then hard EOF is signaled at the end of the data defined by the header. (i.e. if there is a header and the file has length 2, hard EOF is signalled when reading the third byte).
 +
 +
<br>
  
 
== BASDOS ==
 
== BASDOS ==

Latest revision as of 04:39, 13 October 2024

AMSDOS is the disk operating system for the Amstrad computers. It allows the computer to handle two 178k single-sided drives. It does not features directories, but instead uses user numbers, from 0 to 15 (and up to 255 with a trick) The disk are 9 sectors and 40 tracks.

AMSDOS also adds 14 RSX commands to the Locomotive BASIC command set.

BIOS Functions and Memory Map related to AMSDOS


AMSDOS command reference

Command Operation
|A Makes drive A: the default disk drive. The result equals that of DRIVE with parameter A. On a CPC664, CPC6128 or 6128plus, normally the built-in disk drive is A:.
|B Makes drive B: the default disk drive. The result equals that of DRIVE with parameter B. On a CPC664, CPC6128 or 6128plus, normally the built-in disk drive is A:.
|CPM Boots a disk operating system from a system disk. CPCs came with CP/M 2.2 (CPC464, CPC664, CPC6128) and/or CP/M Plus (CPC6128, 6128plus). The command has no effect if no system disk is inserted. Some games also used this method in order to be started. Note that CPCs could be modified on the PCB in order to automatically perform the same thing as |CPM on power up.
|DIR |DIR[,<text argument>]
|DIR,"*.BAS"
Shows the contents of the current disk (in CP/M style) as well as the free disk space. If <text argument> is omitted, *.* is assumed.
|DISC Equals the commands |DISC.IN plus |DISC.OUT
|DISC.IN Switches to disk as file input media.
|DISC.OUT Switches to disk as file output media.
|DRIVE |DRIVE,<text argument>
|DRIVE,"A"
Sets the default drive. This command only works when there is a readable disk in the chosen drive.
|ERA |ERA,<text argument>
|ERA,"*.BAK"
Erases all files matching the text argument which aren't set as read-only. Wildcards can be used.
|REN |REN,<text argument>,<text argument>
|REN,"NEWNAME.BAS","OLDNAME.BAS"
Renames a file. A file with the new file name may not already exist. Wildcards aren't allowed. For <text argument>, the USER parameter can also be used:
|REN,"0:NEW.BAS","15:OLD.BAS"
The file OLD.BAS from USER 15 will be renamed to NEW.BAS and assigned to USER 0, regardless which USER number was chosen before.
|TAPE Equals the commands |TAPE.IN plus |TAPE.OUT
|TAPE.IN Uses the tape recorder as file input media.
|TAPE.OUT Uses the tape recorder as file output media.
|USER |USER,<integer expression>
|USER,3
Chooses, which of the 16 possible sections of the directory (from 0 to 15) applies to disk commands (e.g. CAT, LOAD, |DIR, a.s.o.). A file can be moved from one user number to another using the |REN command. E.g.
|REN,"15:EXAMPLE.BAS","0:EXAMPLE.BAS"
moves the file EXAMPLE.BAS from USER 0 to USER 15 without changing its name.

Note: In fact, more user areas exist. Deleted files for example are in reality only moved to USER 229 (hexadecimal &E5).

You can choose another user with a POKE into AMSDOS variables. For example, poke &a701,&e5 provides access to the deleted files or USER 229 (recycle bin). |Ren,"0:filename.typ","filename.typ" moves the deleted file filename.typ from USER 229 to USER 0. Another example, poke &a701,&a2 provides access to USER 162.


Intercepted Firmware Calls

Besides these external commands, AMSDOS facilities are implemented by intercepting these cassette firmware calls:

  • 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 OUT CATALOG

The remaining cassette firmware calls are not intercepted and remain unaffected.


CAS TEST EOF

  • If the opened file doesn't have a header then hard EOF is signaled at the end of the current record (Each record is 128 bytes). e.g. if reading a file without a header which is meant to be 2 bytes long, hard eof will not be signalled until byte 128.
  • If the opened file does have a header then hard EOF is signaled at the end of the data defined by the header. (i.e. if there is a header and the file has length 2, hard EOF is signalled when reading the third byte).


BASDOS

BASDOS (BASIC Disc Operating System) is a patched AMSDOS made in East Germany (GDR) for the KC Compact.

The disc interface for the KC Compact contains the BASDOS rom, a NEC765 disc controller and 64KB RAM.

Differences compared to AMSDOS:

  • There is a new block of code at &dc00-&df00 in the ROM which starts with a small jumpblock. This code implements the patches. Other parts of the ROM have been patched to call into this.
  • Disc motor handler is patched to support a Ramdisk if selected.
  • Ramdisk is chosen with drive 'C' or 'D' using |DRIVE only. The XDPB for the ramdisk is fixed and isn't auto detected. In addition data within the XDPB is used to identify Ramdisk 'formats'. 'Auto select' parameter is 1 for a ramdisk based format, which has a dual purpose of identifying it and preventing auto-detection and the filler byte has been repurposed to define the base ram page of the ramdisk. The ramdisk uses KC Compact RAM Expansion/Amstrad compatible RAM Expansions.
  • Read/write is patched to allow double sided discs so that BASDOS format can be used.
  • Drive 'A' or 'B' can be DATA, BASDOS format (704KB) or SYSTEM/VENDOR. IBM format is replaced by BASDOS format.
  • Drive 'C' accesses a 64KB RAM DISK. (1KB blocks, 64 blocks, 32 directory entries). Uses second bank with ram selections from c4.
  • Drive 'D' accesses a 192KB RAM DISK. (2KB blocks, 96 blocks, 128 directory entries). Uses second bank with ram selections from e8. Useful if you have a 256KB/512KB ram expansion.
  • the double sided MicroDOS disc format is only supported in Microdos and not in AMSDOS mode. There are no XDPB defined for it within the BASDOS ROM.
  • BASDOS can boot both MicroDOS and Amstrad CP/M using |CPM depending on the detected disc format. Read id is used to detect which is used. Both the sector ID (R) and sector size (N) from the read id results are used. A ram expansion is required for MicroDOS.

Both BASDOS and MicroDOS should be useable on a CPC.