EECC250 Winter 1999
Assignment #2
Due Friday, February, 11
|
Solve the following exercises in the textbook (68000 Family Assembly Language):
- Chapter 1:
Exercise: 16
- Chapter 5:
Exercises: 12, 16
- Chapter 6:
Exercises: 2, 5, 8
- Chapter 7:
Exercises: 1, 7
- Chapter 8:
Exercises: 6, 7
- Chapter 9:
Exercise: 5
- Chapter 10:
Exercises: 5, 6
- The following 68000 program, presented in class on 12-1-99, reverses the contents of a string that
ends with 0 and stored in memory starting at address label String:
LEA String,A1 Point to the beginning of the string
Loop1 TST.B (A1)+ Move to the end of the string
BNE Loop1 Until the EOS is encountered
SUBA #1,A1 Back up to the EOS
LEA String,A0 Make A0 point to the beginning
Loop2 MOVE.B -(A1),D0 Save the bottom byte
CMPA.L A1,A0 If A0 has reached or passed A1
BHS Exit Then the string is reversed
MOVE.B (A0),(A1) Move the top to the bottom byte
MOVE.B D0,(A0)+ Move the previously saved bottom byte to the top byte
BRA Loop2 Loop back for another byte
Exit STOP #$2700
Assuming a string length of 50000 bytes, calculate the average number of cycles per instruction (CPI)
for the above code, and calculate the program execution time in seconds when run on a 68000 CPU
running at a clock rate of 16 MHz.
|