Skip to content

Instantly share code, notes, and snippets.

@skejeton
Created February 16, 2020 15:03
Show Gist options
  • Save skejeton/5e58e59d03260354b19501f20fc378d1 to your computer and use it in GitHub Desktop.
Save skejeton/5e58e59d03260354b19501f20fc378d1 to your computer and use it in GitHub Desktop.
My os
#define VGA_SCR_WIDTH 80
#define VGA_SCR_HEIGHT 25
short* VGA_PTR = (short*)0xb8000;
void printvmem(const char* str, char color, short offset)
{
int i = 0;
while(str[i] != 0)
{
VGA_PTR[i+offset] = (color << 8) | str[i];
++i;
}
}
// TODO: CHANGE THIS
void cleanscr(char color)
{
printvmem(" ", color, 0);
}
void sleep(short millis)
{
for (int i = 0; i < millis * 100000; ++i) {}
}
extern void kmain()
{
const short str_l = 39;
short offset = 0;
const char* hello = "WELCOME TO ISHIDEX2'S OPERATING SYSTEM!";
while (1)
{
cleanscr(0x33);
printvmem(hello, 0x12, offset);
if (offset > (2000-str_l))
{
offset = 0;
}
offset += 1;
sleep(100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment