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:

  • A - Reset by jumping to $0000.
  • Bxx,yyyy - Change baud rate clock for PIT IC xx=channel, yyyy=divisor (use with caution).
  • Cxxxx,yyyy,zzzz - Compare memory from location xxxx thru yyyy with memory at zzzz.
  • Dxxxx,yyyy - Display memory from xxxx thru yyyy.
  • E [cr] or ['] - Edit main registers or ['] prime registers.
  • Fxxxx,yyyy,zz - Fill memory from xxxx thru yyyy with data zz.
  • G [xxxx],[yyyy]- Go to user program. GO takes 3 forms:
    • G followed by Enter caused the computer to GO from user's PC contents or last breakpoint.
    • Gxxxx Goes to the address xxxx.
    • Gxxxx,yyyy goes to the program located at xxxx, setting a Breakpoint at location yyyy.
    The Breakpoint, if used, will save the contents of memory location yyyy to $3FFF, writing $FF [RST 38h] in its place.
    It saves the address of the breakpoint to $3FFD (L) and $3FFE (H).
    A Kill Breakpoint command restores the contents. This is great for running a program up to a point then stopping to allow registers to be examined. You should make sure the location you enter for Breakpoint is the actual Z80 opcode and not a parameter byte for an opcode.
  • Hxxxx,yyyy - Get the hex sum and difference of xxxx and yyyy.
  • Ixx - Show the input data from port xx.
  • Jxxxx,yyyy - Justify memory from xxxx thru yyyy (This is a ram test).
  • K Kill or restore the last saved breakpoint.
    Takes address located in $3FFD (L) and $3FFE (H) and restores byte saved at $3FFF back to that address.
    Since it's a direct swap, it can be used to either Kill, or to restore a breakpoint at a particular location.
  • L - Load Intel Hex program file.
  • Mxxxx,yyyy,zzzz - Move memory from xxxx thru yyyy to location starting zzzz.
  • N - Combines with a second letter to form a command. Prom Burner-related applications.

    • NA Unknown function $0455.
    • NB Unknown function $053B.
    • NC Unknown function $06BD.
    • ND Error Return to prompt.
    • NE Unknown function $057D.
    • NF Unknown function $0477.
    • NG Unknown function $0536.
    • NH Error Return to prompt.
    • NI xxxx,yyyy inverts the data from xxxx thru yyyy.
    • NJ Unknown function $044C.
    • NK Error Return to prompt.
    • NL xxxx,yyyy appears to be an Intel Hex Load with an address offset to relocate program.
    • NM Unknown function $0566.
    • NN Jumps to $1000 (IC-22 Rom Socket).
    • NO Error Return to prompt.
    • NP Burn a 2716 (2K) from user addresses. $047C.
    • NQ Error Return to prompt.
    • NR Probably Quit to Monitor. Executes a RET instruction.
    • NS Burn a 2732 (4K) from user addresses. $0485.
    • NT Burn a 2764 (8K) from user addresses. $048E.
    • NU Burn Prom from user 2708, 2716, 2732 or 2764. User enters address block to burn from. $0497.
    • NV Unknown function $052D.

  • Oxx,yy - Output data yy to port number xx.
  • Pxxxx,ascii string data, terminating in [ctrl-c]. Place ASCII string text into memory starting at xxxx, terminating when user types [ctrl-c].
  • Q Display user stack (actual SP plus $18, never found a use for this).
  • R Display Registers.
  • Sxxxx - Substitute (modify) memory starting at xxxx, [space] continues, [cr] terminates.
  • Txxxx,yyyy - Type ascii text from location xxxx thru yyyy (caution - throws non-ascii chars to display, often causing tabs, cr, lf, control codes, other non-printable characters, etc to be sent to terminal. Looks very trashy if you are pointing to a non-text area in memory.

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 10HReceives a character into A over RS232 port A.
$0018 RST 18HChecks the status of the RS232 Port A, RX char ready=CY flag set, TX buffer empty=Z flag set.
$004C SPCTransmits a space out the RS232 Port A.
$0068 CPHLDEPerforms a compare of HL-DE, sets Z flag if equal.
$0072 MONNormal Entry point for monitor.
$0273 HLOUTConverts contents of HL to ASCII characters and outputs to TTYA.
$0294 PRINTLoads byte at (HL) into counter, prints character string from (HL+1) until counter is decremented to zero.
$029B TXCRLFTransmits a "New Line", CR ($0D) and LF ($0A) characters.
$029E BCOUTTransmits ASCII chars contained in B and C registers.
$02BC GETXYZGets 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 GETXGets 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 BCTOAConverts the ASCII hex characters in BC into an actual byte value in A
$0326 ATOBCConverts 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:

  • Write the assembly language program in a text editor.
  • Assemble the program into an Intel Hex format file.
  • Load the file serially using the monitor's Load command and send the Intel Hex file by way of Hyperterminal.
  • Tell the monitor to Go to the program's location.

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.

  • N xxxx,yyyy Disassemble from xxxx thru 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:

  • Sets the RS232 Serial Channel A (console) to 38,400 baud.
  • Sets the Serial Channel B (MIDI Interface) to 31,250 baud.
  • Includes the ANSI color code commands, runs white text against a green background.
  • Initializes all 3 of the 8255 PIO's.
  • Initializes the 8279 Keyboard/Display IC.
  • Provides service calls to read/write the 8279 Keyboard/Display.
  • Initializes the HD44780 2x40 LCD backlit display.
  • Contains LCD service subroutines for both status and data.
  • Contains the John Kerr disassembler, accessible by typing "N" in the monitor.
  • Initializes with IM 1 so that all INT- signals vector to RST 38H.
  • Sets up the Restarts as follows:
    • RST 00H - Reset
    • RST 08H - TXA [Transmit a character out Serial Port A].
    • RST 10H - RXA [Receive a character from Serial Port A].
    • RST 18H - TXB [Transmit a character out Serial Port B - MIDI].
    • RST 20H - RXB [Receive a character from Serial Port B- MIDI].
    • RST 28H - TX8279 [Write a character to the 8279 Display].
    • RST 30H - RX8279 [Receive a character from the 8279 Keyboard].
    • RST 38H - INT [Pushes all registers on stack, return to prompt].
  • Tests the character entered to see if it's ":" and jumps to the LOAD command.
    [ You no longer have to first enter "L" to start a Load, just tell Hyperterminal to start sending the Intel Hex File ]
  • Capitalizes any command character A-U so you don't have to run the Monitor with Caps Lock "ON" in Hyperterminal [AND $5F].
  • Adds a "U" command to the Monitor to Unload the system memory. Zero's out $3000-$3FFF and $4010-$FFFF
  • Has improved outputs for the commands:
    • Display Memory (D) - Page header and ASCII for printable characters.
    • Type Memory (T) - Breaks down into 16-byte lines with address info at left.
    • Display Registers (R) - Reformats the User Register values for better viewing.

    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:

    • 8253 PIT counters 0 and 1 driven by a 1.8432 MHz Xtal oscillator for generation of 38,400 and 4800 Baud for SIO Channel A.
    • 8253 PIT counter 2 should be driven by 2.00 MHz off the main clock for generation of 31,250 Baud for SIO Channel B.
    • HD44780 LCD display interface connected at ports $7C and $7D.
      [ If no LCD, hardware should be provided that causes any read of port $7C to return a logic 0 in D7. ]
    • See HARDWARE page for details!!!
    • High Ram, as it locates the stack at $FFD0


    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:

    • MEM - Lists the contents of ram both in hex and ASCII.
    • EDIT - Allows byte-at-a-time change to ram contents.
    • INPUT - Inputs from an I/O Port, decodes input data as both Hex and Binary. This command loops until the 8279 receives a key-down.
    • OUTPUT - User selects port, then data to write to it.
    • CLEAR - Utility to set Ports $60,$61,$64,$65 to 00 and writes $00 to all user ram positions from $3000-$377F
    • LOAD - Load a file in Intel Hex format or NASCOM '.NAS' format.
    • RUN - Gets address from user and performs JP to this address.
    • SAVE - Future expansion for save memory as Intel Hex or .NAS format.
    • DASM - Disassembles memory between two addresses, sends the info out Serial Port A (for PC with Hyperterminal for text capture to file).
    • HEX - Allow user to enter two 16-bit numbers, performs AND, OR, ADD, SUB and XOR to the LCD display.

    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:

    • Load Intel Hex from Serial
    • Load NASCOM .NAS from Serial
    • Load binary from CF card.
    • Save Intel Hex to Serial
    • Save NASCOM .NAS to Serial
    • Save binary to CF card.

    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!