Difference between revisions of "Fundamentals"

From SkullSecurity
Jump to navigation Jump to search
(New page: This page is going to be about the fundamentals that you have to understand before you can make any sense out of assembly. Most of this stuff you'll learn if you learn to program in C. If ...)
 
Line 1: Line 1:
This page is going to be about the fundamentals that you have to understand before you can make any sense out of assembly. Most of this stuff you'll learn if you learn to program in C. If this is old or boring stuff to you, feel free to skip this section entirely.  
This page is going to be about the fundamentals that you have to understand before you can make any sense out of assembly. Most of this stuff you'll learn if you learn to program in C. If this is old or boring stuff to you, feel free to skip this section entirely.  
The topics here are going to be a short overview of each section. If you want a more complete explanation, you should find an actual reference, or look it up on the Internet. This is only meant to be a quick and dirty primer.


== Hexadecimal ==
== Hexadecimal ==
To work in assembly, you have to be able to read hexadecimal fairly comfortably. Converting to decimal in your mind isn't necessary, but being able to do some simple arithmetic is.
Hex can be denoted in a number of ways, but the two most common are:
* Prefixed with a 0x, eg. 0x1ef7
* Postfixed with a h, eg. 1ef7h
The characters 0 - f represent the decimal numbers 0 - 15:
* 0 = 0
* 1 = 1
* ...
* 9 = 9
* a = 10
* b = 11
* c = 12
* d = 13
* e = 14
* f = 15
To convert from hex to decimal, multiply each digit, starting with the right-most, with 16<sup>0</sup>, 16<sup>1</sup>, 16<sup>2</sup>, etc. So in the example of 0x1ef7, the conversion is this:
* (7 * 16<sup>0</sup>) + (f * 16<sup>1</sup>) + (e * 16<sup>2</sup>) + (1 * 16<sup>3</sup>)
* = (7 * 16<sup>0</sup>) + (15 * 16<sup>1</sup>) + (14 * 16<sup>2</sup>) + (1 * 16<sup>3</sup>)
* = (7 * 1) + (15 * 16) + (14 * 256) + (1 * 4096)
* = 7 + 240 + 3584 + 4096
* = 7927
It isn't necessary to do that constantly, that's why we have calculators. But you should be fairly familiar with the numbers 00 - FF (0 - 255), they will come up often and you will spend a lot of time looking them up.


== Datatypes ==
== Datatypes ==

Revision as of 18:47, 11 March 2007

This page is going to be about the fundamentals that you have to understand before you can make any sense out of assembly. Most of this stuff you'll learn if you learn to program in C. If this is old or boring stuff to you, feel free to skip this section entirely.

The topics here are going to be a short overview of each section. If you want a more complete explanation, you should find an actual reference, or look it up on the Internet. This is only meant to be a quick and dirty primer.

Hexadecimal

To work in assembly, you have to be able to read hexadecimal fairly comfortably. Converting to decimal in your mind isn't necessary, but being able to do some simple arithmetic is.

Hex can be denoted in a number of ways, but the two most common are:

  • Prefixed with a 0x, eg. 0x1ef7
  • Postfixed with a h, eg. 1ef7h

The characters 0 - f represent the decimal numbers 0 - 15:

  • 0 = 0
  • 1 = 1
  • ...
  • 9 = 9
  • a = 10
  • b = 11
  • c = 12
  • d = 13
  • e = 14
  • f = 15

To convert from hex to decimal, multiply each digit, starting with the right-most, with 160, 161, 162, etc. So in the example of 0x1ef7, the conversion is this:

  • (7 * 160) + (f * 161) + (e * 162) + (1 * 163)
  • = (7 * 160) + (15 * 161) + (14 * 162) + (1 * 163)
  • = (7 * 1) + (15 * 16) + (14 * 256) + (1 * 4096)
  • = 7 + 240 + 3584 + 4096
  • = 7927

It isn't necessary to do that constantly, that's why we have calculators. But you should be fairly familiar with the numbers 00 - FF (0 - 255), they will come up often and you will spend a lot of time looking them up.

Datatypes

- Bits

Memory

Pointers

Ascii

Arrays

Strings

Questions

Feel free to edit this section and post questions, I'll do my best to answer them. But you may need to contact me to let me know that a question exists.