Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Programming (https://postpacific.mmorpg-game.online/forumdisplay.php?f=38)
-   -   (ASM) Assembly Tutorials (https://postpacific.mmorpg-game.online/showthread.php?t=4406)

Digital 13.05.2006 13:09

(ASM) Assembly Tutorials
 
all thanks to retart513

Ok. I have my own tutorial aren't i l33t.

Binary System:

Pre-Info:
A base of 2 Numeric System 0's 1's. May seem hard to understand but it is very use once you catch on. If you have went to school and think you understood Decimal good, Then lets do some converting from Binary to Decimal.

Converting Binary:
I am going to show you how to convert Decimal to Binary and Binary to Decimal.

Convert Binary to Decimal:
Systax: "Value x 2 ^ Position"[list=1][*]Value = Number converting[*]x = Multiplication[*]2 = Binary Base[*]^ = Exponent[*]Position = Position in the whole number you are converting(Right To Left)[/list=1]
Convert:
1 x 2 ^ 0 = 1
1 x 2 ^ 1 = 2
0 x 2 ^ 2 = 0
0 x 2 ^ 3 = 0
1 x 2 ^ 4 = 16

Steps To Converting:
Write the number down from Right to Left.
Multiply each single number by the Binary Base(2).
Then to the power (^) of its Position.
Take the final numbers from each Position and add them.
Answer:
The answer for this should 19. If it is not then you have done something wrong.
11001 or 10011
1 + 2 + 0 + 0 + 16 = 19 In Decimal.

Convert Decimal to Binary:
Systax: "Value / 2 Remainder"[list=1][*]Value = Starting Number to Convert.[*]/ = Division.[*]Remainder = The Remainder(lol).[/list=1]
Convert:
238 / 2 Remainder: 0
119 / 2 Remainder: 1
59 / 2 Remainder: 1
29 / 2 Remainder: 1
14 / 2 Remainder: 0
7 / 2 Remainder: 1
3 / 2 Remainder: 1
1 / 2 Remainder: 1
0 / 2 Remainder: 0
Steps To Converting:[list=1][*]Divide the Original number by 2, If it divides evenly the Remainder will be 0.[*]Divide the answer from the previous calculation by 2.[*]If it wont Divide evenly the Remainder will be 1.[*]Round the number from the previous calculation DOWN, And divide it by 2.[*]Repeat this process until you get to 0.[/list=1]
Answer:
The final answer should be "011101110", As you may notice how the answer given is missing the 1st 0.
That's because just like in Decimal, they have no value and can be omitted, So 045 is same as 45.

Additional things about Binary:
Usually 1 represents true, and 0 represents false.
When writing Binary, keep the number in multiples of 4.
EX 1: "0000:0000" without the ':'.
EX: Don't write 11001 this is incorrect, change it to 00011001, And remember that the zero's in front are not worth anything.
Usually you add a 'b' after the number to signal the fact that it is a Binary number.
EX: 00011001 = 00011001b.

HexaDecimal System

Some newbie's tend to be scared of this one, But trust me it's so easy(If you understood the Binary).

Pre-Info:
HexaDecimal is a Base of 16(What a great number very useful).
It is made of 10 Numbers and 6 Letters These are from A-F or 10-16. The reason being this is that computer's are built to use multiples of 2.
So HexaDecimal System has been useful to computers and can be to you if you learn it.

Next I have a table for you learn, but it is best memorize it. Consider this a computer's "Multiplication
Table's". All the answers are here but you must do the math.

Code:
Hexadecimal |=| Decimal |=| Binary
0h |=| 0d |=| 0000b
1h |=| 1d |=| 0001b
2h |=| 2d |=| 0010b
3h |=| 3d |=| 0011b
4h |=| 4d |=| 0100b
5h |=| 5d |=| 0101b
6h |=| 6d |=| 0110b
7h |=| 7d |=| 0111b
8h |=| 8d |=| 1000b
9h |=| 9d |=| 1001b
Ah |=| 10d |=| 1010b
Bh |=| 11d |=| 1011b
Ch |=| 12d |=| 1100b
Dh |=| 13d |=| 1101b
Eh |=| 14d |=| 1110b
Fh |=| 15d |=| 1111bThe Letters after each Number stand for:
h = Hexadecimal
d = Decimal
b = Binary
Converting Hexadecimal:
There are many ways to convert Hexadecimal, but I will only be covering two of them.

Convert Hexadecimal to Decimal:
Systax: "Value x 16 ^ Position"
Value = Value of the number you are converting.
x = Multiply
16 = Hexadecimal Base
^ = Exponent
Position = Position in the whole number you are converting.
Convert:
F x 16 ^ 0 = 15 x 1 = 15
4 x 16 ^ 1 = 4 x 16 = 64
A x 16 ^ 2 = 10 x 256 = 2560
2 x 16 ^ 3 = 2 x 4096 = 8192
Answer: 10831
Steps To Converting:
Write the number down from Right to Left.
Multiply the number by the Hexadecimal Base(16)
Then to the power of it's Position

Convert Decimal to Hexadecimal:
Systax 1: "Value / 16"
Systax 1:
Value = Whole Number
/ = Divide
16 = The base of Hexadecimal
Systax 2: "Value x 16"
Systax 2:
Value = Whole Number
x = Multiply
16 = The base of Hexadecimal
Systax 3: "Number - Value"
Systax 3:
Number = Number left from Systax 2
- = Subtact
Convert:
A
1324 / 16 = xx.xx
82 x 16 = 1312
1324 - 1312 = 12
Converted to Hexadecimal: C
B
82 / 16 = 5.125
5 x 16 = 80
82 - 80 = 2
Converted to Hexadecimal: 2
C
5 / 16 = 0.3125
0 x 16 = 0
5 - 0 = 5
Converted to Hexadecimal: 5
Steps To Converting:
A
Systax 1a: Divide The whole number with the Hexadecimal Base(16).
Systax 1b: Multiply what you have left from Systax 1a by the Hexadecimal Base(16).
Systax 1c: Subtact The number from Systax 1b From the whole number.
B
Take the number you got from Systax 1a.
Systax 2a: Divide this number with the Hexadecimal Base(16).
Systax 2b: Multiply what you have left from Systax 2a by the Hexadecimal Base(16).
Systax 2c: Subtact The number from Systax 1a from Systax 2b.
C
Take the number you got from Systax2a.
Systax 3a: Divide this number with the Hexadecimal Base(16).
Systax 3b: Multiply what you have left from Systax 3a by the Hexadecimal Base(16).
Systax 3c: Subtact The number from Systax 2a from Systax 3b.

Answer: 52C

Additional things about Hexidecimal:
Keep Hexidecimal numbers in multiples of 4, adding zeros as necessary
Study it for days
Don't give up

I'm Done
Ok. my hands are tried hopefully you have learned something from this tutorial.
Edit: Hopefully I got and the typos.
- RetarT -

Digital 13.05.2006 13:09

Assembly Registers Tutorial.
Everyone takes one look at Assembly and get scared because its looks so hard compared to VB, C and C++.
If you look closer at Assembly it is very close to c++, but smaller, faster and compact(not as much to learn also).
In this Tutorial i'm going to show you the basic's of Assembly Registers.

Registers
There are many Registers for Assembly. I will be explaining the common and useful ones.

Segment Registers
These types of Registers are for storing Data, Code and Video information few other things to.
CS FullName:Code Segment - Used to store a Code Segment.
DS FullName:Data Segment - Used to store a Data Segment.
SS FullName:Stack Segment - Used to point to an active Stack Segment.
ES FullName:Extra Segment - Commonly used in video, can be used for other things.
Be careful when using these Registers you could damage you computer.

Index Registers
The common use for these is strings and arrays.
SI FullName:Source Index - Used by String Operations as a Source.
DI FullName:Destination Index - Used by String Operations as the Destination.
IP FullName:Instruction Pointer - Stores the address to the next instruction, Also considered to be a Pointer Register

General Purpose Registers
This set of Registers are used for the common things done in all programming.
AX FullName:Accumulator Register - Used mostly for math(+,- and /,*), Data Input and Output.
BX FullName:Base Register - Used as a Base or Pointer to an index.
CX FullName:Count Register - Used to count like "++" in C/C++.
DX FullName:Data Register - Used to hold data, offsets and for Character Output.
All of these Registers Have a Low and High bit Order .
AL-AH = AX
BL-BH = BX
CL-CH = CX
DL-DH = DX
One more thing they have is Extended 32-Bit Extensions.

Code:
=========================================
| EAX = EBX = ECX = EDX |
| ||| = ||| = ||| = ||| |
=========================================
| AH | AL | BH | BL | CH | CL | DH | DL |
=========================================
| AX | BX | CX | DX |
=========================================

Pointer Registers
This set of Registers are used for Stack Operations.
SP FullName:Stack Pointer - An instruction that points to the offset the Stack is using.
BP FullName:Base Pointer - Used to pass Data to and from the Stack.


DONE
Next will be "Assembly Memory Segmentation, Indentifiers and Statements".
- RetarT -

Digital 13.05.2006 13:12

seems like the next post was erased :S
but what the heck.. this book would save ya..
4.2mb pdf file just download it ;)
http://www.planetpdf.com/developer/a...ContentID=6633

TheOrder 13.05.2006 14:44

Woooot Tnx Digi !!!

Aikeleer 13.05.2006 16:00

Digital, I want to have your babies. <3 u long time

Virexor 13.05.2006 20:33

thx digi, this is what i was looking for ^^ lol that PDF 1426 pages xD

watcher 13.05.2006 21:03

my 2 cents, but on russian XD


All times are GMT. The time now is 22:24.