Click to See Complete Forum and Search --> : Assembly and Array


danglin
February 10th, 2005, 01:21 PM
I've done this several times and keep getting it wrong. Can one of you genius help. This is driving me nuts. Thank you




Question 27:

Write a GAL subprogram called min, which finds the smallest value in an array of 100 integers. Assume the base address of the array is given in reg0, and return the smallest value in reg1. Any other registers that your subprogram modifies should be saved and restored to their original states.



Question 31:

Rewrite your answer to Question 27, using a stack to pass parameters according to the following model,

**************
Return_address <------------SP(top-of-stack register)
**************
Array_base
**************
Var_location
*************

*************
System stack

Where the value contained in var_location is the address where the smallest value in the array should be stored. Assume that reg7 is acting as SP, the top-of stack pointer.

Hobson
February 12th, 2005, 12:02 PM
What are you having problems with?
Procedure of looking up the minimum element in array, written in Intel assembly language, you can find in attachment.
That should not to be hard to make a subprogram with it.

Hob