We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello all, I am using a float variable named val which has a value 169.0 in my program .When I ran the program I got the following assembly code in my disassembly window.Now I want to know the memory location at which the value 169.0 has been stored.Is it possible to know it from the code below? Looking for your help.
49: val=169.0; 0x000002B8 E59F1024 LDR R1,[PC,#0x0024] 0x000002BC E28D0000 ADD R0,R13,#0x00000000 0x000002C0 E5801000 STR R1,[R0]
Hi Dan Henry, Here is the code from the disassembled window for my program. Thanks.
44: void main () 45: { 46: 47: float val,result; 48: 0x000002B0 E92D4000 STMDB R13!,{R14} 0x000002B4 E24DD008 SUB R13,R13,#0x00000008 49: val=144.0; 50: 51: 0x000002B8 E59F1024 LDR R1,[PC,#0x0024] 0x000002BC E28D0000 ADD R0,R13,#0x00000000 0x000002C0 E5801000 STR R1,[R0] 52: result=sqrt(val); 0x000002C4 E28D0000 ADD R0,R13,#0x00000000 0x000002C8 E5900000 LDR R0,[R0] 0x000002CC EB00014D BL ?C?CASTF?A(0x00000808) 0x000002D0 EBFFFF7B BL sqrt(0x000000C4) 0x000002D4 E28D1004 ADD R1,R13,#0x00000004 0x000002D8 E5810000 STR R0,[R1] 53: } 0x000002DC E28DD008 ADD R13,R13,#0x00000008 0x000002E0 E8BD8000 LDMIA R13!,{PC} 0x000002E4 43100000 DDIA 0x43100000 0x000002E8 E59FC000 LDR R12,[PC] 0x000002EC E12FFF1C BX R12 0x000002F0 000002F5 DD 0x000002F5 fabs:
You almost got me there for a second, having changed 169.0 to 144.0, but anyhow, the constant is here:
0x000002E4 43100000 DDIA 0x43100000
Oh, my! The preview looked just fine. You almost got me there for a second, having changed 169.0 to 144.0, but anyhow, the constant is here:
0x000002E4 43100000 DDIA 0x43100000 0x43100000 = 0b01000011000100000000000000000000 Working through the floating point format: http://www.keil.com/support/man/docs/ca/ca_ap_float_format.htm S EEEEEEEE MMMMMMMMMMMMMMMMMMMMMMM 0 10000110 00100000000000000000000 Exponent: 134 - 127 = 7 Mantissa with leading 1-bit: 1.00100000000000000000000 After adjusting binary point: 10010000.0000000000000000 0b10010000 = 144
Hi Dan Henry, Thanks for all your help and replies and clearing my doubt. During my search I got a link where we can convert the our float values into hex value...hope you know the link http://babbage.cs.qc.edu/courses/cs341/IEEE-754.html Thanks again for your help.