![]() |
|
RRX implementation in x86 assembly. - Printable Version +- VBA-M Forums (http://vba-m.com/forum) +-- Forum: VisualBoy Advance-M (/Forum-visualboy-advance-m) +--- Forum: Bugs and Support (/Forum-bugs-and-support) +---- Forum: Core (/Forum-core) +---- Thread: RRX implementation in x86 assembly. (/Thread-rrx-implementation-in-x86-assembly) |
RRX implementation in x86 assembly. - JRMoore - 05-04-2010 11:44 AM Hello, looking at the code I think I don't understand how RRX is implemented in x86 assembly. The code right now is the following: Code: #define RRX_OFFSET \The bit test sets the carry flag, but I don't see it using the offset to get the LSB, instead it seems to be 0ing the carry flag, so the operation is a plain RCR. Can somebody explain this to me? Thank you very much. I'll be answering my own question, it's well implemented; I just needed to read some more documentation. Both rotate through carry right (RCR) and rotate right with extend (RRX) allow a 33-bit rotation by using both the offset (in this case) and the carry flag. In RCR the carry flag goes to the bit 31 and the bit 0 goes to the carry flag, which is essentially the same as the RRX does. The bit test op is needed to zero the carry flag in case it was set to 1 from a previous operation. Kind regards. |