Created
October 3, 2015 14:44
-
-
Save msikma/505c761ceb18b51861ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (C) 2015, Michiel Sikma <[email protected]> | |
| * MIT License | |
| */ | |
| #include "video.h" | |
| byte *VGA = (byte *)0xA0000; // Pointer to the video memory. | |
| word *SYS_CLOCK = (word *)0x046C; // The 18.2hz internal clock. | |
| /** | |
| * Writes a single pixel directly to the video memory. | |
| */ | |
| void plot_pixel(int x, int y, byte color) | |
| { | |
| VGA[(y << 8) + (y << 6) + x] = color; | |
| } | |
| /** | |
| * Sets the VGA mode. | |
| */ | |
| void set_mode(byte mode) | |
| { | |
| union REGS regs; | |
| regs.h.ah = SET_MODE; | |
| regs.h.al = mode; | |
| int86(VIDEO_INT, ®s, ®s); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment