cfenollosa_os-tutorial/06-bootsector-segmentation
Hennik Hunsaker 7d932d43b3 Add Pandoc Support
- Add a Pandoc defaults file
- Add a Pandoc template based on the default one
- Add chapter headers to each section

### Usage

To use, install Pandoc and ConTeXt, then simply run
`pandoc -d ./pandoc.yaml` from the repo root.

### Maintenance

When new chapters get added, the `pandoc.yaml` will need to be updated
to include each new chapter's markdown file(s).

### Miscellaneous Notes

- The PDF generated complies with PDF/A 1b:2005 by default.
- The PDF also contains the source markdown files as attachments
- All links are fully functional!
- Includes a table of contents! With links to each section!

### Conclusion

Enjoy!
2023-09-05 01:46:32 -06:00
..
boot_sect_segmentation.asm lesson 6, segmentation 2014-10-05 20:41:18 +02:00
README.md Add Pandoc Support 2023-09-05 01:46:32 -06:00

Bootsector: Segmentation

Concepts you may want to Google beforehand: segmentation

Goal: learn how to address memory with 16-bit real mode segmentation

If you are comfortable with segmentation, skip this lesson.

We did segmentation with [org] on lesson 3. Segmentation means that you can specify an offset to all the data you refer to.

This is done by using special registers: cs, ds, ss and es, for Code, Data, Stack and Extra (i.e. user-defined)

Beware: they are implicitly used by the CPU, so once you set some value for, say, ds, then all your memory access will be offset by ds. Read more here

Furthermore, to compute the real address we don't just join the two addresses, but we overlap them: segment << 4 + address. For example, if ds is 0x4d, then [0x20] actually refers to 0x4d0 + 0x20 = 0x4f0

Enough theory. Have a look at the code and play with it a bit.

Hint: We cannot mov literals to those registers, we have to use a general purpose register before.