ESA Microprocessor Monitor Commands
ESA Microprocessor Monitor Commands
4.1
GENERAL OPERATION
Installation and Configuration of ESA 86/88-3 is described in Chapter 2. It is essential that the trainer should be configured properly for working with it smoothly. Getting a proper sign-on message upon RESET as explained in the previous chapter is the minimum requirement for working with ESA 86/88-3 Reset Status: On Power ON/Reset, all information about the previous user program is lost and the registers may acquire new data. However the contents of user RAM are not disturbed if onboard RESET is used. If the RAM is backed up with battery, then the user RAM data is not lost even if power is switched OFF. Resetting the trainer initializes the segment & status registers of the CPU as described below. Table 4.1 Register Initialization Register CS (Code Segment) DS (Data Segment) ES (Extra Segment) SS (Stack Segment) IP (Instruction Pointer) FL (Flags) SP (Stack Pointer) Value (HEX) 0 0 0 0 0 0 100
Further, interrupt vectors 1, 2 and 3 are initialized as follows: Interrupt 1: Single Step Interrupt -This interrupt is used by the monitor with the step command. Interrupt 2: NMI (Non-maskable Interrupt)- This interrupt is implemented by BREAK key and the vectoring information is completely user defined. . Interrupt 3: Breakpoint Interrupt-This interrupt is used with GO command and its use is at the users discretion. A detailed discussion of the 8086/8088-interrupt vectors can be found in the Intels 8086 Family Users Manual (Chapter 2, Processor Control and Monitoring, Interrupts PP 2.22-2.28).
30
Whenever the monitor is re-entered as a result of a single step or Breakpoint Interrupt, the monitor saves the contents of the 8086/8088 registers on the User Stack and subsequently restores the register contents from the stack before it prompts for command entry. Since the SP register is initialized to 0100H, and memory locations 0H-CFH are reserved for monitor, the stack length reserved for the user is 48 bytes (i.e. locations D0H - FFH). Of these, 26 bytes must be left for register contents, should one of the above interrupts occur (leaving 22 bytes for the user). In addition locations 100H to 1FFFH are used for other system functions and system tables. Hence the user RAM starts from 0:2000H
4.2
When the monitor is ready to accept a command from the user it outputs a period ('.') as the command prompt character at the beginning of a new line. The commands entered by the user consist of one or two-character command mnemonic followed by a list of command parameters. This list may be up to three parameters long depending on the command being used. When more than one parameter is required, a single comma (',') is used between the parameters as a separator. A command is terminated either by a carriage return or by Escape depending on the command itself. Commands are executed one at a time and only one command is allowed in a command line.
31
For example, suppose we wish to specify an address whose segment is (ES) + 10H and whose offset is (BX) - 30H. One way is to calculate these values as shown below. Assume (ES) = 0270H and (BX) = 0080H Segment value = (ES) + 10H = 0280H Offset value = (BX) - 30H = 0050H Then the address can be specified as 0280:0050 However, ESA 86/88-3 supports direct specification of such an address value as shown below: ES + 10:BX - 30 The system will automatically evaluate such expressions and use the correct values. These operators can be used to considerably simplify the specification and checking of relative addresses also.
4.3
The Monitor commands in both serial and stand-alone mode are similar and the following discussion holds good for trainer operation in either mode. These commands are summarized in the following table and are described in detail in later sections. In both the table and individual command descriptions, the following notation is used. [V] [V]* <V> ,/indicates that `V' is optional indicates one or more optional occurrences of "V" indicates that V is a parameter to be entered by the user. indicates that either of the two characters is to be entered.
NOTE: These symbols are used to clarify the command formats and they are neither to be entered by the user nor output by the system. In the description of the individual commands, it is assumed that 8086 CPU has been installed. However, all the commands work in identical fashion even if 8088 CPU is installed. The only observable difference would be in the sign-on message generated by the system following Power ON/Reset.
32
FUNCTION
Substitute Memory bytes: Displays / modifies memory bytes Substitute Memory Words: Displays / modifies memory words. Display Memory bytes: Displays block of memory in byte format Display Memory Words: Displays block of memory in word format Examine / modify Registers: Displays modifies 8086/8088 CPU registers Move Memory: Copies a block of memory from one location to the other. Fill Memory (Bytes): Fills a block of Memory with constant byte data Fill Memory (Words): Fills a block of Memory with constant Word data Input byte: Accepts and displays the data byte at the input port Input Word: Accepts and displays the data word at the input port Output byte: Outputs a data byte to the output port Output Word: Outputs a data word to the output port Compare Memory: Compares a block of memory with another block Go (Execute): Transfers the processor control from the monitor to the user program address with optional breakpoint. Single Step: Executes single instruction of the user program Help Command: Lists Monitor commands with their valid syntax.
FORMAT / SYNTAX
S [<address>] <CR> [,/[<new data>] ,] * <CR> SW[<address>]<CR> [,/[<new data>] ,] * <CR> D <start address> [,<end address>]<CR>
DW
M <start address> , <end address>,<destination address> <CR> F<start address>,<end address>,<byte value><CR> F<start address>,<end address>,<byte value><CR> I <port address> <CR>[,] * <CR>
FW
IW
OW
C<start address1>,<end address1>,<start address2><CR> G <CR> [<start address> [,<breakpoint address>]] <CR>
33
P*
A**
LL**
LC**
Z**
Invoke Programmer Software: Invokes the software for ESA EPROM Programmer Interface Enter Assembler: Invokes ESA 86/88-3 Symbolic One-line Assembler List Labels: Lists all labels defined in the Symbol table Label Clear: Clears all previously defined labels from the Symbol Table Disassembly Command: Disassemble Hex Code into 8086 mnemonics for a specific memory range
P<CR>
A [address]<CR>
LL<CR>
LC<CR>
* Refer Chapter 7 for a detailed discussion of this command ** Refer Chapter 8 for a detailed discussion of these commands.
4.4
1. In Serial Mode: During Serial operation, the output to the console can be stopped using the following method. This is applicable in cases of commands wherein the monitor continuously outputs data to the terminal viz. Display memory, Disassembly and compare memory commands. Control-C, entered at any time, immediately terminates the command and the monitor returns to the command entry mode. Entering Control-S stops the output to the terminal but does not terminate the command. Entering Control-Q now resumes the output from the point at which it has been stopped. Entering Control-C now terminates the command. Note that Control-S should be followed only with Control-Q or Control-C. No other console input is allowed following a Control-S. 2. In Stand-alone Mode: When working in stand-alone mode, the LCD is refreshed when the display on row 4 is completed. The next display occurs on Row 1 of the LCD. In case of commands where large display is involved, such as Display Memory, the LCD displays a total of 16 bytes or 8 words at one time and waits for the user to enter <CR> to proceed with subsequent displays. Also there is an additional <CR> required in stand-alone mode for the monitor to return to Command entry prompt. However such commands can be terminated at any stage by entering <Esc>.
4.5
COMMANDS DESCRIPTION
This section describes the commands supported by ESA 86/88-3 monitor. The discussion holds good for either mode of trainer operation unless otherwise mentioned.
34
35
.S DS:2101 <CR> 0000:2101 B7- <CR> . Note: Here DS is set at 0000. Hence the segment value displayed will be 0000. 2. Examine ROM location FF00:9CH and trying to modify the same. .S FF00:9C<CR> FF00:009C FF- 44,?<CR> . 3. Examine word at location 2120 H relative to DS register. Assume that DS is set to 2000 .SW DS:2120 <CR> 2000:2120 A1F4 <CR> . Note: Here the location DS:2121H contains A1H while DS:2120 contains F4H
36
The monitor will now output, beginning on the next line, the starting offset address, the data contents of that location and the contents of the consecutive memory locations up to the end address, if an end address is specified. The line format is arranged such that any subsequent lines (if present) will begin with an offset address whose last nibble is zero. A line consists of a maximum number of 16 bytes or 8 words. In case of stand-alone operation the same amount of data as contained in one line is displayed on the LCD making use of all the 4 lines available. In serial mode, the ASCII equivalents of the memory locations are also displayed at the end of a line of display. ASCII equivalents that cannot be displayed are represented by a ".". The display memory commands can be cancelled, or the output can be stopped and resumed at any time by entering appropriate control parameters described in Section 4.4 ERROR CONDITIONS 1. Specifying an end address that is lesser than the offset value of the start address. EXAMPLES 1. Display contents of location 140H relative to DS register. Assume DS is set to 0000. .D DS:140 <CR> 0000:0140 A0 . 2. Display contents of locations 1000:10CH through 1000:125H. .D 1000:10C,125 <CR> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 1000:010C 1000:0110 1000:0120 F0 00 00 9C EA BD 04 BA 00 F2 10 21 A4 35 14 17 FA F0 F1 F5 30 31 32 32 34 35 . In addition to the above, the ASCII characters equivalent to the data bytes are also displayed on the right hand side of each line of output only in Serial Mode of operation. The non-existent ASCII equivalent data are represented by a .. In the stand-alone mode the output for the above command will be in the format described below. .D1000:10C,125 <CR> 1000:010C F0 00 00 9C The monitor now waits for the user to enter <CR> to refresh the display and output subsequent data bytes.
37
BA 00 F2 35 14 17 F5 32 34 35
3. Display word at location 10C H relative to DS register. Assume DS is initialized to 2000. .DW DS:10C<CR> 0000 0002 0004 0006 0008 000A 000C 000E 2000:0100 . In case of stand-alone operation, the LCD will output .DW DS:10C<CR> 2000:010C 00F0 <CR> . For displaying a range of data words, the same procedure as with Display Byte is followed, with the only exception that DW replaces D. Note that ASCII equivalent characters are not displayed with word data. 00F0
38
3. If the contents of a particular register are to be examined or modified, enter the abbreviated register name after entering X and press <CR>. The abbreviations for the register names are shown in the table 4.2 Table 4.2 Register Abbreviation Register Name Accumulator Base Count Data Stack Pointer Base Pointer Source Index Destination Index Code Segment Data Segment Stack Segment Extra Segment Instruction Pointer Program Counter* Abbreviation AX BX CX DX SP BP SI DI CS DS SS ES IP PC
Now the monitor will output an equals sign =, the current contents of the specified register, the data prompt character - and a space. If you wish to change the contents of this register, enter the new value followed by a comma, or a carriage return. Entering a comma displays the contents of the next sequential register and opens it for optional modification. The register sequence is in the order as shown in the above table. This sequence is not circular i.e. if a comma is entered after the contents of the last modifiable register (viz. Flags register FL) is examined /modified, the command is terminated and the monitor returns to the command entry mode. Entering a carriage return terminates the command. *Program Counter cannot be modified using this command. To modify PC, the user will have to modify CS and IP registers, such that the PC will point to the desired effective address. EXAMPLES 1. Examine the contents of all the registers. .X <CR> AX=1182 BX=A113 CX=000F DX=1242 SP=0100 BP=4020 SI=6020 DI=6F20 DS=0000 SS=0000 ES=0000 CS=0000 IP=0200 FL=F046 PC=00000 . In case of stand-alone mode operation, the display format will be as follows. .X <CR>
39
The monitor now waits for a user strobe viz. <CR> to refresh the display and output subsequent data <CR> DS=0000 SS=0000 ES=0000 CS=0000 IP=0200 FL=F046 PC=00000 <CR> . 2. Examine and modify the SP register and examine the next register i.e. BP .XSP=0100 - 0110, BP=4020-<CR> .
Notes: Since Move operation is performed one byte at a time, M command can be used to fill a block of memory with a predefined constant. To do this, move the constant into the "start address" location using S command. Then M command is used with a "destination address" which is one greater than the "start address". Then the memory block from start address to "end address" +1 is filled with the value contained in "start address". ERROR CONDITIONS 1. Trying to move data into a non-existent memory or ROM locations. 2. Specifying an `end address' value that is less than the offset value of the "start address". EXAMPLES 1. Move the contents of the locations 2000H through 2020H relative to CS register, to the memory block starting at 3000H relative to the DS register. .M2000,2020,DS:3000<CR> 2. Fill memory locations 1000:2000H through 1000:2100H with constant AAH. .S 1000:2000, <CR> 1000:2000 BA- AA<CR> .M1000:2000,20FF,1000:2001<CR> The validity of the Move Memory commands can be verified anytime using the Display Memory or Compare Memory commands.
NOTE: The command will accept the last two Hex Characters entered as valid data in case of Byte operation and the last four Hex characters as valid data during Word operation. In case, less than four characters are entered during Word operation the command assumes the upper nibbles not entered to be 0. ERROR CONDITIONS 1. 2. 3. Entering the ending address offset lesser than the starting address offset Trying to enter a non-Hex value for the address or data. Trying to fill non-existent memory or ROM locations.
EXAMPLE 1. Filling the memory locations from 0:2000 to 0:2050 with constant data byte 55
F0:2000,2050,55<CR> 2. Filling the memory locations from 0:5000 to 0:6000 with constant word data 1234 FW0:5000,6000,1234<CR> 3. Filling the memory locations from 0:5000 to 0:6000 with constant word data 00AA FW0:5000,6000,AA<CR>
42
EXAMPLES 1. Input a byte from parallel I/O port at address FFE1H .IFFE1<CR> FFE1 - FA<CR> . 2. Input a series of words from parallel I/O ports located at addresses FFE0H and FFE6H. .IWFFE0<CR> FFE0 - A2A2, FFE2 - B2B2, FFE4 - C2C2, FFE6 - D2D2<CR> . Note that when using word input i.e. IW command, lower order addresses i.e. addresses on word boundaries are entered as port addresses.
43
EXAMPLES 1. Program the parallel I/O port FFE0H for output by sending appropriate command byte to the status port FFE6H. .OFFE6 <CR> FFE6 - 80<CR> . 2. Output a series of words to ports ranging from FF00 to FF06 .OFF00<CR> FF00 - 1234, FF02 - ABCD, FF04 - 5555, FF06 - 3676<CR> .
NOTE: In this command, end address1 is always relative to the segment value specified with start address1 or implied with start address1 (i.e. the contents of CS register if no segment value is specified). Consequently, no segment value is permitted with the end address1 and with each command execution, a maximum of 64K bytes can be compared. The segment for start address2 is relative to the current CS value unless otherwise specified. 3. Pressing <CR> starts execution of the command. The monitor will compare subsequent data at each corresponding location of the blocks and display differences when found in the following pattern. The display format for stand-alone mode of operation is described below Segment1:offset1 - data 4. Segment2:offset2 - data
The monitor returns to command entry mode at the end of command execution
44
ERROR CONDITIONS 1. Entering the ending address offset lesser than the starting address offset 2. Trying to enter a non-Hex value for the address or data. 3. Entering a value for the offset of the second address such that the range of locations left in the segment from this offset does not match the range to be compared. EXAMPLES 1. Compare a block of memory beginning at 0:2000 to 0:2050 with a block beginning at 0:3000
.C0:2000,2050,0:3000<CR> . . This response shows that there was no mismatch. 2. Compare a block of memory beginning at 0:2500 to 0:2550 with a block beginning at 0:3000
.C0:2500,2550,0:3000<CR> 0000:2505 - 45 0000:3005 - 76 0000:2515 - 21 0000:3015 - 16 0000:2532 - 45 0000:3032 - A3 0000:2544 - 1A 0000:3044 - 22 . This response shows that there was a mismatch at 4 locations. In case of stand-alone operation, the command entry format is similar to that in the serial mode. The output in case of example 2 will be as follows. 0000:2505 - 45 0000:3005 - 76<CR> 0000:2515 - 21 0000:3015 - 16<CR> The display will now be refreshed and the monitor will output the following result. 0000:2532 - 45 0000:3032 - A3<CR> 0000:2544 - 1A 0000:3044 - 22<CR> .
FORMAT G <CR> [<start address> [,<breakpoint address>]]<CR> OPERATION 1. To use this command, enter G when prompted for command entry followed by a <CR>. The monitor now outputs the current CS and IP register contents in the Segment:Offset format. 2. If the user wishes to start program execution from an alternate starting address, the user has to enter the same. Segment specification is not necessary if the segment value of the program start address is the same as the current code segment. 3. The user may use the Breakpoint facility by entering a comma followed by a break point address at which program execution needs to be stopped. No segment value is permitted with breakpoint address. Thus the default segment value for the break-point address is either the segment specified with the "start address" or the current CS register content if a segment value is not specified. Breakpoint implementation is discussed below in detail. 4. To begin program execution, enter carriage return. CPU Control is now transferred from the monitor to the user program. Program termination is entirely dependent on the instructions entered by the user. 5. To exit from the executing program and to return control to the monitor the user has the following options. At the logical termination of the users program the user should enter the instruction INT 03 (Hex Code = CC). This instruction will perform the Type 3 interrupt service routine embedded in the ESA 86/88-3 Monitor, which will break the program at that address, display all the current register contents and return to command entry prompt. The user can use the Breakpoint facility provided with the GO command and can break the program at any desired address. With this option, the user program breaks at the specified address and control is transferred back to the monitor. Breakpoint facility is discussed in detail below. If the user program ends with a HLT instruction (Hex Code = F4) or continues to execute in an endless loop, the user may have to RESET the trainer. However upon RESET, any previous information of the program contained in segment and status registers is lost and they are reinitialized to their default values.
46
If a subsequent GO command is entered, the current address displayed will be the break-pointed address. The user can resume execution of the program from this address by just entering <CR>. While implementing breakpoint facility the monitor saves the instruction at the breakpoint address, and replaces it with an interrupt before transferring control to the user's program. When the program reaches the breakpoint address, control is returned to the monitor. The monitor saves all CPU registers, restores the break-pointed instruction and outputs the previously described pattern. It then issues the command entry prompt allowing the user to modify any of the registers, memory locations before resuming the execution of the program. From the above discussion, it is clear that The user can specify a Breakpoint address only when a comma precedes it. The segment value for the breakpoint address is always relative to the start address segment value. An instruction in the read-only memory cannot be break-pointed. Break point address must be specified each time when a program to be break-pointed is executed.
BR@ is displayed on the console only i.e. it appears only in the serial mode. In stand-alone mode the monitor proceeds with the registers display directly. EXAMPLES 1. Transfer control to the program at 2000H relative to CS register .G<CR> .G 0000:0000 2000<CR> . 2. Transfer CPU control to a program starting at location 20:300H and breakpoint the instruction at location 20:3F2H. .G<CR> .G 0000:0000 20:300,3F2<CR> BR@ AX=1182 BX=A113 CX=000F DX=1242 SP=0100 BP=4020 SI=6020 DI=6F20 DS=0000 SS=0000 ES=0000 CS=0020 IP=03F2 FL=F002 PC=005F2 0020:03F2 55 PUSH BP . In Stand-alone mode of operation, the output format on the LCD with respect to the above command will be as described below. .G<CR> .G 0000:0000 20:300,3F2<CR>
47
The monitor refreshes the LCD and displays all the CPU registers in the following format. In this mode, the monitor waits for user strobes wherever necessary. AX=1182 CX=000F SP=0100 SI=6020 <CR> BX=A113 DX=1242 BP=4020 DI=6F20
DS=0000 SS=0000 ES=0000 CS=0020 IP=03F2 FL=F002 PC=005F2 <CR> 0020:3F2 PUSH BP 55 <CR> . 3. Attempting to breakpoint an instruction in the EPROM area. As shown below, this will result in an error. .G<CR> .G 0000:0000 F000:100,122<CR> ?G 0000:0000 20:300,3F2 NOTE: All underlined lines in these examples are either overwritten by the statements following or are inserted in the text merely for illustration.
48
2. If the program is to be executed from an address other than that displayed, the user must enter a new start address followed by a comma. The segment value of the start address is implied to be the same as the current value of the CS register unless it is explicitly entered. 3. The monitor now outputs the current content of the CPU registers followed by a line of disassembled code at the start address. To proceed with execution of this instruction, enter another comma. 4. The addressed instruction is now executed and CPU control returns to the monitor. Before this the monitor saves all the registers, displays them and outputs a line of disassembled code at the address of the next subsequent instruction. Now the user can enter a comma and proceed with executing the instruction at the displayed address or enter a new address at which an instruction is to be single stepped. Note that the monitor does not output a command entry prompt, although at this stage control rests with the monitor. Hence entry of any other command at this stage will result in an error. 5. Each time a comma is entered, the addressed instruction is executed and the address and instruction byte contents of the next instruction to be executed along with all registers and a disassembled line of next instruction code is displayed. A new start address can be specified after executing any instruction. 6. A carriage return, after executing an instruction terminates the command and returns the monitor to command entry mode. Modification of any memory or register contents can be done while single stepping through a program only by using a <CR>. However since the current command is terminated, the user will have to re-enter the single-step command and proceed. RESTRICTIONS 1. An instruction that is part of a sequence of instructions that switches between stack segments (i.e. changes the SS and SP register contents) can not be single stepped. 2. If an interrupt occurs prior to the completion of a single-stepped instruction or if a singlestepped instruction generates an interrupt, then CS and IP registers will contain the address of the interrupt service routine when the monitor regains control. Consequently, a Type 3 (Breakpoint) interrupt instruction (CCH) should not be single-stepped (since its execution will cause the program execution sequence to enter the Monitor). EXAMPLES 1. Single step the first three instructions of a program starting from location 0:2000H onwards and then branch off the execution sequence to location 100:3000H and execute the single instruction at that location.
.N<CR> .N 0000:0000 0:2000, AX=0000 BX=0000 CX=0000 DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=0000 SS=0000 ES=0000 CS=0000 IP=2000 FL=0000 PC=02000 0000:2000 BA E6 FF MOV DX,FFE6 , BR@
ESA 86/88-3 Users Manual 49
AX=0000 BX=0000 CX=0000 DX=FFE6 SP=0100 BP=0000 SI=0000 DI=0000 DS=0000 SS=0000 ES=0000 CS=0000 IP=2003 FL=F002 PC=02003 0000:2003 B0 80 MOV AL,80 , BR@ AX=0080 BX=0000 CX=0000 DX=FFE6 SP=0100 BP=0000 SI=0000 DI=0000 DS=0000 SS=0000 ES=0000 CS=0000 IP=2005 FL=F002 PC=02005 0000:2005 EE OUT DX,AL , BR@ AX=0080 BX=0000 CX=0000 DX=FFE6 SP=0100 BP=0000 SI=0000 DI=0000 DS=0000 SS=0000 ES=0000 CS=0000 IP=2006 FL=F002 PC=02006 0000:2006 FF DB FF 100:3000, BR@ AX=0080 BX=0000 CX=0000 DX=FFE6 SP=00FE BP=0000 SI=0000 DI=0000 DS=0000 SS=0000 ES=0000 CS=0100 IP=3001 FL=F002 PC=04002 0100:3001 50 PUSH AX <CR> . For better understanding and familiarization of this command, single step the example programs given in Chapter 10 following the above discussion and observe the results. Note: The above description of this command is applicable to serial mode operation where the command output can be seen on the console. The command will follow a similar execution sequence in stand-alone mode operation also, except for a difference in the register display format. An extra <CR> will be required to proceed with the command since the LCD output will be refreshed after a strobe from the user. 4.5.12 HELP COMMAND (H) FUNCTION This command lists ESA 86/88-3 Monitor commands with their valid syntax in Stand-alone mode of trainer operation. FORMAT & OPERATION H[<Command mnemonic>]<CR> 1. When prompted for command entry entering H with <CR> lists ESA 86/88-3 Monitor commands with a description of their valid syntax on the LCD. Thus the user can use this command as a ready reference source on the monitor commands. 2. If the command syntax of a particular command is required, then the user should enter H followed by the command Mnemonic.
50
For e.g. entering HS with <CR> will output the syntax of the Substitute memory command. After displaying the command, the monitor waits for a user strobe viz. <CR> to display the next command and its syntax. Pressing <Esc> will terminate the command and the monitor returns to command entry mode. The command syntax appearing with the description of this command is the same as that of the Command Help appearing in Serial Mode of operation.
4.6
1. Refer Chapter 7 of this manual for a detailed description of ESA 86/88-3 EPROM Programmer system invoked by the following command. P (Invoke Programmer) P<CR>
The EPROM Programmer software further supports commands to Read, Blank Check, Verify and/or Program the popular EPROMS 2716 through 27512 and the on-chip code memory of 8x51 Microcontrollers. 2. Refer Chapter 8 of this manual for a detailed description of ESA 86/88-3 Symbolic Oneline Assembler and a discussion of the following Monitor commands in support of this assembler. A (Invoke Assembler) LL (List Labels) LC (Clear Labels) Z(Disassembly) A[address>]<CR> LL<CR> LC<CR> Z[<start address>[,<end address>]]<CR>
51