Finished 02_driver: Moved X to VGA Location.

This commit is contained in:
Jonathan Turner 2023-09-14 10:49:49 -04:00
parent 3a3be79bae
commit ccd9c75f8e
5 changed files with 4 additions and 4 deletions

BIN
Part2/.DS_Store vendored

Binary file not shown.

BIN
Part2/A4/.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -9,11 +9,11 @@ void _start() {
position = position << 8; /* high byte */ position = position << 8; /* high byte */
port_byte_out(0x3d4, 15); /* requesting low byte */ port_byte_out(0x3d4, 15); /* requesting low byte */
position += port_byte_in(0x3d5); position += port_byte_in(0x3d5) + 250;
/* VGA 'cells' consist of the character and its control data /* VGA 'cells' consist of the character and its control data
* e.g. 'white on black background', 'red text on white bg', etc */ * e.g. 'white on black background', 'red text on white bg', etc */
int offset_from_vga = position * 2.3; int offset_from_vga = position * 2;
/* Now you can examine both variables using gdb, since we still /* Now you can examine both variables using gdb, since we still
* don't know how to print strings on screen. Run 'make debug' and * don't know how to print strings on screen. Run 'make debug' and
@ -27,6 +27,6 @@ void _start() {
/* Let's write on the current cursor position, we already know how /* Let's write on the current cursor position, we already know how
* to do that */ * to do that */
char *vga = (char *) 0xb8000; char *vga = (char *) 0xb8000;
vga[offset_from_vga+10] = 'X'; vga[offset_from_vga] = 'X';
vga[offset_from_vga+11] = 0x0f; /* White text on black background */ vga[offset_from_vga+1] = 0x0f; /* White text on black background */
} }

Binary file not shown.