Homework 2: V22.0201.002, Machine Org I, Fall 1997, Chee Yap

### Fall 1997, Professor Yap
V22.0201.002, Machine Organization I

## HOMEWORK 2
Due: Mon October 13, 1997 (not Oct 8).

### INTRODUCTION

The goal is to learn the basics of the Turbo Debugger, and the debugging process. For this purpose, we have provided a buggy solution to homework 1. This buggy program, called h2.asm, can be picked up here. This assignment is worth 30 points.

### DETAILS

1. First read up my notes on TASM and debugging with TD. In fact, we strongly recommend printing a copy of the debugging notes immediately. (Since this is a html file, you can print it using your browser's print command.)
2. Recall that the program in hw1 reads 16 characters, echoes the string twice, once forward and then reversed. H2.asm has bugs in doing the reversal. You are to isolate this problem, and provide a bug-free solution.
3. Study and understand what the buggy program (h2.asm) is trying to do. Despite the bugs, the basic idea in h2.asm is sound! Your correct solution must make only necessary changes to h2.asm. In particular, DO NOT TRY CHANGE THE BASIC LOGIC of h2.asm.
4. We expect you to debug h2.asm with the help of the debugger, not just by studying the source code!! In particular, you must set simple ``breakpoints'' during debugging and must try to examine memory contents. This is required for your report below.

### TO BE HANDED IN

1. A 3.5'' disk containing the original program file (named h2.asm), your bug-free program file (named hw2.asm). Please assemble and link hw2.asm, and rename the executable as ``myecho.exe''. (Reason: we may want to assemble hw2.asm ourselves, and do not want to interfere with your executable file) [2 pts]
2. A sheet of printout of your hw2.asm. [2 pts]
3. A sheet containing a paragraph describing what the bug is and your solution. PLEASE USE ENGLISH PROSE FOR THIS (we will read the code in hw2.asm for ourselves). NOTE: if your hw2.asm does not work, you get at most 5 points for this part. [10 pts]
4. A sheet containing a short report (at most 1 page) on how you used TD to help you find this bug. In this report, you must mention the use of BREAKPOINTS and how you examine the contents of memory. (As long as you honestly try to use TD for debugging, this report should be easy to write). [12 pts]
5. Hand in everything in an envelop. Please write your name, ID and class information on the envelop and also on the diskette. Please DO NOT use any of the NYU envelops. [2 pts]