I want to code this recursive binary search in assembler motrolla 68K.
int binSearch(int key, int &lo, int &hi) {
if(hi < lo)
return NOT_FOUND; //RETURN with V = 1
int mid = (lo+hi) / 2;
if(key == array[mid])
return mid;
else if(key < array[mid]) // go left
return binSearch(key, lo, mid-1); // left
else
return binSearch(key, mid+1, hi); // right
}
so I am just wondering if I am coding the int binsearch(int key,int&lo,int &hi)
part right
any helP!!????????????
link A6,#0
movem.l D1,D2-(sp)
move.w 8(A6),D1 *key
and if I wanted to do int&low,int hi
would I do the same thing just with A5,A4..ect.?