Motorola Binary Search Help

Hi Everyone! Hopefully most of the traffic on this site doesn't come from us kiddies in assembler classes wink
I'm having slight troubles with a Binary Search program in assembler. We are using Motorola 68k.

The purpose of the program is to load an array of data from some random file. The data in this random file is always integers -- positive and negative. Then we had to craft 2 subroutines, one to collect user input, one for the binary tree recursion. My user input works just dandy. My binary tree subroutine however is a little ... well off. I am purposely controlling the input so that elements will be "found" in the array. For some values, the algorithm can find it and correctly return the index back to the driving program to let the user know "hey, we found your value".

I have spent a few hours debugging and have found the troublesome code, but I can't seem to piece it together in the right way. What is happening is the binary search function will run a couple times, and then randomly get hooked up on one index, and continually stare at that index. We are passing addresses rather than values from the driving program for the hi & lo properties of the binary search.

Any ideas are appreciated :)

I can post code if necessary.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!