Contribute  :  Web Resources  :  Past Polls  :  Site Statistics  :  Downloads  :  Forum  
    BiW ReversingThe challenge is yours    
 Welcome to BiW Reversing
 Monday, October 15 2018 @ 12:30 PM CEST
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

About memory registers like EAX, AX, AH AL etc.

 
Post new topic   Reply to topic    www.reversing.be Forum Index -> Coding Corner
View previous topic :: View next topic  
Author Message
Devoney
Regular
Regular


Joined: 12 Sep 2005
Posts: 110
Location: The Netherlands

PostPosted: Fri Oct 26, 2007 1:18 pm    Post subject: About memory registers like EAX, AX, AH AL etc. Reply with quote

Hi all,

I've run into the existence of AX and AH and AL with luck. I did not find them in any reference where the possible memory registers (or parts of hem) are listed. So I concluded that when AX exists for EAX that BX also must exist, which was true.

Now my problem is that I can not find them ALL! The the last (4th) byte of EAX can be accessed by AL, the one before (3th byte) by AH and together (3th and 4th) by AX. (correct me if I am wrong). but how to access only the second byte, or the first?

Can someone give a resource when I can find a list of this... Or list them here Rolling Eyes

Thanks in advance!!
Back to top
View user's profile Send private message Visit poster's website
detten
Site Admin


Joined: 05 Feb 2005
Posts: 317

PostPosted: Fri Oct 26, 2007 4:39 pm    Post subject: Reply with quote

You named all the registers you can access directly.
They only exist to be backwards compatible with old 8bit / 16bit cpu's.

You can use them for EAX, EBX, ECX, and EDX only.

To access the other nibbles of the registers, I think the fastest way is to shift right.

3rd nibble :

SHR EAX, 16
MOV somevar, AL

4th nibble
SHR EAX, 24
MOV somevar, AL

_________________
Ignorance is bliss, knowledge is power
Back to top
View user's profile Send private message Visit poster's website
Devoney
Regular
Regular


Joined: 12 Sep 2005
Posts: 110
Location: The Netherlands

PostPosted: Sat Oct 27, 2007 6:20 pm    Post subject: Reply with quote

Thanks for the reply. I have tried to use SHR and SHL before... But I tried 1 and 2 to as the second parameter to shift... that did not work.

Could you explain why 16 and 24... I see the difference is 8. Is it that is shift bits instead of bytes? like it shifts up 16/24 bits now? 16 / 8 = 2 bytes and 24/8=3 bytes?

I guess that must be it Wink

Thanks for helping me!
Back to top
View user's profile Send private message Visit poster's website
stingduk
Regular
Regular


Joined: 19 Feb 2005
Posts: 148

PostPosted: Sat Oct 27, 2007 6:46 pm    Post subject: Reply with quote

eax = ebx = ecx = edx 32 bit
ax = bx = cx = dx =16 bit
al = bl = cl =dl = 8bit

shl shifts bit they are bit wise operators

so shl 16 shifts 16 bits to left and shr 16 shifts 16 bits to right
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.reversing.be Forum Index -> Coding Corner All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
 Copyright © 2018 BiW Reversing
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.09 seconds