#70917 - jake2431 - Thu Feb 09, 2006 3:51 pm
I realize I should already know this, but I'm used to seeing something like 0x4000000 (or 0x4000000h) for hexadecimal. How does something like 0400:0000h translate? I am assuming that it is the same address as the first that I mentioned and that the : is separating that address into two bytes(or what would it be here?). Just wanted to make sure that I am close here.
-Jake
#70929 - keldon - Thu Feb 09, 2006 4:17 pm
0400h would represent the segment, and 0000h would represent the offset. If you are reading an address from gbatek, then they would be the same. In DOS the full address = (segment * 16) + offset, but I'm guessing that you're referring to the IO registers.
#70937 - jake2431 - Thu Feb 09, 2006 4:31 pm
keldon wrote: |
0400h would represent the segment, and 0000h would represent the offset. |
Can you explain what segment and offset are? 0400h(segment) would be the physical area that the data was stored and 0000h(offset) would be the number of bits you want to move that data(like 0400:0000 << 1 = 0400:0001?)?
keldon wrote: |
If you are reading an address from gbatek, then they would be the same. |
0x4000000 is equal to 0400:0000? Also, what is that 'x' for in 0x4000000?
keldon wrote: |
In DOS the full address = (segment * 16) + offset, but I'm guessing that you're referring to the IO registers. |
Yes, I'm talking about GBA IO registers(sorry I didn't specify), so it works different on computers(GBA is the first hardware programming I've done)?
Thanks for the reply.
#70943 - poslundc - Thu Feb 09, 2006 4:58 pm
In the case of GBA programming, the 4:4 notation has the exact same meaning as the full 8 digits. Just think of the colon as a marker to split 32 bits into two 16-bit segments.
The main thing to keep aware of is that your C compiler only recognizes the 0x04000000 format - that is, 0x followed by a string of digits.
Dan.
#70956 - jake2431 - Thu Feb 09, 2006 6:14 pm
poslundc wrote: |
In the case of GBA programming, the 4:4 notation has the exact same meaning as the full 8 digits. Just think of the colon as a marker to split 32 bits into two 16-bit segments. |
Yeah, thats what I thought.
poslundc wrote: |
The main thing to keep aware of is that your C compiler only recognizes the 0x04000000 format - that is, 0x followed by a string of digits.
|
Oh yeah, I've used it enough with example programs to know that. I just
wanted to know the specifics of reading it.
Thanks
#70964 - Cearn - Thu Feb 09, 2006 8:05 pm
jake2431 wrote: |
I realize I should already know this, but I'm used to seeing something like 0x4000000 (or 0x4000000h) for hexadecimal. How does something like 0400:0000h translate? I am assuming that it is the same address as the first that I mentioned and that the : is separating that address into two bytes(or what would it be here?). Just wanted to make sure that I am close here.
-Jake |
0x4000000, 04000000h, 0400:0000, &H04000000 are all the same number, just different notations. '0x' is the hex prefix in C (and some assemblers), 'h' is the hex affix in some assemblers, '&H' is the hex prefix for VB, and so on. The reason I usually use the colon is because it reads easier. You can quickly lose a zero in the others.
EDIT: can't spell ':' :(
Last edited by Cearn on Thu Feb 09, 2006 8:38 pm; edited 1 time in total
#70968 - jake2431 - Thu Feb 09, 2006 8:26 pm
Ah, thanks Cearn..... again :). Using the colon (semicolon is ';' ;) ) does make it a lot easier to read. Didn't even think of that as being the reason. Oh well, now I know.
Thanks,
-Jake