Trouble understanding FPREM1 in HLA
- From: "Bernie Woodham" <spamtrap@xxxxxxxxxx>
- Date: Mon, 23 Oct 2006 17:35:41 -0400
Hi again. Still chipping away at AoA.
Vol.3 - Chapter 11 in the chapter on Real Arithmetic we are introduced
to FPREM1: Partial Remainders.
It is explained that if the difference of the exponents of the
two numbers are less than 64, this operation will compute the exact
remainder in one go. But otherwise the operation may take two or
three swings before the job gets done.
C2 is set until the remainder is calculated. The author says,
"The C3, C1 and C0 get bits zero, one and two of the quotient
respectively" I don't understand that part: What is the
significance of these condition bits being set like that?
This might be why I am also having trouble with the example he gives:
// compute Z:= X mod Y
fld(Y);
fld(X);
repeat
fprem1();
fstsw (ax); // Get Condition code bits into AX
and (1, ah); // See if C2 is set.
until (@Z); // repeat until C2 is clear.
fstp (Z); // Store away remainder.
fstp (st0); // Pop old Y value.
Now the part I don't understand is the "and (1, ah);" intstruction. I
know you want to test the C2 bit to see if it's zero. I understand
that. But I don't understand how this instruction does that.
C2 is the 10th bit in ax; the #2 bit in ah. "anding" ah with 1 is
only testing the L.O. bit in ah, (the C0 bit). How does it test the
other bits? The instruction doesn't seem to take account of the other
bits that might be set in that instruction.
Anyway, assistance in understanding this is greatly appreciated.
Thanks.
.
- Follow-Ups:
- Re: Trouble understanding FPREM1 in HLA
- From: randyhyde@xxxxxxxxxxxxx
- Re: Trouble understanding FPREM1 in HLA
- Prev by Date: Re: How interrupts work (x86 vs. C64)
- Next by Date: read this promgram,please
- Previous by thread: Port 73h?
- Next by thread: Re: Trouble understanding FPREM1 in HLA
- Index(es):
Relevant Pages
|