Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory Addresses 1

Status
Not open for further replies.

AtomicChip

Programmer
May 15, 2001
622
CA
I feel a little sheepish about asking this question, but let's say I have a doc that says something I need is at memory address 0400:0130h... How do you go about converting that into hex so that you can declare a pointer something like:

unsigned char* pMemLoc = (unsigned char*)0x06000000;

..And then be able to write to it by *pMemLoc = 0xBEEF?

Thanks in advance...

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
...And please don't tell me that the hex value to use in code would be 0x04000130 :p I really hope it's not something as mundane as that...

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
1) Which version of Windows are you using?
2) Which version of Visual Studio are you using.

3.x has a segmented addressing scheme similar to the one you have described
9x, ME, NT, 2K and XP have a flat addressing scheme i.e. the addresses go from 0 to 4G - 1.

If you are using 3.x, then seg:eek:ffset is seg*10+offset so 0400:0130 is 04000+0130 = 04130. On the older compilers there used to be something called MAKEPTR where you gave it the segment and offset and it gave you the address as a DWORD. It probably has been removed ever since they went to flat addressing.
 
Ah, that makes sense...

It's actually not for windows - it's for a GBA program I'm writing... Just getting familiar with the hardware and memory addresses right now.

Thanks =D

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top