cfenollosa_os-tutorial/15-video-ports
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 Lesson 18 2015-02-03 19:13:13 +01:00
drivers lesson 15, video ports 2014-10-21 22:54:03 +02:00
kernel lesson 15, video ports 2014-10-21 22:54:03 +02:00
Makefile Lesson 18 2015-02-03 19:12:51 +01:00
README.md Add Pandoc Support 2023-09-05 01:46:32 -06:00

Video: Ports

Concepts you may want to Google beforehand: I/O ports

Goal: Learn how to use the VGA card data ports

We will use C to communicate with devices via I/O registers and ports.

Open drivers/ports.c and examine the inline C assembler syntax. It has some differences, like the order of the source and destination operands, and the funny syntax to assign variables to operands.

When you understand the concepts, open kernel/kernel.c for an example of use.

In this example we will examine the I/O ports which map the screen cursor position. Specifically, we will query port 0x3d4 with value 14 to request the cursor position high byte, and the same port with 15 for the low byte.

When this port is queried, it saves the result in port 0x3d5

Don't miss the opportunity to use gdb to inspect the value of C variables, since we still can't print them on the screen. To do so, set a breakpoint for a specific line, breakpoint kernel.c:21 and use the print command to examine variables. Aren't you glad now that we invested some time in compiling the cross-compiled gdb? ;)

Finally, we will use the queried cursor position to write a character at that location.