236
Chapter 41. v850 Dependent Features
movhi hi(here), r0, r6 movea lo(here), r6, r6
The reason for this special behaviour is that movea performs a sign extension on its immedi 
ate operand. So for example if the address of 'here' was 0xFFFFFFFF then without the spe 
cial behaviour of the hi() pseudo op the movhi instruction would put 0xFFFF0000 into r6, then
the movea instruction would takes its immediate operand, 0xFFFF, sign extend it to 32 bits,
0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFF which is wrong (the fifth nibble is E).
With the hi() pseudo op adding in the top bit of the lo() pseudo op, the movhi instruction actually
stores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instruction stores 0xFFFFFFFF into
r6   the right value.
hilo()
Computes the 32 bit value of the given expression and stores it into the immediate operand field
of the given instruction (which must be a mov instruction). For example:
mov hilo(here), r6
computes the absolute address of label 'here' and puts the result into register 6.
sdaoff()
Computes the offset of the named variable from the start of the Small Data Area (whoes address
is held in register 4, the GP register) and stores the result as a 16 bit signed value in the immediate
operand field of the given instruction. For example:
ld.w sdaoff(_a_variable)[gp],r6
loads the contents of the location pointed to by the label '_a_variable' into register 6, provided
that the label is located somewhere within +/  32K of the address held in the GP register. [Note
the linker assumes that the GP register contains a fixed address set to the address of the label
called '__gp'. This can either be set up automatically by the linker, or specifically set by using
the
 defsym __gp= value
command line option].
!
tdaoff()
Computes the offset of the named variable from the start of the Tiny Data Area (whoes address
is held in register 30, the EP register) and stores the result as a 4,5, 7 or 8 bit unsigned value in
the immediate operand field of the given instruction. For example:
sld.w tdaoff(_a_variable)[ep],r6
loads the contents of the location pointed to by the label '_a_variable' into register 6, provided
that the label is located somewhere within +256 bytes of the address held in the EP register.
[Note the linker assumes that the EP register contains a fixed address set to the address of the
label called '__ep'. This can either be set up automatically by the linker, or specifically set by
using the
 defsym __ep= value
command line option].
!
zdaoff()
Computes the offset of the named variable from address 0 and stores the result as a 16 bit signed
value in the immediate operand field of the given instruction. For example:
movea zdaoff(_a_variable),zero,r6
puts the address of the label '_a_variable' into register 6, assuming that the label is somewhere
within the first 32K of memory. (Strictly speaking it also possible to access the last 32K of
memory as well, as the offsets are signed).






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

canadian web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved