home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol236 / cpm3bios.dqc / CPM3BIOS.DOC
Encoding:
Text File  |  1986-02-11  |  15.0 KB  |  314 lines

  1.                               CP/M-3 BIOS ROUTINES
  2.                               ------ ---- --------
  3.          FOR A THINKER TOYS/MORROW DESIGNS DISK-JOCKEY DISK CONTROLLER.
  4.          --- - ------- ---- ------ ------- ----------- ---- ----------
  5.  
  6. This disk contains the bios routines I have used for running CP/M-3 on my
  7. computer. I hope they may be useful for someone implementing CP/M-3 on their
  8. machine although they will have to make some modifications.
  9.  
  10. My system has a Z80 cpu, a Thinker Toys/Morrow Designs 'Disk Jockey' disk
  11. controller (the memory mapped version, 1980 vintage) driving a single DSDD 8
  12. inch disk drive, a 512 kbyte semidisk, a Microangelo display board, a Thinker
  13. Toys/Morrow Designs 'switchboard' io board, Tarbell tape handler, and 3 memory
  14. boards, 2 with 64K and one with 16K. I have a 4K common memory. If your computer
  15. looks something like this then these routines should be very useful if you are
  16. wanting to implement CP/M-3. Otherwise they might still save you some of the
  17. detective work I had to do.
  18.  
  19. CP/M-3 fitted in well with my system and I now have just over 60K of memory
  20. available for programs despite the memory mapped disk controller board. Note
  21. that memory mapped part of the disk-controller board must not overlap the top 4K
  22. of memory which is used for common memory. The 4K of memory on my SSM cpu board
  23. (model CB2) provides the common memory and is especially convenient since it is
  24. accessible only by the Z80 and won't interfere with a second processor or
  25. require the blanking out of the corresponding blocks of the main memory boards -
  26. but note that the bank select code on the CB2 may be wrong, two bits being
  27. reversed on my one.
  28.  
  29. As well as the routines supplied by DR you will need Microsoft's M80 macro
  30. assembler, or you will have to translate my Zilog mnemonics to the Intel ones
  31. which can then be assembled using RMAC supplied with CP/M-3. To build the CP/M-3
  32. bios one needs to build a series of modules which are assembled and then linked
  33. together. The first of these modules, BIOSKRNL.ASM, is supplied by DR and is not
  34. modified except to set 'banked' to false if one is building the unbanked
  35. version. (You must build the unbanked version first, get it debugged, then
  36. modify it to get the banked version - some routines such as Morrow's FORMT# will
  37. run only under the unbanked version so you will need it anyway). The source for
  38. the rest of the modules I have used are on this disk and I will describe how
  39. they work and what modifications you might need to make. In many cases you must
  40. set 'banked' to false at the top of these routines when you want the unbanked
  41. version.
  42.  
  43.  
  44. SCB.ASM
  45.  
  46. This defines the locations in the System Control Block for the rest of the bios.
  47. The version here is the same as DR's except that I have added the locations of
  48. the variables that determine the disk search order, the temporary default disk,
  49. and whether .COM or .SUB files are executed. You need make no change to this.
  50.  
  51.  
  52. MOVE.MAC
  53.  
  54. This contains the routines for copying blocks of data and setting banks. This
  55. includes the routines ?move, ?xmove, ?bank described by DR and also ?bank0 for
  56. switching to bank 0 and setting up a temporary stack, ?rbank for returning to
  57. the current bank and ?trans for transferring large blocks of data from one bank
  58. to another. A buffer is set up in common memory for doing the transfers. Only
  59. ?move is required in the unbanked version. The only change you will need to make
  60. is to the routine ?bank. My processor board can switch the extended address and
  61. this is done with an 'out' instruction. The disk controller has bank select and
  62. so can be turned on if bank 0 is required, otherwise switched off. You may need
  63. different code here. If your system uses interrupts it would be advisable to
  64. disable them when switching to a bank other than bank 1.
  65.  
  66.  
  67. CHARIO.MAC
  68.  
  69. This contains the io routines for the console, keyboard, printer, auxiliary
  70. devices, etc. DR's version is for a computer that can switch baud rates and is
  71. much more complicated than is required for a simple machine like mine. I have
  72. still set up a table containing the baud rates so that DR's system programs can
  73. look at them but do not need facilities for changing them. Five routines are
  74. required: ?cinit to initialize devices, ?ci for inputing characters, ?co for
  75. outputing characters, ?cist for getting input status, ?cost for getting output
  76. status. Each of these routines involves a call to a routine 'jump' which,
  77. together with a table following that call transfers control to the code
  78. appropriate for the particular device and function. Note that ?cist and ?cost
  79. must not change register bc.
  80.  
  81. I have implemented 3 versions of the code to drive the Micro-Angelo board
  82. (including double size output) and this will be of no interest to people who
  83. don't have a Micro-Angelo board. Much of the code is for interfacing the MA
  84. board and everything looks a lot simpler when this is deleted. The standard
  85. Thinker Toys console input/output is the second device. This routine jumps into
  86. the middle of the disk controller code to get input characters (so that bit 8 is
  87. not stripped off) and you might need to change this. You may also need to modify
  88. the printer interface - which is attached to a parallel port - and the port
  89. numbers. (Its probably better to access a tape and switchboard directly with
  90. 'in' and 'out' instructions since access via the bios may be too slow and
  91. characters may be lost). You will also want to change what the devices are
  92. called to what you have attached to the various ports (I have a MODEM and a
  93. MOUSE attached to the switchboard serial ports).
  94.  
  95.  
  96. DISKDEFN.ASM
  97.  
  98. This contains the disk definitions to be generated with DR macros in CPM3.LIB.
  99. Although I have only one disk I want to be able to call it drive A, B or C and
  100. so have defined dph-s for each of these. Drive D is the semidisk, so delete
  101. references to drive D and semidisk if you don't have a semidisk. The dph-s and
  102. skew tables are for the various formats used by Thinker Toys. The order of the
  103. names in the table 'dskdef' is intended to fit in with the format code returned
  104. by the disk-controller.
  105.  
  106.  
  107. DISKHNDL.MAC
  108.  
  109. This contains the disk handling routines and includes the routines for reading,
  110. writing, disk selection, and determining the format of the disk. I assume the
  111. disk jockey memory has its origin at E000H and in the banked case that there is
  112. real memory from E800H to EBFFH. Numerous changes would have to be made in this
  113. routine for other disk controllers and different versions of the disk-jockey
  114. might require different equates. 'djleav' and 'djprep' point to routines which
  115. enable one to determine the format of a disk without doing a read or write and
  116. in effect define the code which is common to read and write. If you can't find
  117. equivalent routines in your system, just read into a spare piece of memory to
  118. determine the disk format. The main problems which must be solved in this module
  119. are determination of the disk format, requesting that the disk be changed when a
  120. different drive is requested and reading to or writing from a memory bank other
  121. than bank 0. The disk jockey codes returned for indicating the disk format (bit
  122. 5 = 1 for double sided, bits 2,3 = 0 for 128 byte sectors, 1 for 256 byte
  123. sectors, 2 for 512 byte sectors, 3 for 1024 byte sectors) mesh with the order of
  124. the tables given in DISKDEFN.ASM. Divide this code by two, add the address,
  125. 'dskdef' to get the address of the appropriate skew table, add a further 8 to
  126. get the appropriate dpb table. Some rewriting will be required for a different
  127. format code. Note that for double sided disks, we pretend that the disk has 154
  128. tracks the 0th track on side 0 being called track 0 and the 0th on side 1 being
  129. call track 1 etc. If 'check' is set to true details of each disk operation are
  130. returned to the console. For multidisk systems, delete the drive select code
  131. following entry 'finita' and replace the code following entry 'dsk' with code
  132. that picks up the drive name and selects that drive. Different disk controllers
  133. may have different error codes and hence may require different code following
  134. the calls to djread, djwrite, djleav (Disk-jockey read and writes return a
  135. status variable in register A with bit 7 set if the drive door is open, bit 6
  136. set if a write is attempted to a write protected disk, bit 5 set for an illegal
  137. dma address, bit 4 set for an illegal sector, and bits 0,1,2 or 3 set for
  138. various read or write errors).
  139.  
  140.  
  141. SEMIHNDL.MAC
  142.  
  143. The semidisk handling routines - good only for a 512K semidisk, version I (ie
  144. parity checking must be done with software). Do not include if you haven't got a
  145. semidisk. The routines here are adapted from those supplied by Semidisk and are
  146. given here with the permission of Semidisk.
  147.  
  148.  
  149. BOOT.MAC
  150.  
  151. This is for firing up the system after CP/M-3 is loaded. It has two jobs -
  152. setting up a variety of constants and loading the CCP into a spare bit of memory
  153. (in the present case above the disk-jockey's memory in the unbanked case and the
  154. bottom of memory bank 2 in the banked case). You will need to make the following
  155. changes: console out and console in etc will be different and you probably won't
  156. want disk D being your temporary disk (leave out that assignment). For a start,
  157. unless you have the same memory arrangements as mine, I suggest you always load
  158. the CCP from disk, by deleting the code following ?rlccp and simply jumping to
  159. ?ldccp and also delete the code following 'if banked' in the section following
  160. ?ldccp, replacing it with ret. If you have a clock, you can implement the entry
  161. ?time.
  162.  
  163.  
  164. This concludes the description of the bios routines and you can now assemble and
  165. load them, and then use GENCPM.COM to form CPM3.SYS. In the unbanked case use a
  166. submit file like the following
  167.  
  168.  rmac.com bioskrnl
  169.  m80.com = boot
  170.  m80.com = move
  171.  m80.com = chario
  172.  rmac.com diskdefn
  173.  m80.com = diskhndl
  174.  m80.com = semihndl
  175.  rmac.com scb
  176.  link.com bios3[os,q]=bioskrnl,boot,move,chario,diskdefn,diskhndl,semihndl,scb
  177.  era cpm3.bak
  178.  ren cpm3.bak=cpm3.sys
  179.  gencpm.com
  180.  
  181. and in the banked case use
  182.  
  183.  rmac.com bioskrnl
  184.  m80.com = boot
  185.  m80.com = move
  186.  m80.com = chario
  187.  rmac.com diskdefn
  188.  m80.com = diskhndl
  189.  m80.com = semihndl
  190.  rmac.com scb
  191.  link.com bnkbios3[b,q]=bioskrnl,boot,move,chario,diskdefn,diskhndl,semihndl,scb
  192.  era cpm3.bak
  193.  ren cpm3.bak=cpm3.sys
  194.  gencpm.com
  195.  
  196. I include the file GENCPM.DAT for my system for the banked case which might give
  197. some indication as to the answers to the questions GENCPM will ask. Note that in
  198. the banked case you must give the bottom of the disk-controller memory as the
  199. bottom of common memory (even though this is a lie).
  200.  
  201. However, you are not yet ready. You must also build CPMLDR which is a cut down
  202. CP/M used for loading CPM3.SYS. In my system two modules are required.
  203.  
  204.  
  205. DDLDR.ASM
  206.  
  207. This is a cut down version of DISDEFN.ASM and only drive A need be defined.
  208.  
  209.  
  210. LDRBIOS.MAC
  211.  
  212. This is a cut down version of the rest. It starts with a CP/M-3 jump vector and
  213. by disassembling a trial version of CPMLDR I was able to find which entries were
  214. actually used. The remarks made under DISKHNDL.MAC also apply here.
  215.  
  216.  
  217. One can now assemble CPMLDR.COM
  218.  
  219.  link.com cpmldr[L100]=cpmldr,ldrbios,ddldr
  220.  
  221. One is now ready to go since CPMLDR can be called from CP/M-2 (or unbanked
  222. CP/M-3). The manual gives some instructions for debugging using SID (remember,
  223. SID will get upset if it hits a Z80 instruction). However the main moral is to
  224. start up with the simplest possible version. Unless you are almost exactly
  225. following mine, initially forget disk swapping or variable density, or even
  226. multiple drives if you have these.
  227.  
  228.  
  229. LOADSYS.MAC
  230.  
  231. You want CP/M-3 to boot directly on switch on rather than getting CP/M-2 and
  232. then running CPMLDR. I have written a routine LOADSYS.MAC to load CPMLDR onto
  233. track 1 of the disk and a preliminary loader onto track 0. This works for the 4
  234. disk formats recognised by the disk-jockey. Because slightly different versions
  235. are required for the different disk formats part of the routine is used for
  236. identifying the disk format from the disk tables. The actual loading process is
  237. as follows. On switch on the cpu starts executing code in the disk-jockey rom.
  238. This loads the first record from track 0, side 0 of the disk in drive A to
  239. memory starting at, in my case, location E700H. Control is then transferred to
  240. E700H where, hopefully, there is now a routine for loading CPMLDR from track 1
  241. of the disk. Apart from possible adjusting location E700H, there should be
  242. almost no modifications to the bulk of this routine for a standard disk-jockey
  243. disk controller. This version allows CPMLDR to be loaded onto drive A, B, or C.
  244. You may wish to change this by changing the 'cp 3' following the label 'uc'.
  245. However the disk controller calls in the primary loader rdcpm must be checked.
  246.  
  247. This routine should be compiled with M80 and then linked with Microsoft's L80.
  248.  
  249.  
  250. I have also included several other files to help you implement or run CP/M-3.
  251.  
  252.  
  253. REBOOT.MAC
  254.  
  255. This does the same job as a reset key and is unnecessary if you have a reset
  256. key. It is used for restarting your system after building a new version of
  257. CPM3.SYS, CPMLDR, or LOADSYS. You will need to rewrite the bank select and the
  258. boot location. Assemble and link with M80 and L80.
  259.  
  260.  
  261. SEESCB.RAT, ACCSCB.MAC
  262.  
  263. A ratfor routine and M80 subroutine for displaying the contents of the System
  264. Control Block.
  265.  
  266.  
  267. BARB2.MAC
  268.  
  269. This is for checking that you have memory banks where you think you have them.
  270. It relocates itself in common memory then requests a bank number (control-c will
  271. cause a reboot at this stage) and then a range of memory to be tested. This
  272. routine is very untidy if a whole block of memory is missing and you might like
  273. to tidy it up. Nevertheless, it is very useful for checking that bank select is
  274. working and your memory is really there. You will need to change the console
  275. input and output routines, the reboot location, and the bank select routine.
  276.  
  277.  
  278. IF.MAC
  279.  
  280. Used for putting simple conditional statements into submit files. For example
  281.  
  282.  IF $1=YES
  283.  :PROG1
  284.  IF $1#YES
  285.  :PROG2
  286.  
  287. in a submit file will run PROG1 if the first parameter is the submit call is
  288. YES, otherwise it will run PROG2.
  289.  
  290.  
  291. OVLMNGR.MAC
  292.  
  293. DR's LINK can produce overlayed programs. However to use this facility you need
  294. a routine in DR's PL1 runtime library. OVLMNGR is an attempt to simulate this
  295. routine for use with, say, Fortran programs with Microsoft conventions. Only
  296. overlay method 1 is implemented and an additional restriction is that a maximum
  297. of two parameters may be passed to the subroutine heading the overlay.
  298.  
  299.  
  300. PRINT.MAC
  301.  
  302. This is an RSX for printing a file while allowing most normal computer
  303. operations to continue simultaneously. That is, it is a CPM-3 translation of the
  304. 'unspool' program that is available for CPM-2. To form the code file, one needs
  305. to go through the following sequence of instructions.
  306.  
  307.  m80.com = print
  308.  link.com print [op]
  309.  rename print.rsx=print.prl
  310.  era print.com
  311.  gencom.com print [null]
  312.  
  313.  you have a reset
  314. key. It is used for restarting your system after building