MON88

Debug Monitor and Tiny Bios for the 8088/8086 Processor

Last Updated: 29/08/05

MON88 is a combined debug monitor (like the DOS debug.exe program) and some general DOS/BIOS interrupt handlers. The monitor was developed for the CPU86 IP Core processor but can easily be adopted for another embedded x86 system. The MON88 monitor includes an Intel Hex loader, Dissassembler and some INT21/INT10/INT16/INT1A services. The monitor is assembled by A86 assembler and requires about 14Kbyte. The disassembler is based on David Moore's "disasm.c - x86 Disassembler v 0.1".

Download Source File

The monitor is located in the bottom 14Kbyte of memory. The first 1Kbyte is reserved for the interrupt vectors thus the (cold) start address is 0000:0400 (CS:IP). The I/O is handled by 2 routines, RXCHAR and TXCHAR which write/read from a UART. To communicate with the Debugger use a dumb terminal like TeraTerm in VT100 mode without local echo.

To assemble the monitor and convert the binary file to an Intel hex file use the following commands:

A86.com +L1 +P0 +W0 +T0 +G2 +S  mon88.asm  mon88.bin
bin2hex.exe mon88.bin mon88.hex -o 0000 -e 0400

The bin2hex converter can be downloaded here. The -e argument results in an execute record to be added at the end of the hex file.

Included in the zip file is the C-source and executable (DOS-box) for a simple upload program. I wrote this program since I wanted to automate the upload and execution process something I couldn't do with my terminal program. Also to upload a file you can simple using the Send File (text) option on your terminal, however, this doesn't include any form of checking. The program is pretty basic and defaults to COM1:38400,n,8,1. To upload a file simply issue the command:

upload filename.hex

The extention .hex is optional. If you want to enter a simple terminal program after the upload process add the -t command to the command line:

upload hexfilename -t

or to just enter the terminal program:

upload -t

To quite the upload press F1 (or CTRL-C), to upload a file press F2. The upload command will first write the 'L' character followed by the hexfile. 

Available Debug Commands

The following commands are supported:

Command

Function

Example

DM {from} {to}

Dump Memory

DM 0000 0100

FM {from} {to} {fill_character}

Fill Memory

FM 0300 0500 5A

R

Dump Registers

R

CR

Change Register

CR AX 1234

U {from} {to}

Un(dis)assmble range

U 0100 0120

WB {address} {byte}

Write Byte to Memory

WB 1234 CC

WW {address} {word}

Write Word to Memory

WW 1234 5A23

IB {port}

Read Byte from I/O port

IB 03F8

IW {port}

Read Word from I/O port

IW 03F8

OB {port} {byte}

Output Byte to I/O port

OB 03F8 21

OW {port} {word}

Output Word to I/O port

OB 0325 0120

L

Load Intel Hex File

L

BP {number} {address}

Set Breakpoint

BP 1 0100

CB {number} {address}

Clear Breakpoint

CB 3 0120

DB

Display all Breakpoints

DB

T

Trace address

T 0100

N

Next Trace

N

G {address}

Execute program

G 0100

BS {address}

Change Base Pointer

BS 0340

H or ?

Display Help

H

Q

Quite/Restart Monitor

Q

 

Available Interrupt Handlers

Interrupt

Service

Action

INT0

 

 

INT1

Breakpoint handler, used by monitor

Monitor breakpoint function

INT3

Trace handler, used by monitor

Monitor trace (single step) function

 

 

 

INT 10

AH=0E, AL=char, BH=ignored, BL=ignored

Teletype Output, character written to UART

 

 

 

INT 16

AH=00, Return AH=BIOS Scan code, AL=char

Wait for keypress (kbhit)

 

AH=01, Return AH=BIOS Scan code, AL=char, ZF

Wait for keypress, ZF=1 no key, ZF=0 key

 

 

 

INT 1A

AH=00, Return CX:DX number of ticks since midnight, AL=0

Get System Time, 18.2 ticks/sec

 

AH=01, CX:DX number of ticks since midnight

Set System Time, 18.2 ticks/sec

 

AH=02, CH=hours, CL=minutes, DH=seconds

Get RTC Time, all values returned are in BCD

 

AH=03, CH=hour, CL=minutes, DH=seconds

Set RTC Time

 

AH=04, CH=century, CL=year, DH=month, DL=day

Get RTC Date, all values returned are in BCD

 

AH=05, CH=century, CL=year, DH=month, DL=day

Set RTC Date

 

 

 

INT 21h

AH=01, Return char in AL

Read Character from UART

 

AH=02, AL=char

Write Character to UART with echo

 

AH=08, AL=char

Write Character to UART without echo

 

AH=09, DX=Offset to string

Write NULL (not $) terminated string to UART

 

AH=0B, AL=Status

Check for char waiting (kbhit), AL!=0 if key pressed

 

AH=25, AL=INT number, DX=offset INT handler

Set Interrupt Handler

 

AH=2C, Return CH=hours, CL=minutes, DH=seconds DL=0

DOS Get System Time, same as INT1A,02 DL=0

 

AH=30, Return AL=02

Get DOS version, fake by returning AL=2

 

AH=4C

Terminate, jump back to monitor, AL=Return Code

 

 

 


Examples

The following section shows some examples of using the MON88 Debugger.

Some Links