Re: HP-41 MCode question Message #2 Posted by Frank Wales on 2 Nov 2005, 4:20 p.m., in response to message #1 by Jeff D
(Well, it's been about half a billion seconds since I did any 41 machine code programming, but I think I see the problem...)
You need to perform a floating-point comparison between the two values; the ?A<C ALL is doing a 56-bit binary comparison between the normalized forms of the X and Y register values that you pulled into A and C, which won't work for the vast majority of possible values. (Remember, the X and Y registers can also contain alpha values, and could even include non-normalized values.) The Nut CPU basically hasn't a clue about floating-point operations -- the OS does all that.
You need to call an appropriate subroutine in the 41 OS that performs something like the guts of the X<Y? user code instruction, and deal with its return value appropriately. I certainly don't know what that would be off the top of my head, but I suspect someone else might.
Hope that helps.
|