Z80 Space-Time Productions Single Board Computer
Technical Support Information - Monitor ROMs
There are several version of the MCB Monitor program produced by Space-Time Productions.
Disassembly
Download
What's On the Menu?
If you purchased the 2K 2716 Monitor Rom when you bought this kit, you likely received the same instruction sheets that I did. One of them contained the monitor command set. This is standard for both V4 and V5 of the TTY versions of the monitor. The 8279 commands are similar but have some major function differences.
The command set for this monitor is as follows:
|
Instruction Notes
These are the notes that accompanied the monitor rom when I purchased it:
|
SINGLE BOARD HEX MONITOR The Single Board Hex Monitor allows you to exam(ine) or modify the contents of the Z-80's registers, memory, and I/O ports from an ASCII terminal without building any complicated switches, address counters, or buffers. Also included is a very simple memory test program, a program to move memory from one location to another, a program to compare (or verify) two memory blocks, and a routine to load memory from Intel hex tape. BREAKPOINTS The most powerful feature of the monitor is the program breakpoint function. By executing a RST 7 (RST 38H [$FF]), a call 0038H, or hitting the NMI switch on the processor, the contents of the Z80's registers are saved and the Monitor resumes control. You can then exam(ine) the contents of memory or registers, modify them if desired, and resume execution of the program by typing G. Please note that the SIO is only initialized on on Power-Up, or by executing the "A" command. The monitor will use whatever params, speed, etc. that you might have changed, so be careful. HEX ENTRY: All input and output to the Monitor is Hexadecimal Notation, also known as Base 16 arithmetic, or Hex for short. The digits are 0-9,A-F. When entering a hex field, leading zeroes are not necessary, unless you make an error. The Monitor does no error checking of digits, and there is no delete character. However the Monitor always uses on the last two (2) digits if a [port,chan,value], or the last four (4) digits if an [addr]. So if you make a mistake, just retype (including leading zeroes) the value or address. Of course, you can abort the command by typing CONTROL-C. Each [addr] or [value] field must be terminated by a [CR], [LF], [comma], or [space] character. REPEATED FUNCTIONS: The Exam(ine)/Modify register command, and the Substitute/Modify memory command allows you to step thru multiple locations. To terminate the command just end the line with [CR]. ABORT FUNCTION: If you are in the "middle" of a command line, CONTROL-C will ABORT the command. Typing CONTROL-C after you have terminated G command will not abort the command because control has already been passed from the Monitor to the program. |
System Calls
Here are a few of the monitor's more often used system call locations for you to use. These are very convenient for calling from your own programs, thereby shortening your own coding.
| $0008 RST 08H | Transmits a character in A out RS232 port A. |
| $0010 RST 10H | Receives a character into A over RS232 port A. |
| $0018 RST 18H | Checks the status of the RS232 Port A, RX char ready=CY flag set, TX buffer empty=Z flag set. |
| $004C SPC | Transmits a space out the RS232 Port A. |
| $0068 CPHLDE | Performs a compare of HL-DE, sets Z flag if equal. |
| $0072 MON | Normal Entry point for monitor. |
| $0273 HLOUT | Converts contents of HL to ASCII characters and outputs to TTYA. |
| $0294 PRINT | Loads byte at (HL) into counter, prints character string from (HL+1) until counter is decremented to zero. |
| $029B TXCRLF | Transmits a "New Line", CR ($0D) and LF ($0A) characters. |
| $029E BCOUT | Transmits ASCII chars contained in B and C registers. |
| $02BC GETXYZ | Gets characters from user as XXXX,YYYY,ZZZZ; Puts XXXX in HL, ZZZZ in DE, Subtracts YYYY-ZZZZ+1 into BC forming a byte counter. |
| $02DE GETX | Gets the last 4 hex characters the user types as a value into HL. You may type 02343123F3A9B332ABCD, the value in HL would be $ABCD. This works in lieu of tracking an input buffer of text and handling backspace, cursor controls, etc. Backspace does not function, but you will get used to using this feature, young Jedi. |
| $0306 GETXY | Gets the first hex value into DE, separated by a comma, and the second into HL. Useful for setting up a starting and ending address. |
| $030D BCTOA | Converts the ASCII hex characters in BC into an actual byte value in A |
| $0326 ATOBC | Converts the byte in A into ASCII hex characters in BC |
Shortly after I figured out by guessing (that's right) that RST 08 would print the character in A to the RS232 terminal, I was able to modify and upload a variant of the J. Kerr 1K disassembler into ram [see Software Downloads for this completed program]. I used this, running on the Z80 to get a source listing of its own 2K monitor rom by capturing the text that the Z-80 sent across to HyperTerminal into a text file. I saved that text document and took up the long task of figuring out what the code was doing, documenting areas as I went.
This document also contains the code that was used to operate an EPROM burner pcb. This is a separate board that attaches to one of the p8255 ports of the MCB. I've documented some of this, but not all. Also, there is an interesting "Easter Egg" section of code at the top of the Rom concerning the 8279 keyboard/display controller.
Download this document in Word format: MONITOR.DOC
Download the Intel Hex of this rom: ORIGMON.TXT
Running Your Own Programs
I'm not going to bother discussing the hand-entry programming method, it's doubleplus ridiculous and labor intensive.
Running your own programs on the MCB consists of 4 main steps:
You may use any text editor to write your assembly language program that you prefer. I used Ultra Edit because of it's powerful search and replace features. Save this file with some name and a ".asm" suffix. Note here that many assemblers may operate from the DOS prompt on your PC, so you will want to limit your program names to 8 characters plus '.ASM' for the filename.
Using the assembler of your choice (I use TASM), assemble the file. I should note here that because TASM uses several parameters, I create a batch file which matches the name of my assembly text file. The contents of the batch file looks something like this:
tasm -80 -g0 -h -i -ll -o10 ANSI.ASM ANSI.OBJ ANSI.LST
This tells TASM to assemble the file named ANSI.ASM into an Intel Hex file called ANSI.OBJ and create a program listing called ANSI.LST. This listing can be used to test the assembly for any errors. Always check this file after assembling to make sure your program assembled correctly.
I communicate with my Space-Time MCBs by way of RS-232 serial interface over the PC's COM port using Hyperterminal. With this program, you can command the MCB to Load an Intel Hex File. From the Hyperterminal menu you can select Transfer, then select Send Text File. The program will load into your MCB's memory and you can then tell the MCB to Go to the program to run it.
How To's:
MCBs that have not been memory-modified will have to have their assembly language programs start in static ram, that is from $3000 - $37FF. I strongly recommend if you are a novice programmer, stay out of the $37xx page. The monitor plays with its stack at $3Fxx, but electrically this is the same as $37FF. Remember, the MCB static ram exists only from $3000-$37FF. If you write things into $3800-$3FFF you are overwriting the low half of this 4K block ($3000-$3FFF). My practice has been to .ORG my programs at $3000 for my unmodified boards.
Somewhere along the way, I either read or heard that to terminate a program, you should conclude it with a RET for the monitor. Well, this doesn't work right - never has. Because the monitor pops all the user's registers at Go, your program should terminate with JP 0038. This way, when your program ends, you can type "R" for the Register display command and see the registers contents when your program completed.
Using the Go command with breakpoint is a great way to test run a program up to the breakpoint location. After you've examined the registers using the Register command, you can use the Kill command to restore your program's memory content at the breakpoint location. A following G will cause the program to pick up where it stopped before.
I've not used the breakpoint feature often as I tend to keep my assembly file open and make adjustments as I see things.
Smart Tools:
I can't recommend strongly enough, if you are just learning about the Z80 and writing programs for it, getting a Z80 simulator/emulator for your PC. This program creates a virtual environment on the PC and a way to trace the simulated Z80 microprocessor's individual steps as it works its way thru your program. Oshonsoft makes a fabulous one for about $37 USD (depending on what the Euro is running at, uses PayPay). There is a free one called ZEMU which does an amazing job, but requires the user to become familiar with some odd trickery it uses. Its capable of running CP/M, simulating drives and so forth. However it can be set up to simulate the Space-Time Productions MCB quite handily, running both the monitor program and BASIC as well as allowing you a full 64K memory map (something not easily done on the MCB) as well as letting you monitor all the input and output ports as the program runs.
As soon as I get the I/O files and TTY/CRT settings saved to files, I will post them here so you can run your virtual MCB from home.
Being able to single-step your program and see where things are happening is an invaluable way to troubleshoot anything and correct problems.
Modifications and Upgrades
I did not originally have the Eprom Burner board associated with the Space-Time Productions MCB. Since this area of code was not useful to me, I modified the monitor so that the old code from $0400-$07FF was removed and replaced with the code I used to get J.Kerr's 1K disassembler to run on the board.
Since the original monitor used the "N" keyboard command plus a second letter to drive routines within the Eprom Burner code, I simply changed the vector for the "N" command to jump out to the disassembler code area.
With this version, the "N" command plus and address block entered as xxxx,yyyy will disassemble memory beginning with address xxxx and ending with the instruction closest to yyyy.
|
This was my first altered Monitor program. Download this version: MONITOR.ASM
To add useful functions and upgrade the existing functions, I've modified the Monitor Rom several times, generating a new "V" version number for it each time (after the bugs are out).
As of July 2006, I had reached version V9.0 which is presented here. This monitor requires offboard memory and several other items.
It contains the following upgrades:



You may download it here: Monitor 9.0 ASM

You are welcome to download and use this Monitor program, it requires a 4K 2732 Eprom in the socket for booting up.
>
BUT...
Your board must have the following hardware modifications in place in order to function correctly with this version of the Monitor program:
8279 / LCD Version Monitor Program January 2009
As of January 2009, I was able to complete a project I had started well over 2 years ago- to create a stand-alone monitor which used only the 8279 keypad for input and the 2x40 HD44780 LCD for display output. Each key behind the 8279 keypad is lit by the 8279's display control and software in the monitor is included for that function.
I use the term 'stand-alone' loosely as program loads must be done by sending either Intel Hex file format from Hyperterminal into Serial Port A of the SIO, or by sending NASCOM format file by same method.
What's the idea of the NASCOM file load? The NASCOM in some ways is a distant cousin to the Space-Time Productions computer. Although there's no video ram like there is on the NASCOM, some programs and routines were a curiosity to me and I wanted to be able to load and disassemble them. CP/M for the NASCOM is one example. (Also, there's some neat games as well, but I imagine that 'Space Invaders' for a 2x40 LCD display is probably not going to be very fun - ha).
Also, the DASM routine, which disassembles an area of code from xxxx to yyyy sends its data strictly back out the serial port for capture by Hyperterminal into a text file. I figured this was the most logical output for it.
The .ASM file of this allows the programmer to change the term BASE .EQU to the top page of available ram for your configuration, and everything else will organize itself correctly. This particular version uses only the onboard 2K of ram and thus uses $37 as the equate for BASE. ($3000-$37FF).
You can download this 8279 / LCD Version Monitor Release 1.1 right here.
I'm presenting it "as-is" because I'm not sure the Disassembler is working correctly for some strange reason. I'll post an updated release in the next couple of days, but for now here's some interesting code for you to browse.

Here's the 8279 keypad layout for command and data entry.
Commands:
NOTES:
I realize this is a rudimentary monitor, but as I used the text-based monitor for years now, I realized a lot of its functions were pretty useless.
Most major memory edits are done as part of program construction in a text-editor for assembly.
Input port function was not very handy unless it could monitor a port continually for switch inputs, etc.
The Disassembler is mainly needed to de-compile programs in the computer memory area and send them to a text file where they can be commented. The best way to accomplish this is to send the data out the serial port to a PC where Hyperterminal can be used to capture the incoming text.
Hex Math is kind of a throw-in, but occasionally I found myself needing to see what the relationship of two hex numbers was.
Both Load and Save check to see if the user is asking for .OBJ (Intel Hex file) or .NAS (NASCOM .NAS formatted file). The Load function is imperative, but I'm not so sure the SAVE is going to be of any use, so for right now, there's no code for saving anything.
The best part of this monitor is how 2 and 4 hexadecimal digits are entered by the user with the LCD. The routine GET2: and GET4: are used respectively to generate 2 or 4 lines "_ _ _ _" for the user to enter data or addresses. The cursor floats on each digit as it is entered and once the "Enter" key is hit, it collects the 4 hex digits from the LCD memory and converts that to a hex value in register H or HL. This took a lot of work to develop, and gotta brag - it's dang cool.
This monitor takes up nearly the entire 4K of boot rom (ROM1). At one time I wanted the MEM command and the EDIT command to coincide so you could just change memory on the fly while stepping up and down thru the 8 byte rows. This required a good bit more code and would have jumped the 4k shark, so I trimmed it back to a simple Edit command, much like the text based monitors have all had.
Also, the future for the CF memory card for program storage looks pretty bright as of January 2009. I'm thinking that at some point the monitor will have to be able to:
At that point in time, the Hyperterminal role will reverse quite a bit. The CF card will serve as mass storage, then it will be possible to boot CP/M and use Hyper as the console. Serial B can then be used to import CP/M files into the computer and then save them to CF card. The Space-Time boot rom can be reprogrammed to attempt to book CP/M, but use then jump over to the 8279 / LCD monitor if there is no console attached to my "HAL9000" computer.
More on this later...
If you have modified your own monitor rom, I would be very interested in seeing what you have done, so Email me! At any rate, Good Luck and Happy Hobbying!