P
phickman
Hi all.
After several searches using Google, I had just about given up on
finding a way to clear the console Window. After spending the past
week learning assembly language and writing a small boot loader for an
OS, I came across code to clear the console. It works. However, I post
it here to get opinions on using this. I have tested it in Windows but
not yet on Linux (I am assuming that it will work the same as it calls
the BIOS video service).
void clear_screen()
{
/* BIOS service routine to clear console window. */
asm("mov $0x00, %ah\n\t"
"mov $0x03, %al\n\t"
"int $0x10");
}
I compiled this using the DJGPP compiler, and have also added it to my
source code collection for NASM. Because of DJGPP being a DOS port of
GCC, am I right in assuming that it will also work in Linux?
The main reason I have created this routine is because I am currently
writing my kernel in C (the kernel I have written in ASM is becoming
too long and too complex too quickly). My next step is to figure out
how to write my own "printf" routine using only video memory and BIOS
calls.
Any comments/suggestions/criticisms are greatly appreciated.
TIA.
After several searches using Google, I had just about given up on
finding a way to clear the console Window. After spending the past
week learning assembly language and writing a small boot loader for an
OS, I came across code to clear the console. It works. However, I post
it here to get opinions on using this. I have tested it in Windows but
not yet on Linux (I am assuming that it will work the same as it calls
the BIOS video service).
void clear_screen()
{
/* BIOS service routine to clear console window. */
asm("mov $0x00, %ah\n\t"
"mov $0x03, %al\n\t"
"int $0x10");
}
I compiled this using the DJGPP compiler, and have also added it to my
source code collection for NASM. Because of DJGPP being a DOS port of
GCC, am I right in assuming that it will also work in Linux?
The main reason I have created this routine is because I am currently
writing my kernel in C (the kernel I have written in ASM is becoming
too long and too complex too quickly). My next step is to figure out
how to write my own "printf" routine using only video memory and BIOS
calls.
Any comments/suggestions/criticisms are greatly appreciated.
TIA.