home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / tcj / tcj40tp.ws < prev    next >
Encoding:
Text File  |  1994-09-02  |  15.8 KB  |  358 lines

  1.  
  2. [Note from Jay Sage:  When I met Terry Pinto in Portland in May, he told me 
  3. about the technique he had developed to overcome the 88 Mbyte limit on the 
  4. Ampro Little Board he uses to run his remote access computer system.  My 
  5. immediate response was, "Please write it up for TCJ!"  And here it is.]
  6.  
  7.  
  8.                                 86 YOUR 88!
  9.                 Discard the 88Mb limit on your Ampro LB Z80
  10.  
  11.                                by Terry Pinto
  12.  
  13.  
  14.      That old saying that "Necessity Is The Mother Of Invention" certainly 
  15. holds true.  After purchasing my Ampro, I noticed that I was limited to a 
  16. maximum of 88Mb of hard disk space.  My feelings then were, WHO CARES!  How 
  17. could I ever fill that much space!  I found a good price on a Priam V150 
  18. 60Mb RLL certified hard disk and added it to the system.  Well, you guessed 
  19. it.  It certainly didn't take long to fill up the disk.  I run a BBS, 
  20. Access Programming RAS, and my users were slowly eating away any free disk 
  21. space I had.  The time had come to enlarge the system.  The problem was 
  22. that I couldn't justify the expense of expanding to an 88Mb drive just to 
  23. gain the additional space, and the extra 20Mb was a small addition that 
  24. would disappear rapidly.  The only solution was to engineer a way to 
  25. utilize the fact that the Adaptec 4070 controller I used could support two 
  26. hard disk drives.  I purchased a copy of the source code to the Ampro BIOS 
  27. and set to work writing HDS v1.00 (Hard Disk Select).
  28.  
  29.      Before explaining how HDS works, a brief description of Ampro's drive 
  30. table is in order.  This table contains the information necessary to relate 
  31. the logical drives to the physical drives on the system and to select the 
  32. driver routine needed for each logical drive.  The table is arranged in 16 
  33. groups of 4 bytes each for logical drives A-P.  The information in byte 2 
  34. is used to select the physical drive on the controller (see Tables 1 and 
  35. 4).  Setting bits 7, 6, and 5 to a value of 000 will select physical drive 
  36. 0 on the controller while a value of 001 will select physical drive 1.
  37.  
  38.      Provided that both drives are physically compatible (for example, the 
  39. same make and model) and are partitioned identically, simply changing bit 5 
  40. in byte 2 from 0 to 1 for a given logical drive (partition) will cause the 
  41. system to access (read/write) the drive set up as SCSI drive 1 in place of 
  42. the drive set up as SCSI drive 0.  As you can see, the fact that both 
  43. drives are partitioned the same is VERY IMPORTANT!  The only thing I 
  44. attempt to do with HDS is to tell the controller to use the other hard 
  45. disk.  HDS gives you double the disk space without the loss of any 
  46. additional TPA.
  47.  
  48. ----------------------------------------------------------------------
  49.  
  50. Drive A   01 00 C6 00    Floppy Drives A-D
  51. Drive B   01 11 C6 00    
  52. Drive C   01 22 86 00    
  53. Drive D   01 33 86 00    
  54. Drive E   02 44 00 FF    Foreign Format Drive E
  55. Drive F   03 50 0A 01    Hard Disk Drives F-P
  56. Drive G   03 60 0A 01    
  57. Drive H   03 70 0A 01
  58. Drive I   03 80 0A 01
  59.            |  |  |  |
  60.            |  |  |  +--- SCSI Address
  61.            |  |  +------ Drive Type Identifier
  62.            |  +--------- Physical Offset and Drive Unit Number
  63.            +------------ Disk Drive ID  0 = Not Installed
  64.  
  65. Table 1.  Physical Driver Table
  66.  
  67. ----------------------------------------------------------------------
  68.  
  69.           00 = Reserved for errors
  70.           01 = Floppy Drive
  71.           02 = Foreign Format Drive
  72.           03 = Hard Disk Drive
  73.           04 = Currently Undefined
  74.           05 = Currently Undefined
  75.           06 = Currently Undefined
  76.           07 = RAM Disk (N/Systems)
  77.  
  78. Table 2.  Values of the Disk Driver ID (byte 0)
  79.  
  80. ----------------------------------------------------------------------
  81.           
  82.           Bits 7654 Offset to base 0-F
  83.  
  84.           Bits 3210 Physical device address to be passed to the 
  85.                     respective driver.
  86.                
  87.                     (For floppies, this is the drive unit#.  For 
  88.                     hard disks, these are reserved.)
  89.  
  90. Table 3.  Physical offset from start of disk parameter headers
  91.           and the drive unit number (byte 1).
  92.  
  93. ----------------------------------------------------------------------
  94.      Floppy Usage:
  95.                Bit: 76543210
  96.      Density        X         0=Single 1=Double
  97.      Sides           X        0=Single 1=Double
  98.      Sector#'s        X       0=Same 1=Contiguous
  99.      Track Cnt         X      0=Down 1=Down Front - Up Back
  100.      Alloc Unit         XX    00=1k  01=2k  10=4k  11=8k
  101.      Sector Size          XX  00=128 01=256 10=512 11=1024
  102.  
  103.      Hard Disk Usage:
  104.                Bit: 76543210
  105.      LUN            XXX       Logical unit number (0-7)
  106.      Reserved          X
  107.      Alloc Unit         XX    00=1k  01=2k  10=4k  11=8k
  108.      Sector Size          XX  00=128 01=256 10=512 11=1024
  109.  
  110. Table 4.  Drive Type Identifier (byte 2).
  111.  
  112. ----------------------------------------------------------------------
  113.  
  114.                Bit: 76543210
  115.      SCSI address 0        X  This  is  the  actual  bit  pattern 
  116.      SCSI address 1       X   supplied  during  the  SCSI  select 
  117.      SCSI address 2      X    routine.   No   internal    address 
  118.      SCSI address 3     X     translation or bit scaling is done.
  119.      SCSI address 4    X        
  120.      SCSI address 5   X         
  121.      SCSI address 6  X          
  122.      SCSI address 7 X           
  123.  
  124. Table 5. SCSI bus address for hard disks (byte 3).
  125.  
  126. ----------------------------------------------------------------------
  127.  
  128.                               Hard Disk Select
  129.  
  130.      The Ampro BIOS can be set up to accommodate hard disk space up to 
  131. 88Mb. This is due to the fact that a CP/M system can address sixteen 
  132. drives, A-P, of up to a maximum of 8Mb of space each.  Ampro defines drives 
  133. A-D as floppy drives and drive E as the foreign format floppy.  These 
  134. allocations are predefined and cannot be changed, although by using the 
  135. SWAP utility they can be moved around.  For the purposes of this article, 
  136. we will assume that the original drive mapping is intact and that you have 
  137. not used SWAP to redefine the drive parameter tables.  In fact, the use of 
  138. SWAP is not restricted, and you may feel free to swap your drives at will 
  139. either before or after running HDS.
  140.  
  141.      With five drives being predefined, this leaves us eleven drives of 8Mb 
  142. each, which gives us 88Mb of space.  This will leave a TPA of about 56k.  
  143. If you have elected to size your system to allow 88Mb of space, you may use 
  144. HDS to 'mount' any eleven drives available to the system.  What this means 
  145. is that although you may have 22 logical drives attached to the system, you 
  146. may only define eleven of them as currently active.  This action is 
  147. referred to as 'mounting' the drive.  HDS will allow you to select any 
  148. eleven drives available and make them active on the system.  You may select 
  149. an individual logical drive, a group of logical drives, or an entire 
  150. physical drive.  HDS will accept options passed on the command line 
  151. describing what actions you want to take.
  152.  
  153. Syntax:  HDS [n|d]  (one option allowed - global select has priority)
  154.               n=logical drive number (global select)
  155.               d=list of drives to select
  156.  
  157.      When HDS selects a drive from the appropriate hard disk, it toggles
  158. the selection. To reset the drive, you must either reselect the drive, or
  159. do a global select to drive 0. You should either select a global option
  160. or a set of individual drives. If both options are specified, the global
  161. select will occur.
  162.  
  163. Examples:  HDS fghi  selects drives F,G,H and I from HD 1
  164.            HDS bij   (the drives do not need to be consecutive)
  165.            HDS c     selects drive C from HD 1
  166.            HDS 0     global select to HD 0 (reset).
  167.            HDS       shows map of system
  168.  
  169.      In the first example above, HDS will attach drives F,G,H and I from 
  170. logical drive 1 to the system replacing their counterparts on drive 0. The 
  171. drives do not have to be contiguous, as the second example shows. In this 
  172. example, drives B, I, and J are attached, replacing their counterparts on 
  173. drive 0.  In the third example, just drive C is exchanged.  In the fourth 
  174. example, a global select is issued to select all drives on logical hard 
  175. disk 0.  This can be used as a quick method of reseting the system. The 
  176. last example, HDS is run without a command line argument. This causes the
  177. system to display a map of the available drives on the system and how they
  178. are selected.
  179.  
  180.      HDS will monitor both the QUIET flag and the WHEEL byte in order to 
  181. control the display features and to provide system security.  The use of 
  182. the global select function requires that the wheel byte be set, if selected 
  183. during assembly. If the wheel byte is not set, the user is given an illegal 
  184. function error and control is returned to the operating system.  To give 
  185. you a higher level of security, I have provided a bitmap of the drives on 
  186. the system. Setting any of the drives in this bitmap will secure the drive 
  187. and will require that the wheel byte be set to mount that drive.
  188.  
  189.                          ABCDEFGH IJKLMNOP
  190. Example:  DRVMAP:   DB   01000000 00000000b
  191.  
  192.      In the example above, drive B has been set as secure.  This means that 
  193. if the wheel byte is not set, the user could not issue a command of 'HDS 
  194. B'. Attempting it would generate the illegal function error and return the 
  195. user to the operating system.
  196.  
  197.      For use on a remote access system, I've tied the display functions of 
  198. HDS to the QUIET flag.  When the quiet flag is on, no screen output is 
  199. generated during the selection of drives.  This will enable you to include 
  200. HDS in an alias and have it totally transparent to the user.  With the 
  201. QUIET flag off, a signon message will appear each time you run HDS.  The 
  202. same is true for the display function of HDS.  If you call HDS without a 
  203. command line option, it will give you a map of what drives are selected and 
  204. from which physical drive.  Table 6 shows an example of a typical run of 
  205. HDS.
  206. ----------------------------------------------------------------------
  207.  
  208. A0:BASE>HDS
  209. Hard Disk Select v1.03 (c) 05/17/89
  210. Written by Terry Pinto
  211. ZCPR v33   ZRDOS v19   Ampro BIOS v38   PHYTAB D072H
  212. (Type 3 - Loaded at 8000H)
  213. Selected Drives
  214.  
  215. A - Floppy Drive
  216. B - Floppy Drive
  217. C - Floppy Drive (not installed)
  218. D - Floppy Drive (not installed)
  219. E - Foreign Format Drive
  220. F - Drive 0
  221. G - Drive 0
  222. H - Drive 0
  223. I - Drive 0
  224. J - Drive 0
  225. K - Drive 0
  226. L - Drive 0
  227. M - Drive 0
  228. N - RAM Disk
  229. O - Does Not Exist
  230. P - Does Not Exist
  231.  
  232. Table 6.  Example of screen display after running HDS.
  233.  
  234. ----------------------------------------------------------------------
  235.  
  236.      You can see from the output that HDS reads the parameter table to 
  237. determine if a drive is on the system and, if so, what kind of drive it is.  
  238. Notice that all four floppy drives are always defined by Ampro but that on 
  239. this system drives C and D are 'not installed'.  The foreign format floppy 
  240. is drive E and is used for the reading/writing of disks formatted for other 
  241. systems.  The display shows that hard disk drives F-M are defined and are 
  242. currently the drives residing on the hard disk defined on your system as 
  243. being physical drive 0.  Drive N is defined as a RAM Disk (N/Systems) and 
  244. drives O and P do not exist on the system.
  245.  
  246.      If you select drives FGH and I, you get the output shown in Table 7. 
  247. Notice that the drive identifier for drives F,G,H and I now show that these 
  248. drives are currently attached from the hard disk defined on your system as 
  249. physical drive 1.
  250.  
  251. ----------------------------------------------------------------------
  252.  
  253. A0:BASE>HDS FGHI
  254. Hard Disk Select v1.03 (c) 05/17/89
  255. Written by Terry Pinto
  256. ZCPR v33   ZRDOS v19   Ampro BIOS v38   PHYTAB D072H
  257. (Type 3 - Loaded at 8000H)
  258. Selected Drives
  259.  
  260. A - Floppy Drive
  261. B - Floppy Drive
  262. C - Floppy Drive (not installed)
  263. D - Floppy Drive (not installed)
  264. E - Foreign Format Drive
  265. F - Drive 1
  266. G - Drive 1
  267. H - Drive 1
  268. I - Drive 1
  269. J - Drive 0
  270. K - Drive 0
  271. L - Drive 0
  272. M - Drive 0
  273. N - RAM Disk
  274. O - Does Not Exist
  275. P - Does Not Exist
  276.  
  277. Table 7.  Example of screen display after running HDS a second time.
  278.  
  279. ----------------------------------------------------------------------
  280.  
  281.      After the selection of the requested drives, it is necessary for HDS 
  282. to perform a disk reset to log in the newly defined drives.  To accomplish 
  283. this, HDS must know what type of DOS you are using.  A check is done to 
  284. determine if you are running vanilla CP/M 2.2, ZRDOS, or ZSDOS.  In either 
  285. case, an appropriate disk reset is called upon to log in the new drives. 
  286. During the check process, HDS also determines if you are running a vanilla 
  287. CP/M or a ZCPR3 system and gets the version number.  This is necessary to 
  288. enable HDS to find the physical tables in your BIOS.  The type of system 
  289. you are running will be displayed during the signon if the QUIET flag is 
  290. off. For now, HDS only detects Z33, Z34, and CP/M operating systems.  
  291. Future versions may include detection of CP/M plus.  
  292.  
  293. Online examples from Access Programming...
  294.  
  295.      To enable an easier way for the remote user to use HDS, I've placed
  296. the following alias' in my ALIAS.CMD file. (The case switching symbols
  297. have been eliminated to make the alias a little easier to read).
  298.  
  299. HDSEL echo;The Following Hard Disk Selections are Available;echo;echo
  300.       AMPRO;echo;MSDOS;echo;ZCPR;echo;SYSTEM;if wh;echo;EXTEND;fi;echo
  301. AMPRO  echo;Loading AMPRO Drivers - Please Wait...;hds 0;hds c
  302. MSDOS  echo;Loading MSDOS Drivers - Please Wait...;hds 0;hds dfghi
  303. ZCPR   echo;Loading ZCPR Drivers - Please Wait...;hds 0
  304. SYSTEM echo;Loading SYSTEM Drivers - Please Wait...;hds 0
  305. EXTEND echo;Loading EXTENDED Drivers - Please Wait...;hds 1
  306.  
  307. The HDSEL command will display the following selections:
  308.  
  309. A0:RCPM>HDSEL
  310.  
  311. The Following Hard Disk Selections are Available
  312.  
  313. AMPRO
  314. MSDOS
  315. ZCPR
  316. SYSTEM
  317. EXTEND
  318.  
  319. A0:RCPM>
  320.  
  321. This give my users an online guide to what is available. Running AMPRO
  322. will attatch drive C from HD 1. This is where all the Ampro specific
  323. file are located on my system. MSDOS will load drives D, F, G, H and I
  324. from HD 1 and allow the users to access the MSDOS programs stored there.
  325. ZCPR and SYSTEM actually perform the same function for now. ZCPR will
  326. grant access to the ZCPR specific files on HD 0. The SYSTEM command will
  327. serve as a system reset. I've made BYE an alias on my system allowing me
  328. to include the command 'HDS 0' in the signoff module. This effectively 
  329. resets my system for the next caller. This allows me to maintain a 
  330. default status so that each new caller will enter the operating system
  331. with the same drives attatched. The EXTEND command selects all drives 
  332. from HD 1 to the system. Much of my commercial software is kept here so
  333. I've set HDS to require that the wheel byte be set to do a global select
  334. to drive 1. I've also set up drive B as a secure drive. This is done by
  335. setting the corresponding bit in the drive bitmap to 1. If HDS detects
  336. the security bit on any drive passed on the command line, access will be
  337. denied.
  338.  
  339.                             ACKNOWLEDGEMENTS
  340.  
  341.      Many hours of research have gone into the development of HDS. Release
  342. of this software would not have been possible without the information that
  343. was obtained from the source code of version 3.8 of the Ampro BIOS. Much 
  344. of the information describing the bit selections necessary for HDS were 
  345. quoted directly from the source code listing.
  346.  
  347. If you would like a copy of HDS or have any questions about the software
  348. or its operation, please contact:
  349.  
  350. Terry Pinto
  351. Access Programming RAS
  352. 14385 SW Walker Rd. B3
  353. Beaverton, OR  97006
  354.  
  355. (503) 646-4937  6:00pm-10:00pm PST
  356. (503) 644-0900  300/1200/2400 8N1
  357. PCP ORPOR  StarLink 9164/222 (local exchange)
  358.