CSCI 2400: Assembly Class 6
Data Processing
Time to put it all together! In today's class you will:
- Process an array of data looking for specific values
- Find the max of the array
- Find the min of the array
- Find the position of a special target value
Exercises
- Login to hopper.slu.edu- remember you can login with:
ssh username@hopper.slu.edu
- Now, download a new program for today's class:
wget http://cs.slu.edu/~dferry/courses/csci2400/asm/array.s
- Scroll to the bottom of today's program. You will see 500
data values labeled
array
. Your goal is to write a
program that processes this array doing three things:
- Find the maximum value
- Find the minimum value
- Find the position of a specific value, 615049950 (this value is stored in the variable
target
)
It should then print these values at the end of the program.
Hints:
- You can move the starting address of the array into a register with the instruction:
leal array, %edx
- Suppose you have the array base stored in EDX and a counter stored in ECX. Then you can use scaled indexed accessing to iterate through the array: (%edx, %ecx, 4)
- Feel free to declare new variables to hold things such as the max and the min values
- Start by tackling each of the three tasks separately, then integrate them together
- You may find it useful to encapsulate some program functionality inside separate procedures, though you don't have to
- When you are done with all of the in-class programming assignments, email them to
dferry_submit@slu.edu.
Include your answers to each question in your email,
in a text file, or in program comments and include them with your submission. These will count for
credit as your participation grade.