home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / sysutl / tryst.arc / TRYST1.DOS next >
Text File  |  1988-03-31  |  17KB  |  257 lines

  1.             TRYST DOS
  2.  
  3.      This is the start of a series of articles about IBM PC-DOS and
  4. hardware.  In these articles, I will try to cover things that novice or
  5. advanced users may find useful, (or simply that interest
  6. me).  If there is something that you would like to know about or have a
  7. question on, leave a note to Amy Goebel on this RBBS and I will either
  8. answer it in the mail system or include it in one of these articles if it
  9. seems to be of general interest.
  10.  
  11.      To start this off, I will cover some information about hard disks.  In
  12. the past there have been a lot of questions about formatting/partitioning
  13. hard disks.
  14.  
  15. Some terms used in this article:
  16.  
  17. Hexidecimal, or Hex, expressed as a number = nnH.  This is a numbering
  18. system based on base 16.  It is expressed with the numbers 0-9 and A, B, C,
  19. D, E, and F.  Hex is used frequently because 8 digit binary numbers break
  20. down into 2 digit hex numbers very easily.  The 4 binary digits = 1 hex
  21. digit.  The binary number 1111 1111 is equal to FF in hex.
  22.  
  23. Routine.  When a routine is referred to in this article, it simply means a
  24. set of instructions that the computer understands.  Hopefully this set of
  25. instructions does something useful, such as reading a file off of a disk
  26. drive.
  27.  
  28. Bits and Bytes.  There are 8 bits, or binary digits in a byte.  One byte is
  29. equal to one character, such as the letter "A".
  30.  
  31. K or Kb.  Kilobytes, it is 1024 bytes.  Computer memory is often referred to
  32. as having so much K (or so many Kb), as in 640Kb of RAM.  RAM is user work
  33. area which is volatile - the contents vanish when the electricity is turned
  34. off.
  35.  
  36. Address.  Everything in the computer has an address.  The 8088 CPU can talk
  37. to 1 megabyte worth of addresses.  For the user, the addresses available as
  38. work space for programs and data occupy the addresses 0 through 640Kb,
  39. which is where the user's RAM, or Randam Access Memory chips are located.
  40. Above 640Kb are the addresses where the rest of the hardware lies, such as
  41. the video screens, the ROMs, etc.  Later articles will cover more in terms
  42. of memory layout.
  43.  
  44. ROM.  Read Only Memory.  This is a chip in the computer which already has
  45. computer instructions (routines) stored in it.  These instructions do not
  46. vanish when the computer is turned off, they are non-volatile.  The routines
  47. stored in a ROM can not be changed, hence Read Only, not Read/Write.
  48.  
  49.  
  50.          BOOTING UP WITH HARD DISKS
  51.                     (WHAT CAN GO WRONG)
  52.  
  53.      When the computer is turned on, a ROM called the BIOS, Basic Input
  54. Output System, is used to "check" out your system and make sure you can
  55. access things like your floppy drives, hard disk, your video
  56. boards/monitors, and any memory you have.  The ROM BIOS also looks on the
  57. adapter cards you have in your computer, and searches for other ROMs.  One
  58. of the ROMs that it may find is the ROM on a hard disk controller card that
  59. contains the routines for accessing that hard disk.  On the AT, this
  60. controller card has been combined with the floppy disk controller card, so
  61. there is not a seperate card for the hard disk.  The AT's adapter still
  62. contains a ROM to access the hard disk and the floppy drives installed in
  63. the AT.  If the BIOS finds adapter cards with ROMs, it lets those ROMs
  64. execute (run), to place into working memory any instructions necessary to
  65. make the hardware work.  The routines saved in the ROMs then become part
  66. of the copy of the BIOS which remains in working memory to "run" the computer
  67. during a session.
  68.  
  69.      When IBM's ROM BIOS finds a ROM on a hard disk adapter card, it lets
  70. that ROM take "control" of the system so that it may perform any set up
  71. necessary to use the hard disk.  The ROM BIOS searches absolute addresses
  72. C8000H through E0000H in 2K increments, in search of a valid ROM. 
  73. It can tell a valid ROM by the first few bytes in the ROM.  A
  74. valid ROM will have 55H, AAH, a length indicator and then the assembly
  75. language instruction to CALL FAR (to bring in a "FAR" routine).  A checksum
  76. is done on the ROM to verify its integrity, then the BIOS performs the
  77. CALL FAR to bring in the executible code.  The adapter's ROM then performs
  78. its initialization tasks and hopefully returns control of the computer
  79. back to the ROM BIOS so it can continue with the booting process.  When the
  80. ROM BIOS performs the CALL FAR, the hard disk ROM starts searching the hard
  81. disk (starting at location 400 - byte 400?) for a two byte pattern
  82. indicating the active partition.  If it does not find this byte pattern,
  83. you will get a BOOT FAILURE message.  This means that the BIOS could not
  84. find the active partition.
  85.  
  86.      In addition to just indicating the active partition, the partition
  87. table contains a code to indicate what operating system is in the
  88. partition.  DOS 2.x uses a 01 to indicate that the hard disk is formatted
  89. for that version of DOS.  And remember, when you format a "hard disk", you
  90. are actually performing the format WITHIN a partition.  This is done so you
  91. can have other operating systems, such as XENIX, on the same hard disk as
  92. DOS.  DOS 3.x uses a value of 04.  This means that if you formatted your
  93. hard disk for DOS 3.x and then boot off of a DOS 2.x floppy, you will not
  94. have access to the hard disk.  DOS 2.x will look at the partition table and
  95. find a value of 04 and report that the hard disk is "NON-DOS", (actually it
  96. will tell you that Drive C:  is an invalid drive).  On the other hand, if
  97. you boot off of DOS 3.x, it will recognize the "smaller" DOX 2.x number of
  98. 01 as a good DOS and allow you to access the hard disk drive.  Therefore,
  99. DOS 3.x can recognize DOS 2.x, but DOS 2.x can not recognize DOS 3.x.  This
  100. is what is meant by upwardly compatible, you can go up from DOS 2.x to DOS
  101. 3.x, i.e.  DOS 3.x can read what is created under DOS 2.x, but you can not
  102. go DOWN from DOS 3.x to DOS 2.x because DOS 2.x will not read DOS 3.x hard
  103. disks.
  104.  
  105.      There is a very good reason for this.  Space on your hard disk is
  106. "sectioned" off into pieces 512 bytes long.  DOS keeps track of these
  107. pieces with a table of section addresses called the File Allocation Table.
  108. DOS 3.x supports larger disks (20 MB) by using a File Allocation Table
  109. (FAT) with entries 16-bits (2 bytes) long.  DOS 2.x support smaller drives
  110. because its FAT had entries only 12 bits long.  The larger bit FAT entry
  111. meant that you could contain a larger number, therefore you could address
  112. more space (20 MB instead of 10 MB).  So, DOS 2.x can only read a FAT that
  113. has entries 12 bits long and it simply cannot even begin to cope with the
  114. larger FAT produced during the DOS 3.x format procedure.  To prevent DOS
  115. 2.x from trying to do what it can not, the active partition value
  116. indicating the DOS version was changed with DOS 3.x to prevent DOS 2.x from
  117. messing around with a FAT which it could not handle.  (This does not mean,
  118. however, that you can not use DOS 2.x with a 20 MB hard disk.  DOS 2.x uses
  119. larger clusters than DOS 3.x and there are various methods used by hard
  120. disk vendors to allow DOS 2.x to be used with larger drives.)
  121.  
  122.      This change in FAT entry size is not the only change DOS 3.1 makes to
  123. your hard disk.  The space sections kept track of in the FAT are not listed
  124. as Section 1, Section 2, etc.  The FAT puts several sections together into
  125. a cluster, and then keeps track of the space in terms of the clusters.  It
  126. does this because on a hard disk, there would be too many 512 byte sectors
  127. for DOS to track.  By putting several sectors together in a cluster, DOS
  128. has fewer items to track.  So, starting with DOS 3.x, the FAT has increased
  129. the entry size, and decreased the cluster size.  One cluster is the minimum
  130. amount of space one file can occupy.  One file will get at least one
  131. cluster of space, even if that file only contains one byte in it. 
  132. Under DOS 2.x, the minimum cluster size was 4096 bytes long.  That is 8
  133. sectors, with each sector being 512 bytes long.  Therefore, the smallest
  134. file would be 4096 bytes, even if it just had the word "Hello" in it. 
  135. Starting with DOS 3.x, the cluster is 2048 bytes, which is 4 sectors of 
  136. of 512 bytes each.  If you have a lot of small files, DOS 3.x is more
  137. efficient since there is less "wasted" space at the end of each file.
  138. (A floppy uses space even more efficiently, a cluster on a
  139. floppy is only 2 sectors long, or 1024 bytes.) But smaller clusters
  140. means more to keep track of, hence the larger FAT entries (for example,
  141. if a FAT entry was 3 characters long, the largest number would be 999, but
  142. a FAT entry 4 characters long could hold 9999 - a much larger number).
  143.  
  144.      What this means to you in terms of booting:  If you boot up on a
  145. floppy, and you get the message that your hard disk is an invalid drive, it
  146. could be that you are using the wrong version of DOS.  The solution to this
  147. would be to either boot up on the hard drive by removing the floppy, or try
  148. to find a floppy with a newer DOS version.  If this does not work, it could
  149. be that someone installed a security system which changed the DOS operating
  150. system byte value and unless you know the password or have whatever "key"
  151. that system requires, you will not have access to the hard disk because
  152. "plain" DOS does not recognize the partition byte.
  153.  
  154.      Some security packages change the byte which determines what operating
  155. system is in the active partition, and during boot-up, DOS does not "find"
  156. an active, recognizable DOS partition without the intervention of the
  157. security package.  This prevents unauthorized users from gaining access to
  158. a hard disk set up this way.  If DOS does not find an active DOS partition,
  159. it will inform the user that the hard disk is a "Non-DOS disk" and not
  160. allow access to it.  Often these packages are a combination of hardware and
  161. software.  The hardware installed in the machine has a special ROM on it
  162. which is read by the IBM ROM BIOS and allowed to take control of the system
  163. at boot up.  If the user does not know a password, or have the key, they
  164. will not be allowed to finish the boot up process, or the boot up may
  165. proceed, but they do not have access to the hard disk (they will get the
  166. message, "Invalid Drive Designation").
  167.  
  168.      If you start getting errors on booting about problems with the boot
  169. record, FAT or DIR, and you reformat and get the message that cylinder 0 is
  170. bad and you can not use the drive, you can rerun FDISK and move the active
  171. partition to "work around" the bad area.  To do this, run FDISK and delete
  172. the current partition and repartition the hard disk.  REMEMBER:  When you
  173. create a new partition, you loose access to all the information on that
  174. hard disk, so MAKE A BACKUP FIRST.  When running Fdisk to fix a hard disk
  175. with cylinder 0 being bad, move the active partition to start at Cylinder 1
  176. (or 2), format, and place your files in this partition, skipping the bad
  177. cylinder 0.  This is done by saying that you do not want to use the whole
  178. for DOS, and when it prompts you for the cylinders to use for DOS, start at
  179. cylinder 1 instead of 0.  When you boot up, it will take longer for the
  180. BIOS to find the two byte pattern it is looking for to locate the active
  181. partition, but this will work to skip bad areas.  When you do this, you
  182. essentially have two partitions, one with the bad areas, which is inactive,
  183. and the active partition, which you are using.
  184.  
  185.      When the two byte pattern is found, it loads the partition and other
  186. disk information into RAM, where it stays - this is how DOS will access the
  187. hard disk.  This is also why, if you mess around with Debug or some memory
  188. resident programs, the hard disk will suddenly become inaccessible.  The 
  189. the disk system information is kept in RAM and this may be overwritten by
  190. other programs inadvertently.  If this happens, reboot.
  191.  
  192.      An error message "1781" means that the drive setup information was
  193. incorrect.  For example, for a 40MB Qubie hard disk on an AT, it should be
  194. setup as 1 drive, type 11, and Drive D is not installed (because there is
  195. only one physical drive even though later you can split it up into two
  196. logical drives using Qubie's software).  You will get a "1781" error if you
  197. say you do have a physical Drive D, when you really don't, if you said you
  198. have 2 drives instead of 1, or if you specified the incorrect disk type
  199. (should be 11 for AT 40 MB Qubie).  If the search pattern (2 byte) is done
  200. wrong (for example, in the Qubie BTformat setup), you will also get the
  201. "1781" error.  Although the example here is for a Qubie drive, this type of
  202. error occurs on other hard disk drives as well, from similar problems.  On
  203. an AT, the information entered during setup, either by the vendor, or by a
  204. user, should be printed out and kept with the machine.  The setup
  205. information is retained with a battery backup and eventually that battery
  206. will have to be replaced.  When it is, you will have to re-enter the setup
  207. information, and if you do not know the type of hard disk drive you have,
  208. you may have problems accessing that drive.  To get the type of drive,
  209. simply boot on the Diagnostic disk which came with the AT, and go through
  210. the SETUP routine (choice 4 on the main menu).  Under options, you will see
  211. "Fixed Disk Drive C - Type 2", for example.  You can print this out using
  212. the <Shift><PrtSc> keys, or simply write it down in your "Guide to
  213. Operations" manual.  Then, when you have to replace the battery, you will
  214. know what kind of hard disk type to enter for your fixed drive.
  215.  
  216.      In addition to providing the routines to access the hard disk, the ROM
  217. on the hard disk controller card is often used by drive retailers to do a
  218. low-level format on their hard disk, rather than sending the user a floppy
  219. with the low-level format on it.  (IBM sells a package called "Hardware
  220. Maintenance and Service" which contains an Advanced Diagnostic Diskette.
  221. This diskette contains the routines to perform a low-level format on the
  222. IBM line of personal computers).  The low-level format is generally run the
  223. manufacturer and probably should not be run by the customer unless they are
  224. have hard disk problems such as "Data error reading drive C" or "Data write
  225. or Data read error on Drive C".  The low-level format actually establishes
  226. sector addresses and tests the disk to find bad areas.  If it finds bad
  227. areas (and most hard disks have them and they are nothing to worry about
  228. unless they are not found), these areas will be marked in the FAT so that
  229. they are not used.  The regular format that most users are familiar with
  230. simply wipes the directory and FAT clean - it does not check the hard disk
  231. for bad areas.
  232.  
  233.      Depending on the hard disk controller (and the address of the ROM
  234. routine), Debug can be used to access the low-level format routine on the
  235. adapter's ROM.  On an XT type machine, for example, the user would enter
  236. the following:  "Debug" and then, "G=C800:5".  That command would run the
  237. low-level format and hopefully find any bad areas that have developed
  238. during the use of the hard disk, and write them out in the FAT so they are
  239. no longer dangerous.  Some utilities, such as Norton's, will check the hard
  240. disk for bad areas and mark them in the FAT, so it may not be necessary to
  241. perform a low-level format on your drive.  During this type of a format,
  242. you lose all the information on your drive, so be sure to back up any files
  243. before doing it.  That is one advantage to something like Norton's
  244. utilities, or MACE utilities, they do not reformat the hard disk, so you do
  245. not lose the information on it.  Unless that information is in a bad area
  246. already, then you may be able to recover parts of the file, but probably
  247. not all of it.  Running DOS' CHKDSK utility DOS NOT DO THIS!!!!!!  If you
  248. run CHKDSK and it tells you that your disk is okay, that does not mean that
  249. it does not have any unnoted bad areas on it.  CHKDSK merely compares the
  250. directory entries for files against the FAT entries to be sure that no two
  251. files say they are using the same space, and that there are enough clusters
  252. allocated for the size of the file as indicated by the file size in the
  253. directory entry.  CHKDSK does not read and write to the hard disk to be
  254. sure that there are no bad areas!!!!  I will cover exactly what CHKDSK
  255. does, and how the FAT and Directory work together to keep track of your
  256. files, in a later "TRYST DOS" article.
  257.