(c) Arcom Control Systems Ltd. 1987
Manual | Software | Comments |
---|---|---|
v1 iss 4 | v1 iss 4 | 1987-01-21 first published in this format |
2019-02-05 Edited into HTML format |
The EAMONB Monitor has extensive features for debugging Z80 machine code programs on the SCPUB, Commands are available to download Intel hex files (programs or data) from other computers, obtain a print-out of a debugging session, single step through a program, set breakpoints, and examine and modify registers and memory contents.
The monitor also includes software to drive an Arcom SEP EPROM programmer. This board allows the monitor to copy from an external EPROM into RAM or program an EPROM with a program or data held in memory.
The monitor is supplied in an 8k EPROM, which should be plugged into socket IC22 on the SCPUB board. Section 2 contains detailed instructions on how to set up and connect to the SCPUB.
Channel A of the SCPUB should be connected to a video display terminal (VDT or VDU). Channel B should be connected to a serial port of a computer for downloading a program or to a printer for hard copies. The SCPUB should be set up with standard jumpering as detailed in Section 4 of the SCPUB manual. The monitor EPROM should be inserted into IC22 with the notched end towards the middle of the SCPUB.
The terminal is connected via PL3, which is on the bottom left of the board (as seen from the component side with the 64-way bus connector on the right). Pin 1 is marked and the connector is numbered as for a 20-way ribbon cable. signals come out from the SCPUB on pin 1, and are received by the SCPUB on pin 2. Pin 5 is the ground. There is no handshaking on the terminal input or output. The data format is 8-bit ASCII with the most significant bit masked, no parity and two stop bits. Communication should be full-duplex, character mode. Any standard RS232 VDU or video display terminal should be able to cope with this.
Channel B of the DART is intended for connecting to a printer. This channel is initialised to run at 1200 baud, 8-bit data, two stop bits and no parity. The auto-enable mode of the DART is switched on. This mode causes the CTS (clear to send) input to act as an enable for the transmitter and the DCD (data carrier detect) input to act as an enable for the receiver.
Most printers use a handshake line to stop the computer sending out characters too fast. For these printers it is necessary to connect the output from the DART (PL3 pin 10) to the input of the printer (usually pin 3 on the 25-way Dtype connector, but check your printer manual), and CTS (PL3 pin 7) to the handshake output of the printer (often RTS, pin 4 on the 25-way D-type, but this does change from manufacturer to manufacturer, so check the manual). If you want to run the printer at some baud rate other than 1200 the device 1 initialisation routine must be called with the corresponding value in register A. See Section 6 for details.
To connect Channel B to a computer when downloading programs it is necessary to make the SCPUB appear as a serial console device to the host computer. Note that the SCPUB requires handshaking to send data but does not send a handshaking signal to a host. Data carrier detect must be held active by connecting pin 14 of PL3 to ground.
The monitor uses RAM in the top 256 bytes of memory. Hence there must be a RAM chip in socket 1C21. This RAM chip can be a 2 Kbyte device (e.g. a 6116, 4016 etc.) or an 8 Kbyte device (e.g. a 6264). Links LKOB and LK5A must be configured correctly for the type of RAM that you are using (see Section 4 of the SCPUB manual for details of these links). A second RAM chip of the same size can be inserted in socket IC20 if desired. Hence the legal RAM configurations are 2K (one 2K chip), 4K (two 2K chips), 8K (one 8K chip) and 16K (two 8K chips). The SCPUB is supplied fitted with 4K of RAM.
The EAMONB monitor is entered after the computer is reset (the computer will be reset on power-up). The normal action is first to determine the baud rate of the user's terminal (though see Section 6 for information on changing this action). The computer will print at 9600 baud the message:
Press RETURN
If your terminal is not set to 9600 baud, you will not see this message. In any case you should now press the return key and the computer will determine the baud rate at which your terminal is running.
The prompt gives the lowest page of on-board RAM and a ‘>’. Commands are one or two letters long followed by any arguments. The available commands are given in Section 3. A help command is available.
The user program counter and stack pointer are initialised to F000H and to FF00H respectively. When using breakpoints or single stepping the user stack pointer must point to a valid area of RAM in memory to ensure correct operation.
One page of the EPROM (0F00H to 0FFFH) is used for mode 2 interrupt vectors. The first eight bytes are used by the CTC but the rest is available for the user.
Some features of the monitor are not compatible with some types of program. The single stepping feature uses the CTC Timer 2 to count the number of instructions executed to generate a maskable interrupt, and runs the user program in interrupt mode 2. Thus any part of a program that needs to run in any mode other than mode 2 or that disables interrupts cannot be single stepped. Single stepping also sets the interrupt vector of the CTC circuit on the board. When single stepping a program which uses Timer 2 of the CTC to generate interrupts the address of the interrupt handler must be programmed into the monitor EPROM at location OF06H. When using single stepping any interrupt vectors must be patched into this page of memory because the monitor sets the interrupt vector.
The monitor patches in RST 30 op-codes to implement breakpoints. The user is free to use the other restart vectors.
The top page of memory, FF00H to FFFFH, is used as workspace by the monitor.
All commands are one or two letters long, possibly followed by a list of parameters. All numeric parameters must be in hexadecimal, except a few commands which accept ASCII characters. Hexadecimal numbers do not need to b preceded or followed by any symbol. Spaces are ignored except where ASCII characters are expected.
A list of available commands is given here with details of their syntax. Quantities within angled brackets are parameters and must be replaced by the required values.
NOTE: The angled brackets must be omitted when typing in a command. Use comma as indicated in the command syntax. All parameters must be separated from each other by a comma.
Commands operating on blocks of memory will give an error if the end of the block is lower than the start.
When writing to memory most commands check that the data was written correct. If not an error message such as;
B F203
will appear to indicate that location 0F2D3H is not functioning RAM. All commands abort after this error.
NOTE: you must be careful when writing to memory that cannot be read; to write to memory command does a read after each write, so you may either get an error message, as in the example above, or the system may 'hang', if no DATACK* is received on the read.
Error messages are detailed in Section 8.
The parameters represented are as follows: <start>, <end>, <address> = Addresses. A hex number is required. Only the least significant 16 bits are used if the number is over FFFFH.
<byte> = A hex number is required. Only the least significant 8 bits are used if the number over FFH.
<char> = A single character whose value is interpreted as its ASCII value.
Control-C aborts any command. The monitor only senses aborts when printing to
the console. Control-H is the rubout key, erasing the last character typed. Control-s will halt any output until Control-Q is pressed. Control-P alternately switches the printer output on and off.
AD <start>, <end>
ASCII dump. Displays all printable characters stored in memory between the given limits. Line feed and Carriage Return are printed, all other control characters are ignored.
See also dump command.
AL <start>
ASCII load. Displays the start address and then accepts text from the keyboard which is loaded into memory from the start to higher addresses, Control-H and rubout do not work on the text. The text is terminated by Control-C. This allows carriage returns to be included.
See also load command.
AS <start>, <end>, <char1>, <char2>
ASCII search. Searches for one or two consecutive bytes (char2 is optional) matching the ASCII codes of the characters supplied between the limits given. All memory locations which match are displayed on the terminal. Do not put a comma or space between the two ASCII characters.
See also search command.
There are eight breakpoints available for use with programs loaded in RAM memory, numbered 1 to 8. When a user program is run all breakpoints that have been set are activated by loading a Z80 RST 30 instruction opcode (F7) into the breakpoint locations. When returning to the monitor the values in those locations are restored.
When a breakpoint is reached in the user's program, all the Z80 registers are saved and displayed and control returns to the monitor. The breakpoint is not cleared when encountered.
Each breakpoint may be set and cleared separately, and all active breakpoints can be listed with their locations. All breakpoints are initially cleared.
A breakpoint must be set at the address of the first byte of the instruction before which the program is to stop.
Break points only work on programs in RAM memory. Do not set two breakpoints to the same location.
The <digit> parameter is the breakpoint number.
BC <digit>
Clears a breakpoint.
BL
Lists all breakpoints currently active.
BS <digit>, <address>
Sets a breakpoint at the address given.
C <address>
Restores the user's registers and jumps to the user's program at the giver address. A return address to the monitor is pushed on the user's stack. Al active breakpoints are loaded.
Control returns to the monitor by a RET instruction or a breakpoint.
See also go command.
D <start>, <end>
Displays the hex and ASCII representations of the memory contents between the two addresses given. An error is reported if the end address is smaller than the start address.
See also ASCII dump command.
E <first>, <second>
Prints out the sum of the two numbers and the result of subtracting the second number from the first.
The two parameters should be hexadecimal numbers.
F <start>, <end>, <byte>
Fills the area of memory with the given byte.
See also zero command.
All active break points are patched in to the user's program. The registers, as displayed by the examine ( X ) command, are restored and the first instruction is taken from the location addressed by the user's program counter.
Control can return to the monitor by means of a breakpoint or RST 30 instruction.
See also call command.
H <letter>
Prints out the full name and details of the syntax of the command. The letter following the 'H' should be the first letter of the command. If no letter is given details on all commands is given. Control-s can be used to stop the information scrolling off the screen, Control-Q restarts.
I <address>
Print the value read from the port at the I/O address given. A 12-bit I/O address may be given.
See also output to port command.
J <start>, <end>
Checks that a block of memory is properly working RAM. If a bad location is found its address and a bitmap with ‘1’s for a bad bit and ‘0’s for a good bit is printed. The contents of the memory are preserved.
L <address>
Allows the user to load data into memory. The user is prompted with an address Carriage Return moves onto the next address without altering the current address, a hex number or an ASCII character preceded by a single quote loads that value into the location displayed, and moves onto the next location.
The monitor checks that the data has loaded properly.
See also ASCII load command.
M <start1>, <end1>, <start2>
Copies a block of memory to another area. The block is copied lowest byte first.
Enter EPROM programming software. The EPROM software is menu driven and is dealt with in the section on programming EPROMs. Do not type this command without an Arcom SEP board in your system.
O <address>, <byte>
Send the byte sized data to the port at the given I/O location.
See also input from port command.
P <text>
Used for downloading programs from another system. The program must be assembled and link edited into a Intel hex code format.
The monitor will wait for a hex file to be downloaded through the input of the printer port (channel B). Control will only return to the user when a zero count record is read. The monitor loads each record straight into memory but will report any checksum error encountered.
Q
Performs a reset and monitor cold start.
R <start>, <end>, <orig>, <new>
Replace all instances of the hex byte <orig> by the hex byte <news in the block from <start> to <end>. Checks that the new byte has been written successfully.
s <start>, <end>, <byte1>, <byte2>
Search the given block of memory for all instances of a byte or two consecutive bytes. <byte2> is optional, but if present implies a two byte search. Both bytes must be given in the form of hex numbers. The output is a list of all addresses at which the search was successful.
See also ASCII search command.
single step through user's program. The registers as displayed by the examine command ( X ) are loaded into the processor and one instruction is executed before control is returned to the monitor. The state of the program can be examined at every step.
This feature uses counter 2 of the CTC and the maskable interrupt of the processor and puts the Z80 into interrupt mode 2 so it may not be compatible with some user's programs using interrupts.
single stepping will work on programs in RAM or EPROM.
V <start1>, <endl>, <start2>
Compare two blocks of memory listing all locations where the value held does not equal the value held in the corresponding location in the other block o memory. The format of this list is;
XXXX AA YYYY BB
showing that address XXXX in the first block contains AA but the corresponding address YYYY in the second block holds BB.
W <reg>, <value>
Loads a value into a 780 register. Apart from the accumulator and flag registers, all registers are treated as 16-bit registers, and the whole register must be written to at once. The value must be a hex number. The flag registers must be written to with a hex number. The allowed register names are
A F BC DE HL IX IY A' F' BC' DE' HL’ SP PC
where the the ' symbol indicates the Z80 alternate register set.
See also examine command.
Examines the values held in the Z80 registers of the user's program. On returning control from the user's program to the monitor, by a breakpoint, single step or other means, the values in the registers are saved. These values are reloaded into the registers on returning to the program.
All general purpose registers are displayed, including the alternate set. The first five characters on the top line represents the flag register. A letter displayed indicates that a flag is set. The alternative flag set is displayed below.
The values saved can be modified before returning to the user's program by using the write command, making debugging easier.
Z <start>, <end>
Loads the given block of memory with zeros and checks that the load is successful.
See also fill command.
Consider loading the following program into memory and single stepping through the program.
F000 3C PROG: INC A F001 C3 F000 JP PROG
A typical session may be as follows. Comments are given on the right hand side of the page. The user's input is in bold type.
Press RETURN SCPUB Serial Console running at 9600 baud FO>L F000 F000 U 55 3C ; 'FO> is the prompt ; Command is to load data into memory ; starting at F000 (hex) ; F000 is the location ; 55H is the value already there ; U is ASCII char 55H ; Put 3C (hex) into location F000 F001 . AA C3 ; the JP opcode F002 U 55 00 ; Least significant byte first F003 . AA F0 F004 U 55 Control-C ; Control-C ends load F0>X ; Examine registers SZPNC ABB B=AA5F D=BED7 H=BB55 X=BB57 Y=BA57 -ZPNC AAF B'AA77 D'AA55 H'AE57 S=FF00 P=F000 ; Registers hold random values except ; stack pointer and program counter. ; lower line shows the alternate set ; of registers. ; S,Z,P,N,C flags are all set ; Accumulator holds BB (hex) ; HL pair holds BB55 (hex) FO>T ; Execute one instruction from ; location F000 and display ; registers S-P-- ABC B=AA5F D=BED7 H=BB55 X=BB57 Y=BA57 -ZPNC AAF B'AA77 D'AA55 H'AE57 S=FF00 P=F001 ; Accumulator has changed and ; program counter points to next ; instruction
When using the Monitor for debugging, the program can be held in RAM or in EPROM in ic23 on the SCPUB. When the program is debugged it needs to be transferred to the target environment.
Machine-code programs that are to be used from BASIC can be converted into a series of BASIC DATA statements.
After debugging, a program that is to run stand-alone on the SCPUB will have to be relocated so that it can run starting at location 0000h in an EPROM in IC22. Relocation normally involves re-assembling the program with a different origin or adjusting all the absolute jump instructions for the new runtime address,
Stand-alone programs that are to use the standard serial lines for a console and printer must include routines to drive these ports. A listing of the routines used by the monitor are given at the end of this manual. These routines are described in Section 6. The channels must be initialised before being used.
This software is capable of programming EPROM types 2716 (single 5V rail) 2732, 2764, 27128 and 27256 at a range of voltages using the normal programming algorithm or the fast algorithm recommended by some manufacturers. Do not try to run this software unless you have an Arcom SEP EPROM programmer boar plugged into your system backplane.
The following operations can be performed.
Program an EPROM from a block of memory Read an EPROM into a block of RAM Check that an EPROM is erased Copy data from one EPROM to another, from any size to any other size
It is also possible to patch an EPROM by reading it into memory, returning to the monitor to alter memory locations and programming another EPROM with the modified data, or the same EPROM after erasing it.
The programmer is menu driven: at each stage the EPROM programmer will give you a list of options or tell you what information it requires next. If you are given a list of options each option is followed on the same line by a number Typing a number indicates your choice.
The EPROM programming socket is a Zero Insertion Force (ZIF) socket, either on the SEP board itself, or on a daughter board connected to the SEP board with ribbon cable. There is a lever on the top of the socket. Before inserting a EPROM ensure that the lever is operated so that the socket is open. Place the EPROM in the socket, with the notch at the end of the EPROM at the top and hold it there while you push the lever to your right until the lever has move through 90 degrees. The EPROM should now be held firmly, flush against th socket.
If you are in any doubt about how to use the SEP board you should consult th SEP manual, supplied with the board.
EPROMS come in different sizes depending on the memory capacity. If your EPRO has less pins than the ZIF socket can accommodate the EPROM should be placed in the lower holes as far away from the lever as possible.
Before a program, read, or check command is given, an EPROM must be in the ZIF socket. When the programmer is not performing one of these operations EPROM may be plugged in and out. The LED near the ZIF socket is illuminated when the EPROM should not be removed.
The software includes several options for speeding up duplication of EPROM After a program operation the software stores the memory and EPROM addresses used and if any further programming is done the program will ask whether the same data is to be used again.
Manufacturers' data sheets give the voltage at which an EPROM should I programmed and whether the fast algorithm may be used or not.
To run the EPROM programmer type the command:
N
The software will first require you to choose which type of EPROM you wish to use. This may be re-selected at any time from the main menu.
When programming an EPROM the programmer will prompt you for the memory start and end addresses of your data and the start address at which you wish your data to be blown into the EPROM. For example:
Memory start address : E000 Memory end address : EFFF EPROM start address : 0
The addresses must be given in hexadecimal without a trailing 'H'. After programming an EPROM the software will report an error if any locations have not programmed correctly.
When reading an EPROM you will be prompted for the start and end addresses of the part of the EPROM you wish to read, followed by the start address of the area in RAM that you wish to load it into.
The start of the EPROM is organised as follows:
address | ||
---|---|---|
(dec) | (hex) | |
0 | 0000 | Contains a jump to the initialisation code which then jumps to the monitor. The area from 40H to 5FH (64 to 95 decimal) is reserved for data used by the monitor. The locations that are used are |
64 | 0040 | This byte specifies the default baud rate for the console, which is the baud rate that will be used if the auto-baud is disabled. The allowed values are:
1 = 50 baud 2 = 75 baud 3 = 110 baud 4 = 134.5 baud 5 = 150 baud 6 = 300 baud 7 = 600 baud 8 = 1200 baud 9 = 1800 baud 10 = 2400 baud 11 = 3600 baud 12 = 4800 baud 13 = 7200 baud 14 = 9600 baud |
65 | 0041 | This byte specifies whether auto-baud feature is to be enabled Set O to disable (so the baud rate is fixed at the value specified by location 40H), set FFH (default) to enable. |
95 | 005F | This byte sets the baud rate of DART channel B (used for the printer). The allowed values are as for the console port described above.
The low level character I/O routines are accessed through jump tables in the EPROM. The jump tables start at location 80H (12 decimal). The structure of the jump table is as follows: |
128 |
0080 |
JPCITO: JP CITO ; initialise |
131 |
0083 |
JPCISO: JP CISO ; input status |
134 |
0086 |
JPCIO: JP CIO ; input a character |
137 |
0089 |
JPCOSO: JP COSO ; output status |
140 |
008C |
JPCOO: JP COO ; output a character The jumps for the character I/O routines point at additional jump tables, allowing the possibility of more I/O channels being supported at a later date. These jump tables look like: CITO: JP CINI0 ; initialise device 0 JP CINI1 ; initialise device 1 CISO: JP CIST0 ; input status of device 0 JP CIST1 ; input status of device 1 CIO: JP CINO ; input from device 0 JP CIN1 ; input from device 1 COSO: JP COSTO ; output status of device 0 JP COST1 ; output status of device 1 COO: JP COUTO ; output to device 0 JP COUTI ; output to device 1 Any future changes to the software will not change the structure of the jump tables, so that by indexing via the addresses in the jump table starting at location 8OH, user programs will not need modification as the software changes. This jump table structure is also used by BASIC for the SCPUB and by the bootstrap EPROM for the SCPUA so that the same software can be used in these different environments. |
CIN0, CIN1 : the jump table starting address is stored at 81H.
Initialise a character device. This is called with A = baud rate. The allowed values for baud rate are from 1 to 14 as defined above. No register other than A is changed.
CIST0, CIST1 : the jump table starting address is stored at 84H.
Input status of a character device. This returns A = 0 and flag Z set if no character is available, or A = FFH and flag Z reset if a character is available. No other register is changed.
CIN0, CIN1 : the jump table starting address is stored at 87H.
Input a character. This returns in A the next available character from this device. The character is an 8-bit value, except for device 0, for which the character is assumed to be ASCII and the top bit is forced to zero. No register other than A is changed.
COST0, COST1 : the jump table starting address is stored at 8AH.
Output status of a character device. This returns A = 0 if the transmitter is still busy, or A = FFH if the transmitter is ready to accept another character. No other register is changed.
COUT0, COUT1 : the jump table starting address is stored at 8DH.
Output a character. This outputs the 8-bit value in A. No register is changed.
Do not type angled brackets. Include commas.
AD <start>, <end> Display ASCII characters AL <start> Load ASCII characters into memory AS <start>,<end>, <char><char> Search for one or two consecutive characters BC<digit> Clear a breakpoint (1 to 8) BL List all active breakpoints BS<digit>, <address> Set a breakpoint to an address C<address> Restore registers and call user's program D<start, <end> Display contents of memory in HEX and ASCII E<first>, <second> Print (first+second) and (first-second) F<start>,<end>,<byte> Fill an area of memory with byte Restore registers and jump to user's program H<command> Give syntax and description of command I<port> Read an I/O port and display value J<start>,<end> Test RAM. Print address of any bad memory L<start> Load memory with HEX or ASCII values M<start1>,<start2>,<size> Copy a block of memory N Enter EPROM software O<port>,<byte> Send a byte to an I/O port P<text> Send text to host then read Intel hex file Q Cold restart R<start>, <end>,<old>, <new> Replace old byte by new in block of memory S<start>,<end, bytes, byte> Search for one or two consecutive bytes T Single step through user's program V<start1>,<start2>,<size> Compare two blocks of memory W<reg>,<value> Load user's register with value. X Display user's registers Z<start>,<end> Load zero into area of memory ^C Quit command ^S Stop printing ^Q Resume printing ^P Toggle printer output ^H Delete character
0008 CTC0 EQU 8 0009 CTC1 EQU CTC0+1 000A CTC2 EQU CTC0+2 000B CTC3 EQU CTC0+3 0004 DRTAD EQU 4 0005 DRTBD EQU DRTAD+1 0006 DRTAC EQU DRTAD+2 0007 DRTBC EQU DRTAD+3 00001 ASEG ORG 0000H ; initialise CTC and DART for serial I/O ; on channel A at 9600 baud 0000 31 FF00 INIT: LD SP ,0FF00H 0003 3E 47 LD A,47H 0005 D3 08 OUT (CTC0), A 0007 3E 0D LD A, 13 ; 9600 baud 0009 03 08 OUT (CTC0), A 000B 06 0C LD B, DRTLEN ; initialise DART 0000 0E 06 LD C,DRTAC 000F 21 001C LD HL, DRTTAB 0012 ED B3 OTIR ; now execute user program 0014 CD 0030 LOOP: CALL CONIN ; This program 0017 CD 0038 CALL CONOUT ; reflects input 001A 18 F8 JR LOOP ; Data to initialise DART 001C 0001 DRTTAB: DEFW 00001H ; R1 Disable everything 001E C003 DEFW 0С00ЗН ; R2 Rx 8 bits/char 0020 C103 DEFW 0C103H ; R3 Enable Rx 0022 4004 DEFW 04C04H ; R4 x16 clock, 2 stop bits, ; no parity 0024 6005 DEFW 06005H ; R5 TX 8 bits/char 0026 6805 DEFW 06805H ; R5 Enable Tx 000C DRTLEN EQU $-DRTTAB ; Length of table