Displaying graphics when a disc directory is listed

There are two instructions to display a directory of a disc:

The differences between these two commands are listed below.


Example output using CAT command:


Drive A: user  0


163K free




Example output using |DIR command:


Drive A: user  0


163K free



Displaying text and graphics using CAT and/or |DIR

The standard DATA and SYSTEM formats have 64 directory entries.

The following procedure is used to display a directory listing:

  1. Display blank line
  2. Display "Drive " followed by drive letter ("A" or "B")
  3. Display ":" character
  4. Display " user " followed by user number (the user number is displayed padded with spaces) e.g. " 0", " 15"
  5. Display blank line
  6. if CAT:
  7. if |DIR:
  8. The following procedure is repeated for each filename:

If you want the output to look identical with CAT and |DIR, follow these rules:

01User number (note 1)
11NAK (note 2)
21Sort key (note 3)
31ACK (note 4)
4..85(note 5)
91BS (note 6)
101(note 5)
111NAK (note 7)
12..3119file clusters (note 8)

This setup will work with DIR and CAT and gives 6 useable bytes per directory entry. Each printable char uses 1 byte. Some control codes will use more than 1 byte. Be careful when using control codes that use parameters are are close to the last byte or byte 8. It is best to put them into the next directory entry to ensure they are executed correctly.

  1. Set user number to 0 so that this directory entry will be visible in the directory listing and processed.
  2. This NAK control code is used to prevent display of the sort key character
  3. Use the characters with ASCII codes 32-127 in ascending order for the sort key. Codes below 32 are control codes and often require a parameter which we can't use here.
  4. This ACK control code enables printing for the bytes following.
  5. This gives 6 useable bytes per directory entry. 5 hear and 1 in the extension part.
  6. This BS control code is used to erase the "." character)
  7. This NAK is used to disable printing again. Note the use of ACK and NAK to enable and disable character printing so you have ultimate control on how the characters are drawn.
  8. These can be set to "0". However if you are loading using sector by sector and you want to stop AMSDOS from saving to these sectors, then set valid cluster numbers here to map over the sectors.
  9. Ensure bit 7 of bytes 9,10,11 are 0. Normally these are used to indicate file status (e.g. system, readonly).

    The ASCII codes for the control codes used here: