Z80 Space-Time Productions Single Board Computer

Technical Support Information - Monitor ROM


If you purchased the 2K 2716 Monitor Rom when you bought this kit, you likely received the same instruction sheets that I did. 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 - Go from last breakpoint.
  • Gxxxx - Go at address xxxx.
  • 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 (swaps RST38 and data at breakpoint address.
  • 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 (Rom 2).
    • NO Error, Return to prompt.
    • NP Unknown function $047C.
    • NQ Error, Return to prompt.
    • NR Executes an additional RET instruction.
    • NS Unknown function $0485.
    • NT Unknown function $048E.
    • NU Unknown function $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.

Since there doesn't seem to be any schematics or boards available for the PROM Burner, in my versions of the monitor, I have removed the code from $0400-$07FF and used it to support a Disassemble command:

  • N xxxx,yyyy Disassemble from xxxx thru yyyy.


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.

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.

System Calls

$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

Download

Shortly after I figured out by guessing 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 Z80 sent across to HyperTerminal as it executed. I saved that into a 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 old code that was used to operate the attached EPROM burner pcb. Unfortunately, can't find this hardware anymore. 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

I modified this code to remove all the old prom burner code from $0400-$07FF, and to add in the disassembler as well as my LCD driver calls and some other source code as well that I needed routinely. This file included for your convenience. The "N" command in the original 2K rom accessed the prom burner PCB (that I could not get for this CPU, nor schematics). I hijacked this key to vector it to the disassembler command. The command works as Nxxxx,yyyy in which xxxx is the starting address to disassemble and yyyy is the address to disassemble through.
If your computer uses the original configuration, you should probably stick with this release.

Download this version: MONITOR.ASM

Note: I noticed during my first modifications to the monitor rom, that after the user program terminates in a RET, the original monitor appears to come back to the system prompt ">", but in fact it is completely resetting each time. I did not figure this out until I placed a "sign-on message" in the bootup sequence right after the hardware init routines. Every time my user program would terminate, the screen would clear off and give the Sign on message. I have tried to carefully examine the stack operations to see where this might be going awry without success. Much of the problem appears to center around the storage and retrieval of the registers when a "GO" command is initiated, or the user program is RETurned from. On one release, I tried to force the SP into position during the GO and RET sequence, and to place it when Editing the registers, however this caused conflicts and would crash the computer.

I fully intend to change this function so the register info is stored separate from the working stack on my next release.


Modifications and Upgrades

I have modified my Monitor Rom several times, from the original version V4 which I purchased, I am now up to V9.0 (July 2006).
The latest monitor has 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.

      Here is the most current version I have developed.
      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

      Technical Note:

      As I develop new monitor releases, I realize they are no longer compatible with the original "Kit Supplied" configuration, and may not be compatible with the modifications you may have installed on your own board. I must proceed with the hardware that I have installed on my board, and I sincerely hope you understand this. I am posting my latest release ("research") in hopes it will be something you can use.

      I have also posted an earlier, previous version which has the Disassembler command included, but works with the original hardware configuration. If your configuration does not follow mine, you probably should stick to that version.

      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!


      All information contained herein that is generated by J.Owens (c) 2004, 2005.
      Other information credited to its sources.
      This Site is not affiliated with Space-Time Productions, Mr. M.Simon, or Mr. Ron Weiss, however I extend a grateful Thanks to those parties.
      This site has a sole purpose to provide technical information, and is not intended to infringe any prior
      copyrights nor to derive funds that would otherwise be the property of Microsoft, Space-Time Productions
      or it affiliates, either past or present.
      May the Force be with you.