Help with hexadecimal values

I need some serious geek help. I’m working on a little Xbox 360 transplant project and have to do some hex editing. I got some instructions from Xbox-Scene, but they are about as clear as mud to me, especially since I don’t understand hex values.

Here is the part of the instructions I don’t understand:

  1. Find the two ports that your SATA chipset uses for data communication (see the MTKediting thread ( [COLOR=#000000]http://forums.xbox-scene.com/index.php?showtopic=514126[/COLOR] ) for more detailed info on how to do this), basically, you need to run ‘msinfo32’, then go to storage/scsi or storage/ide, depending on your SATA chipset and then look for the two adress lines that have a difference of 7 between them.
    For example:
    I/O-port 0x0000EFE0-0x0000EFE7
    I/O-port 0x0000EFAC-0x0000EFAF
    I/O-port 0x0000EFA0-0x0000EFA7
    I/O-port 0x0000EFA8-0x0000EFAB
    I/O-port 0x0000EF90-0x0000EF9F
    I/O-port 0x0000E800-0x0000E8FF

In this example the two port numbers you are looking for (with difference of 7) are 0xEFE0 and 0xEFA0.

Here’s my list of ports:

I/O Port 0x0000DCA0-0x0000DCAF
I/O Port 0x0000DCB0-0x0000DCBF
I/O Port 0x0000DCC0-0x0000DCCF
I/O Port 0x0000DCD0-0x0000DCDF
I/O Port 0x0000DCE0-0x0000DCFF
I/O Port 0x0000DD00-0x0000DDFF

Can anyone tell me which two port numbers have a “difference of 7” in my list?

Thanks!

None of 'em.

Talisker is correct, you can verify this just using the scientific mode of the windows calculator. The last digit of each value on the left is “0”, the last digit on each value on the right is an ‘F’. An ‘F’ = 15. The lowest differences for your IO ports are 15, some are higher.

Thanks. I guessed, and I guess I guessed correctly, because it’s working now. :)

docvego’s post already says this in so many words but if you’re curious, hex is just a way of counting in a different base, 16 in this case.

Normally we count in base 10 so we have 10 different symbols, 0-9 and we count from 0-9 adding a new place to the left as needed as the numbers wrap around past 9. Hex is the same thing except you count from 0 to 15 in each individual space and since we only have numeral symbols for 0-9 defined, in hex we use letters to represent values of 10,11,12,13,14 and 15 (A, B, C, D, E and F). The biggie base for computers is of course binary, base 2, where you only have 0 and 1 to count with.

Having said that even my programmer brain is hardwired for base 10 and beyond doing simple conversions of 8-bit color component values I generally just convert to decimal, do math and convert back if manually dealing with hex value. Base 2 math I can do more effectively in my head but the process looks more like logic tables than your usual arithmetic, which is exactly the point of it.

I have no idea what the guy meant by “difference of 7.” Some of those hackers are pretty smart, but communication’s not their strong suit.

Well all I can say to that piece of ridiculous stereotyping is “wh32cad%%@ a342clw 9$29ars!”

;)

For getting it done intuitively and quickly in your head, I find it useful to break hex values into twos (or sometimes fours), since 0-255 is easy to work with, (2^8 being a familiar number and such). Makes the math go a lot quicker in your head. It’s what people usually do when dealing with logic circuits or computers running on assembly as well, because it becomes easier to break down into binary group by group. Or you could just convert, I guess, but sometimes that’s a hassle.

Oh, I agree about 0-255 which is why I mentioned that with 8-bit color components I’ll just do things in my head. In any case 99.9999% of the time I’m dealing with hex I’m sitting at the computer with an IDE open so I just use the computer to convert and/or calculate for me by tossing together a one-liner C program ala:

printf(“0x%x”, 0x0000DCAF - 0x0000DCA0);

and running it.

Just look for the magic code 0xDEADBEEF.

Actually, he’s communicating perfectly :-) You just don’t know hexadecimal math!

Here’s his text:

Why are those two the ones we’re looking for?

Well, let’s actually subtract the second number from the first number for each row:

0x0000EFE7 minus 0x0000EFE0 = 7 decimal (just look at the last digit, and it becomes pretty clear!)

0x0000EFAF minus 0x0000EFAC = 3 (again, look at the last digit: F = 15, C = 12)

0x0000EFA7 minus 0x0000EFA0 = 7 (same as the first line above)

0x0000EFAB minus 0x0000EFA8 = 3 (last digit-o-rama: B = 11)

0x0000EF9F minus 0x0000EF90 = 15 (ditto; F = 15)

0x0000E8FF minus 0x0000E800 = FF hex = 255 decimal

See, was that hard? And you can also see that the dude was being quite clear, given the assumption that the reader understands hex math.

Or 0xCAFEBABE

0xfeedface is my favorite.

0xDEADD00D

0xDEADBEEF

Nice. 0xFEEDFACEDEADBEEFCAFEBABE.

It’s just crying out for a web site. What’s the longest sentence you can write in pure hex?

It’s a shame nothing looks like U, then we could have 0xBUFFA10BUFFA10BUFFA10BUFFA10BUFFA10BUFFA10BUFFA10BUFFA10.