You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
739 B
C++
35 lines
739 B
C++
unsigned char* buffer = (unsigned char*) 0xb8000;
|
|
|
|
|
|
char make_attribute ( char foreground ,
|
|
char background , char blink ) {
|
|
foreground &= 0 xf ; // ffff ffff -> 0000 ffff
|
|
background &= 0 x7 ; // bbbb bbbb -> 0000 0 bbb
|
|
blink &= 1; // BBBB BBBB -> 0000 000 B
|
|
background <<= 4; // 0000 0 bbb -> 0 bbb 0000
|
|
blink <<= 7; // 0000 000 B -> B000 0000
|
|
return foreground | background | blink ; // Bbbb ffff
|
|
}
|
|
|
|
int puts(const char *s){
|
|
for(int i=0; *(s+i) != 0; i++){
|
|
buffer[2*i] = *(s+i);
|
|
buffer[(2*i)+1] = 0x14;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void clear_display(void){
|
|
for(int i=0; i<(80*25); i++){
|
|
buffer[i] = 0;
|
|
}
|
|
}
|
|
|
|
void iterate(void){
|
|
for(int i=0; i<(80*25); i++){
|
|
buffer[2*i] = i%256;
|
|
buffer[1+(2*i)] = i%256;
|
|
}
|
|
}
|
|
|