Re: A83: HL\2


[Prev][Next][Index][Thread]

Re: A83: HL\2




At 06:39 1998-08-31 +0900, you wrote:
>
>> Shift h right one step, then rotate l through carry to the right.
>> 
>> sra h
>> rr  l
>
>Woah, could you explain that a little.  So the sra rotates h right one
>step...what does the rr l do?  Thanks.

look at it like this:
contents in HL before:
H:       L:
10010101 01011100

sra shifts H right one step like this:

a zero is put in here ->01001010 <-the bit that was "pushed out" is put in
Carry (important)

rr rotates L right _through_carry_ like this:

Here is the carry-bit put in (the bit that was pushed out from H)->10101110
th bit pushed out is put in carry here to..  but we wont use that..

so after, HL will look like this:
H:       L:
01001010 10101110

thus shifted right one step, which is equal to have divided HL by 2..

I hope that helped...
//Olle


Follow-Ups: References: