mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
lesson 3, boot sector with memory addressing
This commit is contained in:
parent
cd53d86517
commit
0522ad727e
@ -6,12 +6,14 @@ and look at the figure with the memory layout.
|
|||||||
|
|
||||||
The only goal of this lesson is to learn where the boot sector is stored
|
The only goal of this lesson is to learn where the boot sector is stored
|
||||||
|
|
||||||
I could just go ahead and tell you that the BIOS places it at `0x7C00`, but an
|
I could just bluntly tell you that the BIOS places it at `0x7C00` and
|
||||||
example with wrong solutions will make things clearer.
|
get it done with, but an example with wrong solutions will make things clearer.
|
||||||
|
|
||||||
We want to print an X on screen. We will try 4 different strategies
|
We want to print an X on screen. We will try 4 different strategies
|
||||||
and see which ones work and why.
|
and see which ones work and why.
|
||||||
|
|
||||||
|
**Open the file `boot_sect_memory.asm`**
|
||||||
|
|
||||||
First, we will define the X as data, with a label:
|
First, we will define the X as data, with a label:
|
||||||
```nasm
|
```nasm
|
||||||
the_secret:
|
the_secret:
|
||||||
@ -33,7 +35,7 @@ the bytes following 1 and 2 are just random garbage.
|
|||||||
If you add or remove instructions, remember to compute the new offset of the X
|
If you add or remove instructions, remember to compute the new offset of the X
|
||||||
by counting the bytes, and replace `0x2d` with the new one.
|
by counting the bytes, and replace `0x2d` with the new one.
|
||||||
|
|
||||||
Please don't continue onto the next file unless you have 100% understood
|
Please don't continue onto the next section unless you have 100% understood
|
||||||
the boot sector offset and memory addressing.
|
the boot sector offset and memory addressing.
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ us define a "global offset" for every memory location, with the `org` command:
|
|||||||
[org 0x7c00]
|
[org 0x7c00]
|
||||||
```
|
```
|
||||||
|
|
||||||
Go ahead and open `boot_sect_memory_org.asm` and you will see the canonical
|
Go ahead and **open `boot_sect_memory_org.asm`** and you will see the canonical
|
||||||
way to print data with the boot sector, which is now attempt 2. Compile the code
|
way to print data with the boot sector, which is now attempt 2. Compile the code
|
||||||
and run it, and you will see how the `org` command affects each previous solution.
|
and run it, and you will see how the `org` command affects each previous solution.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user