From b2fa069ddfdfd1127ec73f2e48ddc2294fc501c0 Mon Sep 17 00:00:00 2001 From: Simon Fortier Date: Mon, 13 Nov 2017 11:24:56 -0500 Subject: [PATCH] Fixed links --- Basic-Assembly-tutorial.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Basic-Assembly-tutorial.md b/Basic-Assembly-tutorial.md index 5ab327c..d22a22b 100644 --- a/Basic-Assembly-tutorial.md +++ b/Basic-Assembly-tutorial.md @@ -8,7 +8,7 @@ For example, `0000 0101` is a 8-bit number (also called a **byte**) and `0000 00 A number can be represented in a lot of different ways: `0101` is base-2 is the same number as `5` in base-10 and `0x5` in base-16. You don't really *convert* a binary number to a decimal number, you just change the way it is represented. -Let's take a look at this number representation table for [unsigned](https://github.com/simon987/Much-Assembly-Required-3/wiki/Basic-Assembly-tutorial#number-representation---negative-numbers) 4-bit numbers: +Let's take a look at this number representation table for [unsigned](https://github.com/simon987/Much-Assembly-Required/wiki/Basic-Assembly-tutorial#number-representation---negative-numbers) 4-bit numbers: | base-16 | base-2 | base-10 | | ------- | ------ | ------- | @@ -42,7 +42,7 @@ Here is a short list of common data types: | Names | Size (bits) | range | | ----- | ----------- | ----- | -| [Boolean](https://github.com/simon987/Much-Assembly-Required-3/wiki/Basic-Assembly-tutorial#booleans-and-boolean-logic) | 1 | `0` to `1` | +| [Boolean](https://github.com/simon987/Much-Assembly-Required/wiki/Basic-Assembly-tutorial#booleans-and-boolean-logic) | 1 | `0` to `1` | | Byte, char, octet (Signed) | 8 | `-128` to `127`| | Byte, char, octet (Unsigned) | 8 | `0` to `255`| | Word, short (Signed) | 16 | `−32768` to `32767`| @@ -52,7 +52,7 @@ Here is a short list of common data types: ### Number representation - Negative numbers? We have seen how positive numbers are represented in binary, now let's take a look at how negative numbers are represented. -The processor uses the most significant (leftmost, also called the sign bit) bit of a number to indicate the sign: 0 for positive numbers and 1 for negative numbers. To negate a number, we use the **two's complement** operation: we 'flip' each bit (0 becomes 1 and 1 becomes 0, this is what we call a logical NOT) and add 1 (See [Binary arithmetic](https://github.com/simon987/Much-Assembly-Required-3/wiki/Basic-Assembly-tutorial#binary-arithmetic) for more information). +The processor uses the most significant (leftmost, also called the sign bit) bit of a number to indicate the sign: 0 for positive numbers and 1 for negative numbers. To negate a number, we use the **two's complement** operation: we 'flip' each bit (0 becomes 1 and 1 becomes 0, this is what we call a logical NOT) and add 1 (See [Binary arithmetic](https://github.com/simon987/Much-Assembly-Required/wiki/Basic-Assembly-tutorial#binary-arithmetic) for more information). Let's take the number 5 for example (16-bit): ``` @@ -73,7 +73,7 @@ It is quite simple to add two binary numbers together using the **carry** method 1 + 1 = 0, carry 1 ``` -When the value of a bit exceeds 1, the excess needs to be **carried out** of this bit **into** the left bit (This is an important concept for the [overflow and carry flags](https://github.com/simon987/Much-Assembly-Required-3/wiki/Central-processing-unit-(CPU)#the-flags-register) later on in the tutorial) +When the value of a bit exceeds 1, the excess needs to be **carried out** of this bit **into** the left bit (This is an important concept for the [overflow and carry flags](https://github.com/simon987/Much-Assembly-Required/wiki/Central-processing-unit-(CPU)#the-flags-register) later on in the tutorial) So a 16-bit addition in the CPU looks like this: ``` @@ -231,7 +231,7 @@ Using the `objdump` command on Linux, the machine code is translated human-reada ``` The machine code produced by the C compiler can be directly translated to assembly language: `00b8 0000` becomes `mov eax, 0` and `c3` becomes `ret`. We will see what these instructions do very soon. The compilation process varies greatly from language to language, but the end result must be understandable by the CPU. The instructions (machine code numbers) that the CPU can understand vary depending on the CPU's **instruction set**. Most modern consumer processors use the x86-64 (or amd64) instruction set. -The [game's CPU](https://github.com/simon987/Much-Assembly-Required-3/wiki/Central-processing-unit-(CPU)) is based on the Intel 8086 processor (x86-16 instruction set) +The [game's CPU](https://github.com/simon987/Much-Assembly-Required/wiki/Central-processing-unit-(CPU)) is based on the Intel 8086 processor (x86-16 instruction set) **So, what does a *32-bit* processor mean?** A 32-bit processor will handle data in 32-bit chunks, and do its calculations with 32-bit numbers. Intel x86 processors are backward compatible, meaning that a 32-bit processor can handle data and do its calculations with 16-bit and 8-bit numbers (That is why the `DWORD PTR` directive is required at offset 4 and b in the previous example: we are telling the CPU that we want to deal with 32-bit numbers (double word) for this instruction). @@ -290,7 +290,7 @@ A register operand is the name of a register. only the following registers can b **Memory Operand:** A memory operand is a memory address in between square brackets. An immediate value or a register can be used to specify the address. The following memory operands are *valid*: `[12], [0xFFFE], [-3], [A], [BP], [label_name]`. You can also specify a register with a displacement value: `[A + 3], [BP-4], [X + label_name]` -Take a moment familiarize yourself with [the various instructions available](https://github.com/simon987/Much-Assembly-Required-3/wiki/Instruction-set). +Take a moment familiarize yourself with [the various instructions available](https://github.com/simon987/Much-Assembly-Required/wiki/Instruction-set). Let's quickly observe some more complex instructions before moving to the next section. **MOV** @@ -360,7 +360,7 @@ Conditional jumps are instructions that only change the IP if a condition is met | JNZ | Jump if not zero | `ZF = 0`| | JZ | Jump if zero | `ZF = 1`| -You can read the FLAGS section on the [CPU page](https://github.com/simon987/Much-Assembly-Required-3/wiki/Central-processing-unit-(CPU)#the-flags-register) to know exactly in which condition the flags are set. +You can read the FLAGS section on the [CPU page](https://github.com/simon987/Much-Assembly-Required/wiki/Central-processing-unit-(CPU)#the-flags-register) to know exactly in which condition the flags are set. Let's say that we wanted to check if the value of the register A was equal to 5, we could do this: ```assembly