Presentation is loading. Please wait.

Presentation is loading. Please wait.

Q2 You are to write an e100 assembly function called “findX”. It takes one argument “findX_value” and it is to search the first 5 elements of the array.

Similar presentations


Presentation on theme: "Q2 You are to write an e100 assembly function called “findX”. It takes one argument “findX_value” and it is to search the first 5 elements of the array."— Presentation transcript:

1 Q2 You are to write an e100 assembly function called “findX”. It takes one argument “findX_value” and it is to search the first 5 elements of the array BOB for an element equal to findX_value. If there is a matching value, it is to return the first index where the value is found. If there was no matching value in the first 5 elements of BOB, it is to return -1. So for example, if we had : BOB.data 14.data 15.data 14.data 18.data 10 Then when calling findX with an argument of 15, the return value would be 1. If the argument were 14, the return value would be 0 and if the argument were 8 the return value would be -1. The return value should be called “findX_result” and the return address should be called “findX_ra”. You should declare space for all needed variables here other than BOB (which you can assume was declared elsewhere). [16 points]

2 Memory location Initial Value Final Value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 start cpta here here bob hereadd tom one 1 donehalt one.data 1 bob.data 4 tom.data done.data 0xD

3


Download ppt "Q2 You are to write an e100 assembly function called “findX”. It takes one argument “findX_value” and it is to search the first 5 elements of the array."

Similar presentations


Ads by Google