Well, I guess teaching the basics through a board is going to be a bit work... :wink:
But well, Skillster has posted the basic basic :wink: . If u understand that, what he posted, it's a good beginning. I'm postin' some values that you will have often to do with: (I store them as Bytes, means a 2 digit hexadecimal number)
Hex Dec
00 Well, 0
0F 16
10 17
64 100
FF 255
Well, that's how the HEX-editors show the byte values. You should use a hex editor that can convert hex values into decimals and the other way. (I use Hexworks for this)(Ok, I mostly use Ultraedit, but it can't convert 'em)
- Alhexx
EDIT:
Wooo I've got a better view now. I just started playnig around with a hex-editor I downloaded (Hex Workshop) and opened some files. In an HTML file I understand that each two hex digits makes a text character. So would be 3C48 544D 4C3E? Heh, I havent memorized each charecter to each hex byte yet! I just copy and pasted that. Hmm, its starting to make more sense...
[This message has been edited by eerrrr (edited August 10, 2001).]
The hex format is basically just a way of representing data on the PC.
The hex format is a number format that has a base of 16.
If you don't understand what a base of 16 is, well then read on.
code:[/quote]
1
+1
--
2
--
This kind of addition is used in the base 10 system. Take notice of this:-code:[/quote]
1
+9
--
10
--
What has happened here? Since the biggest digit is 9, when I add 1 to it, the number "spills" over to the next possible placing making the total 10.So, now let's try changing things a little and moving to base 2, which means the largest number is 1.
code:[/quote]
1
+1
--
10
--
Eh? That wasn't what they taught me in primary school? I thought 1 + 1 is 2?
Actually this works the same way the 9 + 1 example worked for base 10. For base 10 the largest digit was 9 so the "spill-over" only occurs at when you add 1 or more to 9. For base 2 however, the largest digit is 1 so the "spill-over" happens immediately.
Understood? If yes, then let's continue on.Now what happens if I decide to use base 16?
The maximum digit would be 15 wouldn't it? Now you come across a problem, how can you tell if 215 really means
215 or does it mean 21 as the first digit and 5 as the second?
That's why the hex system was created.
In the hex system, the numbers go like this:-
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Using this system a single character can represent 16 different numbers
1 represents 1
2 represents 2
3 represents 3
.
.
.
A represents 10
B represents 11
.
.
.
F represents 15
So, in a hex editor, you will find that hex numbers are grouped in 2 digits at a time or maybe more(depends on your configuration). Each hex character can represent 16 different numbers so 2 hex character can represent 256 different numbers(16x16). So, it is directly possible to convert hex numbers into decimal(base 10) numbers.Now, when you look into a file using a hex editor like Hex workshop, the address's(offsets) appear on the far left. The hex numbers appear in the center and the ASCII representation appear on the right. You don't really have memorize what each hex number represents. The ASCII format is only certain "mask" applied onto the hex numbers. Earlier, I told you that the hex number F can represent 15 right? Using the same method, the hex number 3C should give you 60 decimal. If I were to apply an ASCII mask, the hex number 3C would represent "<"
See where I'm getting? ASCII is only one method of using hex numbers to represent the data. There are probably millions of methods of using hex numbers to represent things. Hence, we take such a long time to figure out FF7's file formats.
SaiNt: Interesting lesson - but you're right.
- Alhexx
- edit -
Oopps, just have to correct sth. from my first post:
Hex Dec
0F 15
10 16
Thanx to you, SaiNt!
[This message has been edited by Alhexx (edited August 10, 2001).]
OH wait....
**************************
3C
if C=12
same as
3(12)
The first number means 3x16 and the bracket number is to be added
....if it was algerbra it would be {3y+12=x ; y=16} or {3(16)+12=x}
so I caculate the first number by:
3 x (16 base) = 48
48(12)
then add the non bracket number by the bracket number
48+12 = 60
************************
But FF = 255?
*****************
calculations:
F=15
15 x (base 16) = 240
240+15=255
****************
so what is 256?
I guess zero is considered a number.....
16x16=256, but FF=255 (nothing should be higher than F in your Base 16, thingy)
...only way that you can say that base 16 has 256 values in it, is to say that zero is a value itself......no wonder this is so confusing!
[This message has been edited by Clone5 (edited August 11, 2001).]
Each hex base number has a unique 4 bit value in binary. Since there are only 16 possible combinations for a 4 bit binary segment, once you know which 4 bit segment equals which hex base number, converting between the two is extremely simple.
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = A
1011 = B
1100 = C
1101 = D
1110 = E
1111 = F
Knowing that, you can take any hex number and convert it to binary:
E.g FAC7 = 1111101011000111
Converting from hex to binary is equally as easy:
E.g. 1001011010011011 can be split into 4 bit segments: 1001 0110 1001 1011 and then translated into hex by looking at the chart above: 969B
If a binary number DOESN'T split into all even 4 bit sections, such as 11 0101 1100, just add two as many zeros in front of the first segment to make it equal 4 bits: 0011 0101 1100, making that number 35C in hex.
eerrrr: Ehm, still alive? Or commited suicide :wink: ?
- Alhexx
Alhexx: I couldnt find Hexworks, so I ended up downloading Hex Workshop, and I downloaded UltrEdit I think, just haven't tried it yet. And yes, I just about survived all that.
Thanks everyone! :D :D :D
EDIT:
Why am I editing this? It's been quite a while since I posted it. Anyway, I decided to start learning VB. I found a pretty good site called VBWeb which has a good beginner's tutorial. But I dont have a program. I've got the Office 2000 VB prog but thats supposed to be crap. Does anyone know where I can download Visual Basic for free? Or am I gonna have to go buy it?
EDIT:
Oh dear. I found something which looks like Visual Basic on Morpheus, but it's 70MB. Hmm, maybe I can get it off my dad's friend cheap.
[This message has been edited by eerrrr (edited August 11, 2001).]
[This message has been edited by eerrrr (edited August 11, 2001).]