home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / hd64180a.lbr / EXEC.DZC / EXEC.DOC
Text File  |  1991-08-04  |  13KB  |  373 lines

  1. To   : Whom It May Concern
  2.  
  3. From : Richard C Holmes
  4.  
  5. Date : 23/07/1991
  6.  
  7. Re   : Z80 Source code modules / monitor / Exec / download
  8.  
  9.  
  10. In General
  11. ----------
  12.  
  13. The software on this disk / in this library constitutes a very large and
  14. extended programming (and debugging) effort over a number of years. It
  15. will be largely up to the user to determine how to use the software
  16. provided as it has always been an in-house product - no manuals exist
  17. for this software.
  18.  
  19. The software is used to provide a control monitor program with quite a
  20. few facilities that make programming embedded Z80 systems a lot easier.
  21. The software is supplied in source and library form suitable for the
  22. RMAC/LINK/LIB digital research products and includes some batch files
  23. for linkage. RMAC was used as this is what I learned on and stuck to,
  24. thick and thin!
  25.  
  26.  
  27. Stop here. I am not interested in a debate as to the reletive merits of
  28. Intel instruction set vs Zilog. I learned on Intel with ASM on a CP/M
  29. 1.4 system and have stayed with these op-codes.
  30.  
  31. Well, o.k. - I'll have my say :)
  32.  
  33. I hate LD as an opcode - MVI/LXI/LHLD/LDED/STA/LDA.. etc.. are much more
  34. descriptive and "talk better in my head". I feel they are thefore less
  35. prone to being used by mistake than the common cure all LD instruction
  36. when you gotta use brackets and other things. URK. I bet it's difficult
  37. finding a mis-used LD instruction!
  38.  
  39.  
  40.  
  41. The Copyrights of SME Systems and Holmes Industries are mine. I am a
  42. director of both companies and I HEREBY permit all the Z80 and HD64180
  43. type software to be used so long as :-
  44.  
  45. 1. No charge is made for it. It is still my code. You can use it, modify
  46.    it, extract from it BUT NOT SELL IT. If you sell it then lets talk!
  47.  
  48. 2. No liability under any circumstance is placed upon me or any of my
  49.    companies due to its use or mis-use. You use the code, then any
  50.    problems are yours.
  51.  
  52. These notes have been written to a long time after the enclosed software
  53. was written.
  54.  
  55. Signed...... Richard C Holmes.
  56.  
  57.  
  58.  
  59.  
  60.  
  61. CAVEATs
  62. -------
  63.  
  64. The software that I give you has been used by me and my customers for
  65. years. This is not to say that it is bug free or even that it is
  66. suitable for anything other than looking at. Standard disclaimer..
  67.  
  68. All the code is in the Digital Research RMAC format and the (partial)
  69. support library I wrote for the hitachi derivative are provided. There
  70. are undoubtedly some enhanced instructions I have not bothered to
  71. encode.......
  72.  
  73. I try to stick to a "RISC" type programming methode whereby I use a
  74. limited set of simple instructions and avoid at all cost anything that
  75. may get me "caught up". I like my code to be SIMPLE.
  76.  
  77. As to the software itself, I have not been overly bothered with triky
  78. programming and tight code, rather, with making the source a little
  79. easier to work with and therefore reletively "clean". If I needed a
  80. faster program then I use a faster hardware solution. It is MUCH cheaper
  81. than fiddling with software unless quantity is involved.
  82.  
  83. If you want tricky super tight software then forget it! I hope you agree
  84. with me. To us in a small-run commercial environment where debug time
  85. can be expensive, a little extra time spent planning and writing more
  86. maintainable code has been encouraged.
  87.  
  88. I am giving this software to you because I have little use for it now. I
  89. love the Z80 and its derivatives and would like to see other users
  90. benefit from my effort.
  91.  
  92. If you feel strongly enough about the software that you must tell me
  93. something, then please do so.
  94.  
  95. I can be reached best via our post box :-
  96.  
  97.         Richard Holmes
  98.         SME Systems P/L
  99.         P.O. Box 409 Mitcham
  100.         Australia.
  101.  
  102.  
  103.  
  104.  
  105.  
  106. *** T H E    S O F T W A R E ***
  107.  
  108. There are two software sections that interest embedded systems programmers.
  109.  
  110. 1. MONITOR
  111.    A program for running in an embedded controller.
  112.  
  113. 2. EXEC
  114.    A part of the monitor that acts as a pseudo-dos. It provides a few
  115.    functions and facilities that application programs can use.
  116.  
  117.  
  118. To put this together into a monitor for a new embedded controller
  119. product I follow these steps, assuming un-tried hardware :-
  120.  
  121. 1. Design hardware. Use a Z80 or compatible.
  122.  
  123. 2. Get hardware working with a port pulser. Pulse each port and observe
  124.    on a CRO. This simple technique I have found invaluable to detect
  125.    artwork faults.
  126.  
  127. 3. Setup an I/O equates library for the hardware.
  128.  
  129. 4. Modify an existing I/O driver library to suit.
  130.  
  131. 5. Link modules together : monitor, exec, I/O, download
  132.    (an example for the "moke" board is provided)
  133.  
  134. 6. Put into rom and hope. If the hardware is good then it usually works
  135.    first time or near enough. Usually it is a memory addressing or ram
  136.    type fault if the monitor does not work on new hardware.
  137.  
  138. --- Next I use the monitor to exercise all the hardware then I write my
  139. application program and download it to ram and run it / modify it /
  140. download it / run it till I'm happy. After this I tack my application
  141. program at the end of monitor code in the ROM and make the monitor run
  142. it automatically. Effectively then I ship out to a customer my monitor,
  143. the exec code and the application code sitting above it all. In
  144. practice, I have done this many times and with great success.
  145.  
  146.  
  147.  
  148. CMON - Monitor
  149. --------------
  150.  
  151. Embedded controllers are a lot easier to work with when you can get
  152. simple access to the ports, memory, run down-loaded programs etc.
  153.  
  154. Software for doing this I call a MONITOR. The "CMON" is such a monitor I
  155. wrote for my COREBOARD Z80 processor card. A manual is provided, in
  156. Wordstar format. The MOKEMON library is another example for a '64180
  157. processor based card.
  158.  
  159. The CMON files are :-
  160.  
  161. CMON.ASM        Monitor main module
  162. CMON.MAN        Wordstar(tm) manual
  163. CSUBS.ASM       Coreboard monitor subroutines
  164. DOWNLOAD.ASM    Receives code from serial port and puts into ram
  165. RAMIO.ASM       Parallel port mass memory storage driver
  166. IOAD.ASM        A-D I/O driver
  167. IOLCD.ASM       LCD I/O driver
  168.  
  169. IOMAP.LIB       '64180 port names and addresses (map)
  170. CORE.LIB        Coreboard equates library
  171. HDZ.LIB         Partial '64180 equates
  172. HDZ80           '64180 equates
  173. Z80.LIB         Digital research Z80 library
  174. EXEC.LIB        Library of EXEC call name equates. Vital.
  175.  
  176. LNKCMON.ASM     Linkage batch file to make a monitor 'com file.
  177.  
  178. An example of another complete monitor is the MOKEMON. This is supplied
  179. in a separate library called "MOKEMON". There will be some duplicate
  180. code but it is complete in itself.
  181.  
  182.  
  183.  
  184. EXEC
  185. ----
  186.  
  187. We write/wrote a lot of embedded controller software and this usually
  188. means a lot of assembler programming. To make this a bit easier I
  189. decided to impliment a sort of "pseudo-DOS" or "toolkit" of functions in
  190. the standard monitor accessable via an "RST" instruction.
  191.  
  192. The result of this is that an embedded controller application program
  193. can be loaded onto the end of our monitor code, automatically run, an
  194. use the RST entry point to get a lot of services and facilities.
  195.  
  196. One interesting point with the EXEC module is that I have provided a
  197. means to tie into the interrupts of the 64180 so that an application
  198. that it downloaded can take interrupts for serial I/O, timer and
  199. whatever then release them when it terminates.
  200.  
  201. Another thing, the exec uses the concept of "channels". A channel is a
  202. means of doing I/O, usually character I/O to an LCD or printer or serial
  203. terminal etc. An example of what happens is that an application program
  204. selects the serial terminal, does its I/O then selects the LCD for more
  205. I/O and so on again and again. By doing this it allows an application
  206. program to use all the formatted routines for inputting and outputting
  207. to a bunch of different devices without having to do extensive
  208. re-writes.
  209.  
  210. Modules
  211.  
  212. EXEC            Controller-Base module. Picks up commands, dispatches to I/O
  213. EXDIN           "Dinos" '64180 I/O driver.
  214. EXMOKE          Moke board I/O module
  215.  
  216. EXECCORE        Core board EXEC
  217. EXCORE          I/O for core board
  218. EXECMON         Old CMON modified for EXEC. Use CMON. Sample only.
  219.  
  220. EXECCPM         CP/M-Base module. Picks up commands, dispatches to I/O
  221. EXCPM           Limited CP/M I/O driver. Test modules.
  222.  
  223.  
  224. Examples / Miscellaneous
  225.  
  226. ET.ASM          Test program for EXEC functions.
  227. IMI/O.ASM       Interrupt driven I/O module for '64180. For example use.
  228. CSIO.ASM        A play test of the clocked-sync-I/O port on the 64180
  229. CLOCK.ASM       An interrupt driven real time clock. Suspect bug at 24.00.
  230.  
  231.  
  232.  
  233.  
  234. CODE-LOADING
  235. ------------
  236.  
  237. When developing an embedded system, it is very handy to be able to test
  238. code without having to continually blow eproms then erase them. A real
  239. time saving is to send the code down a serial port, save to memory and
  240. then run it from the monitor.
  241.  
  242. CODELOADING is the action of sending a '.COM file down a serial link and
  243. running on target hardware.
  244.  
  245. The DLOAD.COM program sends a nominated file out the CP/M port. At the
  246. embedded controller it is caught and stuffed into the memory address
  247. that is specified by the user of the DLOAD program. The software in the
  248. controller should be using the "CODELOAD" module.
  249.  
  250. Running the downloaded program is next done by the "G xxxx" command in
  251. the monitor.
  252.  
  253. CODELOAD.ASM            Source code to embedded controller "catcher"
  254. DLOAD.ASM               Source to CP/M "sender" program (with V-terminal).
  255.  
  256.  
  257.  
  258. DLOAD
  259. -----
  260.  
  261. This is the CP/M program for sending programs down a serial link to an
  262. embedded controller for running in ram.
  263.  
  264. Press "C" for connect mode to act as a virtual terminal.
  265.           Exit terminal mode with a control-\  (backslash)
  266.  
  267. Press "Q" or ESC or Control-C to exit.
  268.  
  269. Press "D" to start downloading.
  270.         (DLOAD will now send an ESC to terminate/flush any
  271.         buffer/activity by the controller and then collect and ignore up
  272.         to 50 bytes returned by the controller).
  273.  
  274.         > Enter the file name to download to the controller
  275.  
  276.         > Enter the address to load to.
  277.  
  278.         > Enter number of bytes to download.
  279.  
  280. Dload is NOT real smart. You can easily trick it. It is intended for use
  281. by not-dumb users which means anyone that tinkers with embedded
  282. controllers. The source is there for those that must have it - don't
  283. expect too much - enjoy!!
  284.  
  285.  
  286.  
  287.  
  288. ---- H A R D W A R E ----
  289.  
  290. This is not a list of items for sale. If you just must have one then
  291. maybe we can do a deal but I'd rather not!!! I would have to find one
  292. that works, test it........
  293.  
  294. It is provided to let you know what the software I am supplying runs on.
  295.  
  296.  
  297. DINOS
  298. -----
  299.  
  300. A processor card that forms the basis to a point of sale terminal as
  301. used in a PIZZA shop. It controls a 4 line 40 char LCD display, reads a
  302. 100 key switch array and is networked via an RS-485 link to a host
  303. computer. Features are :-
  304.  
  305. * Fused switch mode power supply, transient protected.
  306. * One RS-232 port, transient protected.
  307. * One RS-485 port, , transient protected.
  308. * Connects to 4 line 40 char LCD
  309. * 12.288 mhz 64B180
  310. * 32k rom, 32k ram
  311. * Batter backed ram
  312. * Power fail, watchdog via MAX-691
  313. * Reads 8 by 16 matrix switch array
  314. * Beeper
  315. * Switched output for driving cash drawer
  316. * 6 bits of configuration input port
  317. * Spare 8 bit output port
  318.  
  319.  
  320. CORE Board
  321. ----
  322.  
  323. Some years ago I designed a "CORE BOARD" which had a HUGE amount of I/O
  324. and ports / options to make it suitable for embedded controller and
  325. special functions applications.
  326.  
  327. It has
  328.  
  329. * Z80, 4mhz  (design, could go faster - 8255's limiting factor)
  330. * 32kb ram, 32kb rom (small mods required)
  331. * Real time clock, battery backed.
  332. * Power fail detect
  333. * Watchdog
  334. * 2 serial ports,
  335. * 4 X 8255 non-dedicated chips for general purpose I/O
  336. * All cmos (chip dependant).
  337. * Size 280mm by 165mm
  338. * +5, +12, -12 supplied required ('148x RS-232 drivers - old design - sorry)
  339.  
  340. To support this board the "CMON" monitor was made.
  341.  
  342.  
  343. MOKE board
  344. ----
  345.  
  346. This is a small general purpose cpu board designed by a friend in his
  347. spare time. It is used as a basis to small embedded controller
  348. applications of his. I wrote a special monitor for it for him which is
  349. still being used in a breath tester of all things!.
  350.  
  351. The hardware specs of the moke board are :-
  352.  
  353. * HD64B180 (Hitachi) enhanced Z80, 12.288 mhz
  354. * 2 serial ports. MAX-232 charge pump chip on one port.
  355. * One male 25pin "D".
  356. * Un committed chip selects to expansion connector
  357. * Reset switch
  358. * 32k ram, 32k rom
  359. * Power fail/watchdog/battery support with MAX-691
  360. * Address, control, data lines to expansion sockets
  361. * All cmos (chip dependant).
  362. * Size 110mm by 112mm
  363. * Single 5v supply
  364.  
  365. Please see the MOKEMON libary. This (should be) a complete ready to go
  366. EXEC / CODELOAD / DMON file in some packed format. Unpack it, assemble
  367. the files under RMAC and link with LINK and use the LNKMOKE.SUB batch
  368. (I mean SUBMIT file) file.
  369.  
  370. Good luck. Z80 forever.......Richard.
  371.  
  372.