Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,633 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,056 people online right now. Registration is fast and FREE... Join Now!




Assembly question

 
Reply to this topicStart new topic

Assembly question

kidworld
post 7 Feb, 2006 - 08:58 PM
Post #1


New D.I.C Head

*
Joined: 4 Nov, 2005
Posts: 4


My Contributions


mov [EAX+2*EBX], CL

EAX = 00001000h, EBX= 00002200h, DS = 1200h, SI = 0250h,
CX= 0BADh, DX = 1FABh

what is the addresses accessed ? and what's the different when I have

mov [AX+2*BX], CL,

I am really confusing
thanks
User is offlineProfile CardPM

Go to the top of the page

born2c0de
post 12 Feb, 2006 - 04:47 AM
Post #2


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,905



Thanked 34 times

Dream Kudos: 2800

Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions


It's simple.
Here's what it actually means.
CODE
MOV [1000h + 4400h] , ADh

This is so because
  • The * Operator has higher precedence than the + operator
  • CL refers to the lower byte of CX which is ADh
The best way to see this work is by using a Debugger and watching the values of registers after this statement. That will help you understand this better.

CODE

mov [EAX+2*EBX], CL
mov [AX+2*BX], CL

Both of these are identical...the only difference being that the first one uses 32-bit Register Addressing while the latter uses 16-bit Register Addressing.
The First one won't be accepted as a legal instruction on 16-bit Machines though.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 03:59AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month