Assembly Language

Homework 3, Due 2010/4/12

Problem 1

Fibonacci numbers (Page 109, Problem 6)

Write a program that uses a loop to calculate the first seven values in the Fibonacci number sequence { 1,1,2,3,5,8,13 }.  Place each value in the EAX register and display it with a call DumpRegs statement inside the loop.

t3_1.exe

 

Problem 2

Copy a string backwards (Page 110, Problem 8)

Write a program using the LOOP instruction with indirect addressing that copies a string from source to target, reversing the character order in the process.

 

If your program works correctly, you will see the following sequence of hexadecimal bytes on the screen when the program runs:

 

        67 6E 69 72 74 73 20 65 63 72 75 6F 73 20 65 68

        74 20 73 69 20 73 69 68 54

 

t3_2.exe

 

ftp your homework to

ftp://alasp@140.127.208.168/

in the directory \HW3

by the following format:

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

例如:資工同學,作業4

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

The password is given in class.