mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
clear_screen should be a public API function.
Since clear_screen has been exposed in the header file, it should be a public API function rather then a private one.
This commit is contained in:
parent
7aff64740e
commit
6913e9cd75
@ -13,6 +13,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
char *screen = VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -104,18 +116,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
char *screen = VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
@ -14,6 +14,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
char *screen = VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -121,18 +133,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
char *screen = VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
@ -14,6 +14,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
char *screen = VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -121,18 +133,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
char *screen = VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
@ -13,6 +13,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
char *screen = VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -120,18 +132,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
char *screen = VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
@ -14,6 +14,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
u8 *screen = (u8*) VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -131,18 +143,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (u8)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (u8)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
u8 *screen = (u8*) VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
@ -14,6 +14,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
u8 *screen = (u8*) VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -131,18 +143,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (u8)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (u8)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
u8 *screen = (u8*) VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
@ -15,6 +15,18 @@ int get_offset_col(int offset);
|
|||||||
* Public Kernel API functions *
|
* Public Kernel API functions *
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
|
void clear_screen() {
|
||||||
|
int screen_size = MAX_COLS * MAX_ROWS;
|
||||||
|
int i;
|
||||||
|
uint8_t *screen = (uint8_t*) VIDEO_ADDRESS;
|
||||||
|
|
||||||
|
for (i = 0; i < screen_size; i++) {
|
||||||
|
screen[i*2] = ' ';
|
||||||
|
screen[i*2+1] = WHITE_ON_BLACK;
|
||||||
|
}
|
||||||
|
set_cursor_offset(get_offset(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message on the specified location
|
* Print a message on the specified location
|
||||||
* If col, row, are negative, we will use the current offset
|
* If col, row, are negative, we will use the current offset
|
||||||
@ -132,18 +144,6 @@ void set_cursor_offset(int offset) {
|
|||||||
port_byte_out(REG_SCREEN_DATA, (uint8_t)(offset & 0xff));
|
port_byte_out(REG_SCREEN_DATA, (uint8_t)(offset & 0xff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_screen() {
|
|
||||||
int screen_size = MAX_COLS * MAX_ROWS;
|
|
||||||
int i;
|
|
||||||
uint8_t *screen = (uint8_t*) VIDEO_ADDRESS;
|
|
||||||
|
|
||||||
for (i = 0; i < screen_size; i++) {
|
|
||||||
screen[i*2] = ' ';
|
|
||||||
screen[i*2+1] = WHITE_ON_BLACK;
|
|
||||||
}
|
|
||||||
set_cursor_offset(get_offset(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
int get_offset(int col, int row) { return 2 * (row * MAX_COLS + col); }
|
||||||
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
int get_offset_row(int offset) { return offset / (2 * MAX_COLS); }
|
||||||
|
Loading…
Reference in New Issue
Block a user