home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_NEWS / STN_01_C.MSA / DATA_DOC10 < prev    next >
Text File  |  1994-03-14  |  6KB  |  138 lines

  1.  
  2. üDISKMANIPULATION ON THE ATARI SF DISK DRIVES PART IIÇ
  3. by Richard Karsmakers
  4.  
  5. Originally  published  in üST NEWSÇ Volume 1 Issue  3,  launched  on 
  6. August 16th 1986.
  7.  
  8. In  the  previous issue of üST NEWSÇ,  I have told  you  some  basic 
  9. things you need to know when you start disk manipulating.  In this 
  10. issue,  I'll  talk about some specific data and things you'd  also 
  11. need to know if you start manipulating....
  12.  
  13. First,  let's  talk a bit about the File Allocation Table  or  FAT 
  14. (for people who owned a Commodore 64 before:  this can be compared 
  15. with  the Block Availability Map or BAM on the 1541  disk  drive). 
  16. Normally,  each  FAT  entry is 12 bits in  size.  It  can  contain 
  17. several values:
  18.  
  19.       $000       Cluster unused
  20.       $FF7       Cluster unusable, mostly because of bad medium
  21.       $FFF       Last cluster in a file
  22.       other      Number of the next cluster in a file
  23.  
  24. Clusters are numbered starting at two,  and each cluster  normally 
  25. represents  two sectors (so 1024 bytes).  Now you know the  reason 
  26. why a 2-byte file takes up a whole kilobyte on disk....
  27. Now the directory. Each directory entry is 32 bytes in size, which 
  28. are divided as follows:
  29.  
  30.        1- 8      Filename
  31.        9-11      File extension
  32.         12       File attribute
  33.       13-22      Unused/Reserved
  34.       23-24      Time
  35.       25-26      Date
  36.       27-28      Number of the first cluster of a file
  37.       29-32      Size in bytes
  38.  
  39. The filename can have upto 8 characters in it, if which nearly all 
  40. letters,  etc.  are possible.  First Word has difficulties reading 
  41. filenames with german characters,  etc.  in it,  and the following 
  42. characters can (may) never be used in a filename:
  43.  
  44. []()<>=*&,!|?/\$.:;+-
  45.  
  46. The filename extension cannot be carelessly manipulated,  since it 
  47. determines whether a file can be run or  only shown/printed.   The 
  48. following  extension  have special meaning (or  can  have  special 
  49. meanings):
  50.  
  51.       PRG        A regular program, that can use GEM. Can be run
  52.       TOS        A program that doesn't use GEM (mouse pointer
  53.                      disappears). Can be run
  54.       TTP        A program where TOS Takes Parameters (TTP), e.g.
  55.                      an assembler, where the source file has to be
  56.                      specified. This can now be done in a box
  57.       IMG        This is normally the extension of a TOS on disk,
  58.                      but is also used in games like "X-TRON", a
  59.                      database called "Zoomracks" and the digitized
  60.                      music demo's from the Desaster Area (Oxygen &
  61.                      Foreign Affair)
  62.       SYS        This is the extension of a program called
  63.                      "ASSIGN", usually present on drawing programs
  64.                      like Easy Draw, Gem Paint, etc. te determine
  65.                      whether the program runs in monochrome or co-
  66.                      lor resolution
  67.  
  68.       ACC        (This is no advertisement) Provided that a pro-
  69.                      gram has the format of a desk accesory, up
  70.                      to five of these files can be loaded at sys-
  71.                      tem BOOTing to become desk accesories
  72.       DOC        The extension of a First Word text file, but
  73.                      can be used otherwise as well
  74.       TXT        Usually a text file
  75.       ONE        The extension of a DB Master One data file
  76.       ZRX        The extension of a Zoomracks data file
  77.       APP        I don't know exactly what this does...
  78.       ???        Only PRG, TOS, TTP and APP can be loaded....
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. Now the attributes. What exactly is a file attribute? It is a byte 
  91. that  uses  several  of  its bits  to  determine  certain  status-
  92. qualities.  For  example,  there's a read-only  status,  a  hidden 
  93. status, and some more. The bits are located as follows:
  94.  
  95.       Bit 0:    Read only
  96.       Bit 1:    Hidden
  97.       Bit 2:    System
  98.       Bit 3:    Volume
  99.       Bit 4:    Subdirectory
  100.       Bit 5:    Archive bit (hard disk only: written to & closed)
  101.  
  102. The read-only attribute seems quite clear:  if the specific bit is 
  103. set,  it is not possible to delete or rename the file.  The use of 
  104. both  hidden-and system attributes still have to be  explained  to 
  105. me,  but  they  take  care that a file isn't shown  an  a  regular 
  106. directory.  How  it is readable,  that's a mystery to me  (doesn't 
  107. that remember you to a certain song?!?).  The volume label is  set 
  108. if a file is no file but the name of a disk (the disk label).  The 
  109. subdirectory attribute is set if a file (again!) is no file, but a 
  110. subdirectory,  better known as a folder.  The TOS doesn't read it, 
  111.  
  112. but  opens  a  subdirectory somewhere else on  the  disk  if  it's 
  113. clicked.
  114. You'd better stay out of the unused/reserved bits;  you never know 
  115. what  people  might  do with these (may be even as  part  of  some 
  116. clever protection scheme!).
  117. Both time and date are quite difficult to calculate,  since you'll 
  118. have to process individual bits. The two time-bytes are divided as 
  119. follows:
  120.  
  121.           Bit 0-4          Seconds
  122.           Bit 5-10         Minutes
  123.           Bit 11-15        Hours
  124.  
  125. You'll  have to multiply the seconds you get with two to  get  the 
  126. proper time!
  127. The date bytes are divided as follows:
  128.  
  129.          Bit 0-4           Day
  130.          Bit 5-8           Month
  131.          Bit 9-15          Year
  132.  
  133. Here, you'll have to add 1980 to the value of "year"....
  134. That's all folks,  for this issue of üST NEWSÇ.  Next time, we might 
  135. go and have a look at some specific disk manipulation. See ya!
  136.  
  137.  
  138.