Created
February 16, 2020 15:03
-
-
Save ske2004/5e58e59d03260354b19501f20fc378d1 to your computer and use it in GitHub Desktop.
My os
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
#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