Difference between revisions of "Displaying graphics when a disc directory is listed"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Upload with OpenOffice)
 
(added credits, formatting)
Line 1: Line 1:
'''Displaying graphics when a disc directory is listed'''
+
<div style="border: 1px solid rgb(228, 222, 222); margin: 0px 0px 5px; padding: 0.5em 1em; background-color: rgb(249, 249, 249);"><center>'''''This article originally came from Kevin Thackers' archive at [http://www.cpctech.org.uk http://www.cpctech.org.uk].'''''</center></div>
  
 
There are two instructions to display a directory of a disc:  
 
There are two instructions to display a directory of a disc:  
Line 7: Line 7:
  
 
The differences between these two commands are listed below.  
 
The differences between these two commands are listed below.  
 +
  
 
== CAT ==
 
== CAT ==
Example output using CAT command:
 
  
 +
Example output using CAT command:
 +
<pre>
 
  cat
 
  cat
  
Line 22: Line 24:
  
 
  Ready
 
  Ready
 +
</pre>
  
 
Notes:  
 
Notes:  
Line 31: Line 34:
 
* Hidden/system files are not displayed  
 
* Hidden/system files are not displayed  
 
* Free space remaining on disc is displayed  
 
* Free space remaining on disc is displayed  
 +
  
 
== |DIR ==
 
== |DIR ==
Example output using |DIR command:
 
  
 +
Example output using |DIR command:
 +
<pre>
 
  |dir
 
  |dir
  
Line 45: Line 50:
  
 
  Ready
 
  Ready
 +
</pre>
  
 
Notes:  
 
Notes:  
Line 54: Line 60:
 
* Hidden/system files are not displayed  
 
* Hidden/system files are not displayed  
 
* Free space remaining on disc is displayed  
 
* Free space remaining on disc is displayed  
 +
  
 
== Displaying text and graphics using CAT and/or |DIR ==
 
== Displaying text and graphics using CAT and/or |DIR ==
 +
 
The standard DATA and SYSTEM formats have 64 directory entries.  
 
The standard DATA and SYSTEM formats have 64 directory entries.  
  
Line 86: Line 94:
  
  
{| class="prettytable"
+
{|{{Prettytable|font-size: 2em;}}
 
! <center>Offset</center>
 
! <center>Offset</center>
 
! <center>Count</center>
 
! <center>Count</center>

Revision as of 18:06, 17 January 2009

This article originally came from Kevin Thackers' archive at http://www.cpctech.org.uk.

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

  • CAT
  • |DIR

The differences between these two commands are listed below.


CAT

Example output using CAT command:

 cat

 Drive A: user  0

 CATALOG .ASM   4K   SCROLL  .BAK   2K
 HWSPRITE.ASM*  4K   SPLTSCRN.ASM   3K
 SCROLL  .ASM   2K

 163K free

 Ready

Notes:

  • File names are sorted into increasing alphabetical order before display
  • The file-size is displayed
  • The file names are printed using firmware "TXT OUTPUT" (&BB5A) function which will execute control characters.
  • A "*" character is displayed after the extension if the file is read-only. If the file is read-write then a " " (space) character is displayed.
  • Hidden/system files are not displayed
  • Free space remaining on disc is displayed


|DIR

Example output using |DIR command:

 |dir

 Drive A: user  0

 HWSPRITE.ASM   CATALOG .ASM
 SPLTSCRN.ASM   SCROLL  .ASM

 163K free

 Ready

Notes:

  • File names are listed in the order stored in the directory
  • File size is not displayed.
  • The file names are printed using firmware "TXT OUTPUT" (&BB5A) function which will execute control characters
  • read-only/read-write state is not displayed
  • Hidden/system files are not displayed
  • Free space remaining on disc is displayed


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:
    • Perform directory operation and sort filenames into increasing alphabetical order
  7. if |DIR:
    • Perform directory operation and do not sort
  8. The following procedure is repeated for each filename:
    • Display the 8 characters of the name part of the filename
    • Display a "." character
    • Display the 3 characters of the extension part of the filename
    • If |DIR
      • display 3 spaces
    • if CAT
      • If file is read-only, display a "*" character, otherwise if file is read-write display a " " (space) character.
      • display 2 spaces
      • display file size in K, followed by "K" character

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

  • List the directory entries in the order that they are "executed"
  • Do not use the extra characters ("*" and file size) displayed by CAT, or the 3 spaces displayed by |DIR


Offset
Count
Description
0 1 User number (set to "0")
1 1 Sort key (use the characters with ASCII codes 32-127 in ascending order)
2 1 ACK control code (enable printing of characters)
3..8 6 (useable)
9 6 BS (to erase "." character)
10 1 (useable)
11 1 NAK
12..31 19 not used (set to "0")