Skip to content

Instantly share code, notes, and snippets.

@msikma
Created October 3, 2015 14:44
Show Gist options
  • Save msikma/505c761ceb18b51861ed to your computer and use it in GitHub Desktop.
Save msikma/505c761ceb18b51861ed to your computer and use it in GitHub Desktop.
/*
* 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, &regs, &regs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment