[Coco] Valid file names for Disk BASIC

William Astle lost at l-w.ca
Thu Apr 7 12:17:48 EDT 2016


Studying the code in DECB unravelled reveals that stock DECB does the 
following when parsing a file name:

1. Fill the filename buffer with spaces. Fill the extension buffer with 
a context-specified default extension.

2. If the provided name is 2 or more characters long *and* the second 
character is a colon *and* the first character is 0, 1, 2, or 3, then 
that is interpreted as a drive number and parsing begins after the colon.

3. The file name is copied into the file name buffer until the end of 
the string is reached or a colon, dot, or slash is found. If more than 8 
characters are found before a magic character, an error occurs. If a 
colon was found, no extension parsing occurs and the default is used. 
(Go to step 5.)

4. If a dot or slash was encountered, any default extension is replaced 
with spaces. Then characters are copied into the extension buffer until 
the end of the string is reached or a colon is found. If more than 3 
characters are encountered, an error occurs. If no colon is found, 
parsing ends here.

5. Following a colon, a single digit specifies the drive number. If that 
is no 0, 1, 2, or 3, an error occurs. If more characters appear after 
the drive number, an error occurs.

Additionally, bytes with the value 0 or 255 are not allowed because they 
have special meaning in the directory. Note that this is distinct from 
the digit 0 (ZERO) which is byte value 48.

HDB-DOS removes step 2 completely. It also allows for drive numbers up 
to 255.

Basically, any character except for a colon, dot, slash, CHR$(0) and 
CHR$(255) can be used in a file name or extension legally.


On 2016-04-07 09:40, Salvador Garcia wrote:
>
> Hi all. I am doing some catch up on different aspects of the Color Computer and was reading about Disk BASIC file names.
>
> ******************************************************************************************************************
>
> I was looking at this page: http://www.cs.unc.edu/~yakowenk/coco/text/diskbasic.html
>
> ******************************************************************************************************************
>
> Also, I consulted the Color Computer Disk System, Owner's manual and Programming Guide
>
> ******************************************************************************************************************
>
> (http://tandycoco.com/techdocs/cocodisksystem.pdf)
>
> ******************************************************************************************************************
>
> The basic rules for file names is that they can be at most 8 chars, followed by an optional extension which consists of a slash (/) or dot and then by at most 3 chars. The information makes mention that a slash, a colon, a dot and the digit zero are not permitted in the file name. It makes no mention of any other characters, such as dashes, underscores, dollar signs, and so on.
>
> ******************************************************************************************************************
>
> Does that mean that I can use any character, not in the forbidden list given above, in the file name? Thanks! Salvador
> ******************************************************************************************************************
>
>
>
>
>



More information about the Coco mailing list