Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/12/03 16:49
Read: times


 
#45299 - RE: Indirect addressing, loops and subroutin
Responding to: ???'s previous message
Matt:

You are having the problem becasue you have not made provision to keep comparing each value to smallest.
You appear to just be comparing the pairs.

Why don't you try a initializing smallest to 0FFH, Then in a single loop compare each value in the table to smallest and if it is smaller than smallest then you can plug the current table entry in for the smallest value by over-writing the previous small value. Initializing to 0FFh just makes it the biggest value ensuring it will get swapped out.

Alternatively you may want to implement a bubble sort of the values. This takes two nested loops to perform. When finished the smallest value would be at the start of the list and the largest value at the end of the list. The bubble sort is a well known algorithm and you should be able to locate some kind of code for it via a google.com search.

Michael Karas




List of 4 messages in thread
TopicAuthorDate
Indirect addressing, loops and subroutin            01/01/70 00:00      
   RE: Indirect addressing, loops and subroutin            01/01/70 00:00      
      RE: Indirect addressing, loops and subroutin            01/01/70 00:00      
   RE: Indirect addressing, loops and subroutin            01/01/70 00:00      

Back to Subject List