Assembler Developer

Moderators: None (Apply to moderate this forum)
Number of threads: 1030
Number of posts: 1826

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Motorola Binary Search Help Posted by chrisbowden on 9 Dec 2008 at 7:49 AM
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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.