DISKMANIPULATION ON THE ATARI SF DISK DRIVES PART II
by Richard Karsmakers
Originally published in ST NEWS Volume 1 Issue 3, launched on
August 16th 1986.
In the previous issue of ST NEWS, I have told you some basic
things you need to know when you start disk manipulating. In this
issue, I'll talk about some specific data and things you'd also
need to know if you start manipulating....
First, let's talk a bit about the File Allocation Table or FAT
(for people who owned a Commodore 64 before: this can be compared
with the Block Availability Map or BAM on the 1541 disk drive).
Normally, each FAT entry is 12 bits in size. It can contain
several values:
$000 Cluster unused
$FF7 Cluster unusable, mostly because of bad medium
$FFF Last cluster in a file
other Number of the next cluster in a file
Clusters are numbered starting at two, and each cluster normally
represents two sectors (so 1024 bytes). Now you know the reason
why a 2-byte file takes up a whole kilobyte on disk....
Now the directory. Each directory entry is 32 bytes in size, which
are divided as follows:
1- 8 Filename
9-11 File extension
12 File attribute
13-22 Unused/Reserved
23-24 Time
25-26 Date
27-28 Number of the first cluster of a file
29-32 Size in bytes
The filename can have upto 8 characters in it, if which nearly all
letters, etc. are possible. First Word has difficulties reading
filenames with german characters, etc. in it, and the following
characters can (may) never be used in a filename:
[]()<>=*&,!|?/\$.:;+-
The filename extension cannot be carelessly manipulated, since it
determines whether a file can be run or only shown/printed. The
following extension have special meaning (or can have special
meanings):
PRG A regular program, that can use GEM. Can be run
TOS A program that doesn't use GEM (mouse pointer
disappears). Can be run
TTP A program where TOS Takes Parameters (TTP), e.g.
an assembler, where the source file has to be
specified. This can now be done in a box
IMG This is normally the extension of a TOS on disk,
but is also used in games like "X-TRON", a
database called "Zoomracks" and the digitized
music demo's from the Desaster Area (Oxygen &
Foreign Affair)
SYS This is the extension of a program called
"ASSIGN", usually present on drawing programs
like Easy Draw, Gem Paint, etc. te determine
whether the program runs in monochrome or co-
lor resolution
ACC (This is no advertisement) Provided that a pro-
gram has the format of a desk accesory, up
to five of these files can be loaded at sys-
tem BOOTing to become desk accesories
DOC The extension of a First Word text file, but
can be used otherwise as well
TXT Usually a text file
ONE The extension of a DB Master One data file
ZRX The extension of a Zoomracks data file
APP I don't know exactly what this does...
??? Only PRG, TOS, TTP and APP can be loaded....
Now the attributes. What exactly is a file attribute? It is a byte
that uses several of its bits to determine certain status-
qualities. For example, there's a read-only status, a hidden
status, and some more. The bits are located as follows:
Bit 0: Read only
Bit 1: Hidden
Bit 2: System
Bit 3: Volume
Bit 4: Subdirectory
Bit 5: Archive bit (hard disk only: written to & closed)
The read-only attribute seems quite clear: if the specific bit is
set, it is not possible to delete or rename the file. The use of
both hidden-and system attributes still have to be explained to
me, but they take care that a file isn't shown an a regular
directory. How it is readable, that's a mystery to me (doesn't
that remember you to a certain song?!?). The volume label is set
if a file is no file but the name of a disk (the disk label). The
subdirectory attribute is set if a file (again!) is no file, but a
subdirectory, better known as a folder. The TOS doesn't read it,
but opens a subdirectory somewhere else on the disk if it's
clicked.
You'd better stay out of the unused/reserved bits; you never know
what people might do with these (may be even as part of some
clever protection scheme!).
Both time and date are quite difficult to calculate, since you'll
have to process individual bits. The two time-bytes are divided as
follows:
Bit 0-4 Seconds
Bit 5-10 Minutes
Bit 11-15 Hours
You'll have to multiply the seconds you get with two to get the
proper time!
The date bytes are divided as follows:
Bit 0-4 Day
Bit 5-8 Month
Bit 9-15 Year
Here, you'll have to add 1980 to the value of "year"....
That's all folks, for this issue of ST NEWS. Next time, we might
go and have a look at some specific disk manipulation. See ya!
Disclaimer
The text of the articles is identical to the originals like they appeared
in old ST NEWS issues. Please take into consideration that the author(s)
was (were) a lot younger and less responsible back then. So bad jokes,
bad English, youthful arrogance, insults, bravura, over-crediting and
tastelessness should be taken with at least a grain of salt. Any contact
and/or payment information, as well as deadlines/release dates of any
kind should be regarded as outdated. Due to the fact that these pages are
not actually contained in an Atari executable here, references to scroll
texts, featured demo screens and hidden articles may also be irrelevant.