You are on page 1of 3

University Of Dohuk Year 2020-2021

School Of Eng. Third year Class


Biomedical Department Microprocessor LAB
Appendix
-----------------------------------------------------------------------------------------------
DEBUG PROGRAMMING

I- Objective To study the debug program that use to write and execute assembly language programs.

II-Theory :
DEBUG is a program included in the MS-DOS operating system that allows the programmer to monitor a
program's execution closely for debugging purpose.
To begin the program works at first go to MS-DOS prompt and type the following: C:
\ DEBUG ↲ and press enter.
know the DEBUG program is ready to execute its commands. The DEBUG command are shown in table
below.

Table ( 1) the debug command.

Table # 1

The DEBUG commands are :


1-Examining and Altering the Contents of Registers ( R COMMAND)
R [ register name ] Examples:

R AX ↲ ; To display the contain of register AX

R ↲ ; To display the contents of all system register.


R F ↲ ; To display the contents of flags register.

2- Data Manipulation in Debug


There are 3 DEBUG commands that are used to Examine or Alter the contents of Memory
2a- D [ Address ] The Dump command display contents of memory to the screen
2b- E[address][list] The Enter command examines/Alters the contents of memory
2c- F[starting address ] [ending address ] [ list ] The
Fill command fills a block of memory with data
Examples:
D↲ To display the contain of 128 consecutive bytes starting at the current code segment
and offset ( CS:0100 )
D 1333:0200 ↲ To display the contain of 128 consecutive bytes starting at (1333:0200 )

D DS:0200 0204 ↲ To study the contents of memory location start at ( DS:0200 to


(DS:0204 )
E [ address ] [ list ]
E DS:0100 FF FF FF FF FF ↲ To enter a list of FF data to memory location start at
DS:0100
E DS:0100 ↲
1342:0100 FF_ To show the old memory location DS:0100 and allow to change it
F [starting address ] [ending address ] [ list ]
F 0100 011F 22 ↲ To cause the memory location start with 0100 – 011F to be filled
with data 22.
3- Coding and Running Programs in DEBUG
3a- ASSEMBLY command A
A [starting address ] Assembling the instructions with assembly command
A CS:0100 ↲
1342:0100 _ Will allow the programmer to enter the assembly language program starting at
CS:0100

3b- -UMASSEMBLED command U U [starting


address ] [ending address ]
U[starting address][L number of bytes]
To display the machine code in memory along with their equivalent Assembly language
instructions.

U CS:0100 0110 ↲ Will display the un assembly instruction stored in location CS:0100 to 0110
U CS:0100 ↲ Will display the un assembly instruction stored in location CS:0100 with 32 bytes
3c- GO command G To execute the instructions found between the two given addresses

G =[starting address] [ stop address]


G= CS:0200 0217 ↲
The instructions which have been stored at memory locations CS: 0200 to CS: 0217 will be executed. If no
addresses are given, DEBUG begins executing instructions at CS:IP until a breakpoint is reached.

3d- TRACE command T


To trace through the execution of your programs one or more instructions at a time to verify the effect of the
programs on register and/or data
T =[starting address] [ number]
T= CS:0100 ↲ The instruction in location CS:0100 will be executed.
T ↲ The instruction in current value of (CS:IP) will be traced until termination of the program.

You might also like