Assembly Language

Homework 1, Due 10/13 (changed)

1. Page 24, 1.3.7, Question 10 (10%)

2. Page 25, 1.3.7, Question 22 (10%)

3. Page 25, 1.3.7, Question 24 (10%)

4. Page 29, 1.4.2, Question 4 (10%)

5. Page 40, 2.1.5, Question 8 (10%)

6. Page 53, 2.3.3, Question 4 (10%)

7. This question is to compare the complied codes in C and your codes in assembly language.  (40%)

a. Let Y be the value of the last two digits of your student ID.   Write a 32-bit assembly program to calculate X = (Y+4)*(Y+4)*(Y+3).  Then use WriteDec (Page 146) and WriteString (Page 147) to show

Y is xx

X is xx

Show the execution result in the MS-DOS command window.

b. Use Visual C to write a C program calculating X = (Y+4)*(Y+4)*(Y+3) as in a.  Use the deassembly in step-by-step debugging to view the assembly code for X = (Y+4)*(Y+4)*(Y+3) and write down these complied code.  How many steps are in these complied code?

c. Compare and rewrite your assembly program as you can to decrease the steps in your program for X = (Y+4)*(Y+4)*(Y+3) such that the number of your steps are less than that in b by Visual C.   Print out your program.    Comparing the numbers of steps, how many steps are less in your program than in b?

¡@