hexadecimal addition
am 13.11.2007 16:39:57 von king
I have a register lets say F0200088 (hexadecimal number)
And I want to jump 7 dwords so that I will reach F02000B0 (i.e 88 will
become B0 in hex)
How can I do hexa addition in perl to get this value of F02000B0.
I tried this but not getting it.
sprintf "%X\n",oct("0xF0200088")+oct("0x08");
Re: hexadecimal addition
am 13.11.2007 16:58:42 von jurgenex
king wrote:
> I have a register lets say F0200088 (hexadecimal number)
>
> And I want to jump 7 dwords so that I will reach F02000B0 (i.e 88 will
> become B0 in hex)
>
> How can I do hexa addition in perl to get this value of F02000B0.
>
> sprintf "%X\n",oct("0xF0200088")+oct("0x08");
But 0xF0200088 + 0x08 is 0xF0200090 and not 0xF02000B0. Are you adding the
wrong numbers?\
jue
Re: hexadecimal addition
am 13.11.2007 17:27:41 von spambait
In article <1194968397.461330.168010@s15g2000prm.googlegroups.com>, king wrote:
>
>I have a register lets say F0200088 (hexadecimal number)
>
>And I want to jump 7 dwords so that I will reach F02000B0 (i.e 88 will
>become B0 in hex)
On what system is a dword 5.57143 bytes long?
0xF02000B0 - 0xF0200088 = 0x28 = decimal 40
>
>How can I do hexa addition in perl to get this value of F02000B0.
>
>I tried this but not getting it.
>
>sprintf "%X\n",oct("0xF0200088")+oct("0x08");
0xF0200088 + 0x8 = 0xF0200090
--
Regards,
Doug Miller (alphageek at milmac dot com)
It's time to throw all their damned tea in the harbor again.
Re: hexadecimal addition
am 13.11.2007 18:33:26 von spambait
In article <1gk_i.45513$eY.1400@newssvr13.news.prodigy.net>, spambait@milmac.com (Doug Miller) wrote:
>In article <1194968397.461330.168010@s15g2000prm.googlegroups.com>, king
> wrote:
>>
>>I have a register lets say F0200088 (hexadecimal number)
>>
>>And I want to jump 7 dwords so that I will reach F02000B0 (i.e 88 will
>>become B0 in hex)
>
>On what system is a dword 5.57143 bytes long?
Oops, too many fives -- meant 5.7143
>
>0xF02000B0 - 0xF0200088 = 0x28 = decimal 40
>>
>>How can I do hexa addition in perl to get this value of F02000B0.
>>
>>I tried this but not getting it.
>>
>>sprintf "%X\n",oct("0xF0200088")+oct("0x08");
>
>0xF0200088 + 0x8 = 0xF0200090
>
--
Regards,
Doug Miller (alphageek at milmac dot com)
It's time to throw all their damned tea in the harbor again.
Re: hexadecimal addition
am 13.11.2007 21:55:14 von Neil Cherry
On Tue, 13 Nov 2007 15:39:57 -0000, king wrote:
>
> I have a register lets say F0200088 (hexadecimal number)
>
> And I want to jump 7 dwords so that I will reach F02000B0 (i.e 88 will
> become B0 in hex)
0xF02000B0 - 0xF0200088 = 0x28 ( that's not 7 dwords! That's 0x0A)
> How can I do hexa addition in perl to get this value of F02000B0.
>
> I tried this but not getting it.
>
> sprintf "%X\n",oct("0xF0200088")+oct("0x08");
>
Uhm your math is very strange!
Example:
perl -e '
$a = 0xF0200088 + (7 * 4);
printf "\n0x%x\n", $a;
'
0xf02000a4
--
Linux Home Automation Neil Cherry ncherry@linuxha.com
http://www.linuxha.com/ Main site
http://linuxha.blogspot.com/ My HA Blog
Author of: Linux Smart Homes For Dummies