Assembly Language Programming

Assignment #2

The following questions must be done using DEBUG (you cannot use codeview). You run DEBUG from a DOS prompt. You may get to a DOS prompt via a shortcut on the desktop, the start menu, or you may simply run the program command.com or cmd.exe from the Run Dialog accessible from the Start menu. When the DOS prompt appears, type debug and press enter. Debug prompts for commands with a hyphen ('-'). Additional information about debug can be found in the textbook.

  1. Use the assemble command to enter the following assembly language program into memory starting at offset 100H in the code segment. (The command to do this is A 100 - press enter again after entering the last instruction to exit assemble mode).
  2. Use the Unassemble command to verify that your program was successfully entered (U 100 10C). Record the displayed information for CS:100 through CS:10C (or thereabouts).
  3. Dump memory locations CS:100 through CS:10C (D CS:100 10C) and record the values. Comment on similarities between the display and the unassemble info seen in the previous question.
  4. Use the R command to display the registers before starting and see what instruction is about to be executed. What instruction is it?
  5. Use the proceed command (P) to execute each instruction of the program. Each P command executes one instruction, then displays the register contents and then the address and the machine language and assembly language form of the instruction about to be executed. List the AX and IP register contents and the instruction information for each P command (the last instruction you should execute is the int 20 instruction).
  6. Use the Unassemble command and explain any differences in the instructions shown by the previous unassemble command (step 3). You should use U 100 10C.
  7. Dump memory locations CS:100 through CS:10C (D CS:100 10C) and record the values. Comment on any changes that have occurred from the previous dump (step 4).
  8. Reset the IP register to 100 (Type R  IP  and debug will display the current value and prompt with a colon where you may type a new value - type 100). Verify that IP is 0100 by redisplaying the registers (R). What is the instruction about to be executed? This is not the same instruction you saw when you ran the program the first time. Explain!
  9. Proceed through the program again and note any differences as the program executes. Explain the differences you observe
  10. If you continue to run the program again and again, without reloading, what will happen?
  11. Q is the command to quit DEBUG.

(You may wish to use cut-and-paste to copy screen information from the DOS window into WordPad or NotePad. This would allow you to turn in a typed copy of the assignment and eliminate the need to hand-copy all of the numbers.)