Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Address computa...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4983 of 5072
Post > Topic >>

Address computation

by Tim Frink <plfriko@[EMAIL PROTECTED] > Apr 29, 2008 at 10:15 AM

Hi,

the ISA of my processor can handle immediate operands of max.
16bits. So, to store a 32bit base pointer into a 32bit address
register, the manual suggest the usage of a combination of two
instructions:

MOVH AREG, ((absolute address+0x8000)>>16) & 0xFFFF and
LEA AREG, AREG (off16) # off16 = (absolute address & 0xFFFF)

where 
* the absolute address is 32bit, 
* MOVH moves the 16bit value of the second operand to the
most-significant half-word of AREG  and set the least-significant 
16 bits to zero.
* LEA computes the effective address with 
effective address = second AREG + sign_ext(off16);
first AREG = EA[31:0];

The thing I don't understand here is the addition of 0x8000 in
the MOVH instruction before ****fting. Why is this done? If the
16th bit is already 1 in the value of absolute address, then
the addition would also modify the most-significant 16 bits.

Regards,
Tim
 




 3 Posts in Topic:
Address computation
Tim Frink <plfriko@[EM  2008-04-29 10:15:53 
Re: Address computation
Phil Carmody <thefatph  2008-04-29 14:03:59 
Re: Address computation
Phil Carmody <thefatph  2008-04-29 15:03:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 15:50:32 CDT 2008.