To : Whom It May Concern From : Richard C Holmes Date : 23/07/1991 Re : Z80 Source code modules / monitor / Exec / download In General ---------- The software on this disk / in this library constitutes a very large and extended programming (and debugging) effort over a number of years. It will be largely up to the user to determine how to use the software provided as it has always been an in-house product - no manuals exist for this software. The software is used to provide a control monitor program with quite a few facilities that make programming embedded Z80 systems a lot easier. The software is supplied in source and library form suitable for the RMAC/LINK/LIB digital research products and includes some batch files for linkage. RMAC was used as this is what I learned on and stuck to, thick and thin! Stop here. I am not interested in a debate as to the reletive merits of Intel instruction set vs Zilog. I learned on Intel with ASM on a CP/M 1.4 system and have stayed with these op-codes. Well, o.k. - I'll have my say :) I hate LD as an opcode - MVI/LXI/LHLD/LDED/STA/LDA.. etc.. are much more descriptive and "talk better in my head". I feel they are thefore less prone to being used by mistake than the common cure all LD instruction when you gotta use brackets and other things. URK. I bet it's difficult finding a mis-used LD instruction! The Copyrights of SME Systems and Holmes Industries are mine. I am a director of both companies and I HEREBY permit all the Z80 and HD64180 type software to be used so long as :- 1. No charge is made for it. It is still my code. You can use it, modify it, extract from it BUT NOT SELL IT. If you sell it then lets talk! 2. No liability under any circumstance is placed upon me or any of my companies due to its use or mis-use. You use the code, then any problems are yours. These notes have been written to a long time after the enclosed software was written. Signed...... Richard C Holmes. CAVEATs ------- The software that I give you has been used by me and my customers for years. This is not to say that it is bug free or even that it is suitable for anything other than looking at. Standard disclaimer.. All the code is in the Digital Research RMAC format and the (partial) support library I wrote for the hitachi derivative are provided. There are undoubtedly some enhanced instructions I have not bothered to encode....... I try to stick to a "RISC" type programming methode whereby I use a limited set of simple instructions and avoid at all cost anything that may get me "caught up". I like my code to be SIMPLE. As to the software itself, I have not been overly bothered with triky programming and tight code, rather, with making the source a little easier to work with and therefore reletively "clean". If I needed a faster program then I use a faster hardware solution. It is MUCH cheaper than fiddling with software unless quantity is involved. If you want tricky super tight software then forget it! I hope you agree with me. To us in a small-run commercial environment where debug time can be expensive, a little extra time spent planning and writing more maintainable code has been encouraged. I am giving this software to you because I have little use for it now. I love the Z80 and its derivatives and would like to see other users benefit from my effort. If you feel strongly enough about the software that you must tell me something, then please do so. I can be reached best via our post box :- Richard Holmes SME Systems P/L P.O. Box 409 Mitcham Australia. *** T H E S O F T W A R E *** There are two software sections that interest embedded systems programmers. 1. MONITOR A program for running in an embedded controller. 2. EXEC A part of the monitor that acts as a pseudo-dos. It provides a few functions and facilities that application programs can use. To put this together into a monitor for a new embedded controller product I follow these steps, assuming un-tried hardware :- 1. Design hardware. Use a Z80 or compatible. 2. Get hardware working with a port pulser. Pulse each port and observe on a CRO. This simple technique I have found invaluable to detect artwork faults. 3. Setup an I/O equates library for the hardware. 4. Modify an existing I/O driver library to suit. 5. Link modules together : monitor, exec, I/O, download (an example for the "moke" board is provided) 6. Put into rom and hope. If the hardware is good then it usually works first time or near enough. Usually it is a memory addressing or ram type fault if the monitor does not work on new hardware. --- Next I use the monitor to exercise all the hardware then I write my application program and download it to ram and run it / modify it / download it / run it till I'm happy. After this I tack my application program at the end of monitor code in the ROM and make the monitor run it automatically. Effectively then I ship out to a customer my monitor, the exec code and the application code sitting above it all. In practice, I have done this many times and with great success. CMON - Monitor -------------- Embedded controllers are a lot easier to work with when you can get simple access to the ports, memory, run down-loaded programs etc. Software for doing this I call a MONITOR. The "CMON" is such a monitor I wrote for my COREBOARD Z80 processor card. A manual is provided, in Wordstar format. The MOKEMON library is another example for a '64180 processor based card. The CMON files are :- CMON.ASM Monitor main module CMON.MAN Wordstar(tm) manual CSUBS.ASM Coreboard monitor subroutines DOWNLOAD.ASM Receives code from serial port and puts into ram RAMIO.ASM Parallel port mass memory storage driver IOAD.ASM A-D I/O driver IOLCD.ASM LCD I/O driver IOMAP.LIB '64180 port names and addresses (map) CORE.LIB Coreboard equates library HDZ.LIB Partial '64180 equates HDZ80 '64180 equates Z80.LIB Digital research Z80 library EXEC.LIB Library of EXEC call name equates. Vital. LNKCMON.ASM Linkage batch file to make a monitor 'com file. An example of another complete monitor is the MOKEMON. This is supplied in a separate library called "MOKEMON". There will be some duplicate code but it is complete in itself. EXEC ---- We write/wrote a lot of embedded controller software and this usually means a lot of assembler programming. To make this a bit easier I decided to impliment a sort of "pseudo-DOS" or "toolkit" of functions in the standard monitor accessable via an "RST" instruction. The result of this is that an embedded controller application program can be loaded onto the end of our monitor code, automatically run, an use the RST entry point to get a lot of services and facilities. One interesting point with the EXEC module is that I have provided a means to tie into the interrupts of the 64180 so that an application that it downloaded can take interrupts for serial I/O, timer and whatever then release them when it terminates. Another thing, the exec uses the concept of "channels". A channel is a means of doing I/O, usually character I/O to an LCD or printer or serial terminal etc. An example of what happens is that an application program selects the serial terminal, does its I/O then selects the LCD for more I/O and so on again and again. By doing this it allows an application program to use all the formatted routines for inputting and outputting to a bunch of different devices without having to do extensive re-writes. Modules EXEC Controller-Base module. Picks up commands, dispatches to I/O EXDIN "Dinos" '64180 I/O driver. EXMOKE Moke board I/O module EXECCORE Core board EXEC EXCORE I/O for core board EXECMON Old CMON modified for EXEC. Use CMON. Sample only. EXECCPM CP/M-Base module. Picks up commands, dispatches to I/O EXCPM Limited CP/M I/O driver. Test modules. Examples / Miscellaneous ET.ASM Test program for EXEC functions. IMI/O.ASM Interrupt driven I/O module for '64180. For example use. CSIO.ASM A play test of the clocked-sync-I/O port on the 64180 CLOCK.ASM An interrupt driven real time clock. Suspect bug at 24.00. CODE-LOADING ------------ When developing an embedded system, it is very handy to be able to test code without having to continually blow eproms then erase them. A real time saving is to send the code down a serial port, save to memory and then run it from the monitor. CODELOADING is the action of sending a '.COM file down a serial link and running on target hardware. The DLOAD.COM program sends a nominated file out the CP/M port. At the embedded controller it is caught and stuffed into the memory address that is specified by the user of the DLOAD program. The software in the controller should be using the "CODELOAD" module. Running the downloaded program is next done by the "G xxxx" command in the monitor. CODELOAD.ASM Source code to embedded controller "catcher" DLOAD.ASM Source to CP/M "sender" program (with V-terminal). DLOAD ----- This is the CP/M program for sending programs down a serial link to an embedded controller for running in ram. Press "C" for connect mode to act as a virtual terminal. Exit terminal mode with a control-\ (backslash) Press "Q" or ESC or Control-C to exit. Press "D" to start downloading. (DLOAD will now send an ESC to terminate/flush any buffer/activity by the controller and then collect and ignore up to 50 bytes returned by the controller). > Enter the file name to download to the controller > Enter the address to load to. > Enter number of bytes to download. Dload is NOT real smart. You can easily trick it. It is intended for use by not-dumb users which means anyone that tinkers with embedded controllers. The source is there for those that must have it - don't expect too much - enjoy!! ---- H A R D W A R E ---- This is not a list of items for sale. If you just must have one then maybe we can do a deal but I'd rather not!!! I would have to find one that works, test it........ It is provided to let you know what the software I am supplying runs on. DINOS ----- A processor card that forms the basis to a point of sale terminal as used in a PIZZA shop. It controls a 4 line 40 char LCD display, reads a 100 key switch array and is networked via an RS-485 link to a host computer. Features are :- * Fused switch mode power supply, transient protected. * One RS-232 port, transient protected. * One RS-485 port, , transient protected. * Connects to 4 line 40 char LCD * 12.288 mhz 64B180 * 32k rom, 32k ram * Batter backed ram * Power fail, watchdog via MAX-691 * Reads 8 by 16 matrix switch array * Beeper * Switched output for driving cash drawer * 6 bits of configuration input port * Spare 8 bit output port CORE Board ---- Some years ago I designed a "CORE BOARD" which had a HUGE amount of I/O and ports / options to make it suitable for embedded controller and special functions applications. It has * Z80, 4mhz (design, could go faster - 8255's limiting factor) * 32kb ram, 32kb rom (small mods required) * Real time clock, battery backed. * Power fail detect * Watchdog * 2 serial ports, * 4 X 8255 non-dedicated chips for general purpose I/O * All cmos (chip dependant). * Size 280mm by 165mm * +5, +12, -12 supplied required ('148x RS-232 drivers - old design - sorry) To support this board the "CMON" monitor was made. MOKE board ---- This is a small general purpose cpu board designed by a friend in his spare time. It is used as a basis to small embedded controller applications of his. I wrote a special monitor for it for him which is still being used in a breath tester of all things!. The hardware specs of the moke board are :- * HD64B180 (Hitachi) enhanced Z80, 12.288 mhz * 2 serial ports. MAX-232 charge pump chip on one port. * One male 25pin "D". * Un committed chip selects to expansion connector * Reset switch * 32k ram, 32k rom * Power fail/watchdog/battery support with MAX-691 * Address, control, data lines to expansion sockets * All cmos (chip dependant). * Size 110mm by 112mm * Single 5v supply Please see the MOKEMON libary. This (should be) a complete ready to go EXEC / CODELOAD / DMON file in some packed format. Unpack it, assemble the files under RMAC and link with LINK and use the LNKMOKE.SUB batch (I mean SUBMIT file) file. Good luck. Z80 forever.......Richard.