Can someone here explain me, how the TC17** assembler works out the "movh.a and lea" addressing (hex), and how i can calculate them for myself if i have an configuration value like shown in my picture, which is defined as a "constant" or a "global".
What i want to do is, creating/assemble this 32-bit instruction for myself, but i do not make any proccess the last days. Sure, i know how to assemble with Eclipse Toolchain, but i cant use this toolchain in my programm. I am programming with PHP but this doesnt really matter, if i know how to work out this.
As example, here is a picture with the IDApro View of the commands i have to assembly:
As 32-Bit Hex instruction it looks like this:
ASM: movh.a a15, #@HIS(configuration_value_1)
HEX: 91 70 01 F8
ASM: lea a15, [a15]@LOS(configuration_value_1)
HEX: D9 FF E4 67
What i want to do now is to work out that HEX-assembler instructions, with the right addressing to my variable. In this case its located at: "0x80177DA4".
In the instruction set, its explained like this:
Screenshot: movh.a command
Screenshot: lea + long offset addressing mode
What's causing you problem? Everything is shown in your pictures, it's just a simple matter of extracting bits.
It's easier if you reassemble the words from the little endian form. Thus:
movh.a = F8017091
. You can see the constant is actually8017
(no surprise there).lea = 67E4FFD9
This is a little bit trickier due to the silly encoding, so let's convert the top 16 bits to binary:0110 0111 1110 0100
. Now rearrange them to get011111 0110 100100
, then back to hex:7DA4
So the full address is
80177DA4
.