Assembly Language

Homework 7, Due 2010/5/17

Problem 1

Shifting multiple doublewords (Page 222, Problem 4)

Write a procedure that shifts an array of five 32-bit integers using the SHRD instruction (Section 7.2.9).

Write a program that tests your procedure and displays the array.

 

t7_1.exe

 

Problem 2

DumpMem procedure (Page 268, Problem 2)

Write a wrapper procedure for the link library's DumpMem procedure, using stack parameters. The name can be slightly different, such as DumpMemory. The following is an example of how it should be called:

 

        INVOKE DumpMemory,OFFSET array,LENGTHOF array,TYPE array

 

Write a test program that calls your procedure several times, using a variety of data types.

 

t7_2.exe

 Problem 3

Nonrecurcive factorial (Page 268, Problem 3)

Write a nonrecursive version of the Factorial procedure (Section 8.3.2) that uses a loop. Write a short program that

interactively tests your Factorial procedure. Let the user enter the value of n. Display the calculated factorial.

 

t7_3.exe

 

ftp your homework to

ftp://alasp7@140.127.208.168/

in the directory \HW7

by the following format:

檔案名稱:hw#_學號.zip

例如:資工同學,作業4

    檔案名稱:hw4_a09755xx.zip.  (注意:檔案名稱不能有中文)

The password is given in class.