Thread: Quicksort Error
View Single Post
Old Nov 1st, 2006, 8:58 PM   #2
Ambuoroko
Newbie
 
Join Date: Oct 2006
Location: Pittsburgh, Pennsylvania
Posts: 3
Rep Power: 0 Ambuoroko is on a distinguished road
Send a message via AIM to Ambuoroko
If anyone is interested in what was wrong, I think I've found it... Originally I fixed the program by just using an array based from index 1. But I didn't really like wasting that byte (and I may have lost points for doing so).

Apparently what was happening was the DI pointer was becoming negative. I don't actually quite understand how signed numbers work, as we haven't entirely covered them yet (we've covered two's complement representation of signed numbers, but not how to actually use them). However, from experience I've found that "negative" numbers turn up as large positive ones... Which makes sense with how negative numbers are stored. So adding a test in the beginning to return if DI is greater than, say, 100, fixes the problem, since I can't/don't know how to check if it's less than zero.

Thanks to anyone who took the time to look at the code. I know reading assembly code is somewhat tedious

John
Ambuoroko is offline   Reply With Quote