Tuesday, July 13, 2010

8086/88 Assembly Programming in Windows

  8086/88 being the first successful,efficient and popular microprocessor, the disk operating systems included a debug program for the development of the assembly language programs. It is this debug program which is part of Disk Operating System (DOS),that permits us to initiate various stages of assembly language programming from the keyboard of our computer. This debug program is included in  all version of Windows including Windows 7.

Opening Debug Program 

Goto Start-> Run. Type "debug.exe" without quotes in the box that appears and hit enter. Now window appears as shown below.

This is our debug program. You can see '-' mark followed by a cursor blinking. This indicates that the debug program is ready to accept various commands. There are altogether 18 commands.Here we are discussing only six basic and most necessary commands. These are listed in the table below

Assemble Command

The general syntax is

           A [STARTING ADDRESS]       *Square brackets are used to indicate different elements of the    command. They are not part of syntax

Here starting address is the address at which the machine code of the first instruction is to be stored. For example, to aasemble the instruction ADD AX,BX and store its machine code in memory starting at address 1000, we start with the command entry

         -A 1000 (enter)

The response to this command input is the display of the starting address in the form

        0AF9:1000 _

The instruction to be assembled is typed in the following address, and we press the enter key,the instruction is assembled to the machine code. It is then stored in memory,and the starting address of the next instruction is displayed. For our example we have

0AF9:1000 ADD AX,BX  (enter)
0AF9:1002 _

Now we can enter the next instruction or press enter key to terminate Assemble command.

Go Command

This is used for executing a program. General syntax is


The first address is the starting address of the segment of the program to be executed- that is, the address of the instruction at which execution is to begin. The second address, the breakpoint address is the address of the end of the program segment- that is,the address of the instruction at which execution is to stop. For example to execute a program at 1000 with an end at 100B, then

   -G  =1000 100B (enter)

After the execution ,the complete internal state of the system is displayed.

Register Command

This allows us to examine or modify the contents of registers. Syntax is


Here the command is R optionally followed by the register name. Execution of this register command causes the current value of the register to be displayed.If the register name is not used then contents of all the registers are displayed. For example executing

    -R AX (enter)
     AX 00FF:

shows the contents of AX. The examine register command is not yet complete. Note the colon(:) followed by the cursor is displayed. We can now press the enter key to complete the command, leaving the register contents unchanged, or enter new value for AX following the colon and then press enter.

Dump Command 

It is used to view the contents of the various memory locations.The syntax is.


It displays the contents of the 128 consecutive memory locations from the given address.For example executing

-D 2000 (enter)

causes the following output

Enter Command

This allows us to examine and modify the data at various memory locations. The syntax is


Here the address refers to the memory location to which the address is to be loaded. List represents the data.
For example to load the value 2F into the location 2000 do the following.

   -E 2000 2F  (enter)

After execution the value at 2000 will be 2F.

Unassemble Command 

The syntax is 


Using this we will be able to examine the assembly program which we have already entered. For example if the starting address of the program is 1000 and ending is 1030 then

-U 1000 1030 (enter)

will display the program.

Sample Program

As an example coding,verifying and execution of a program to add the contents of two registers are shown below

Reference: This is only an introductory article. A detailed discussion of the debug program can be found in the book " The 8088 and 8086 Microprocessors " by Walter A Triebel and Avatar Singh -Pearson Education.


Anonymous said...


Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes