mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2026-03-02 03:49:21 +00:00
Fixed warnings
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#define BACKSPACE 0x0E
|
||||
#define ENTER 0x1C
|
||||
|
||||
static char key_buffer[256];
|
||||
|
||||
#define SC_MAX 57
|
||||
const char *sc_name[] = { "ERROR", "Esc", "1", "2", "3", "4", "5", "6",
|
||||
"7", "8", "9", "0", "-", "=", "Backspace", "Tab", "Q", "W", "E",
|
||||
@@ -21,7 +23,7 @@ const char sc_ascii[] = { '?', '?', '1', '2', '3', '4', '5', '6',
|
||||
'H', 'J', 'K', 'L', ';', '\'', '`', '?', '\\', 'Z', 'X', 'C', 'V',
|
||||
'B', 'N', 'M', ',', '.', '/', '?', '?', '?', ' '};
|
||||
|
||||
static void keyboard_callback(registers_t regs) {
|
||||
static void keyboard_callback() {
|
||||
/* The PIC leaves us the scancode in port 0x60 */
|
||||
u8 scancode = port_byte_in(0x60);
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "../cpu/types.h"
|
||||
|
||||
static char key_buffer[256];
|
||||
|
||||
void init_keyboard();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "screen.h"
|
||||
#include "../cpu/ports.h"
|
||||
#include "../libc/mem.h"
|
||||
|
||||
/* Declaration of private functions */
|
||||
int get_cursor_offset();
|
||||
@@ -64,7 +65,7 @@ void kprint_backspace() {
|
||||
* Sets the video cursor to the returned offset
|
||||
*/
|
||||
int print_char(char c, int col, int row, char attr) {
|
||||
unsigned char *vidmem = (unsigned char*) VIDEO_ADDRESS;
|
||||
u8 *vidmem = (u8*) VIDEO_ADDRESS;
|
||||
if (!attr) attr = WHITE_ON_BLACK;
|
||||
|
||||
/* Error control: print a red 'E' if the coords aren't right */
|
||||
@@ -94,12 +95,12 @@ int print_char(char c, int col, int row, char attr) {
|
||||
if (offset >= MAX_ROWS * MAX_COLS * 2) {
|
||||
int i;
|
||||
for (i = 1; i < MAX_ROWS; i++)
|
||||
memory_copy(get_offset(0, i) + VIDEO_ADDRESS,
|
||||
get_offset(0, i-1) + VIDEO_ADDRESS,
|
||||
memory_copy((u8*)(get_offset(0, i) + VIDEO_ADDRESS),
|
||||
(u8*)(get_offset(0, i-1) + VIDEO_ADDRESS),
|
||||
MAX_COLS * 2);
|
||||
|
||||
/* Blank last line */
|
||||
char *last_line = get_offset(0, MAX_ROWS-1) + VIDEO_ADDRESS;
|
||||
char *last_line = (char*) (get_offset(0, MAX_ROWS-1) + (u8*) VIDEO_ADDRESS);
|
||||
for (i = 0; i < MAX_COLS * 2; i++) last_line[i] = 0;
|
||||
|
||||
offset -= 2 * MAX_COLS;
|
||||
@@ -125,15 +126,15 @@ void set_cursor_offset(int offset) {
|
||||
/* Similar to get_cursor_offset, but instead of reading we write data */
|
||||
offset /= 2;
|
||||
port_byte_out(REG_SCREEN_CTRL, 14);
|
||||
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset >> 8));
|
||||
port_byte_out(REG_SCREEN_DATA, (u8)(offset >> 8));
|
||||
port_byte_out(REG_SCREEN_CTRL, 15);
|
||||
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset & 0xff));
|
||||
port_byte_out(REG_SCREEN_DATA, (u8)(offset & 0xff));
|
||||
}
|
||||
|
||||
void clear_screen() {
|
||||
int screen_size = MAX_COLS * MAX_ROWS;
|
||||
int i;
|
||||
char *screen = VIDEO_ADDRESS;
|
||||
u8 *screen = (u8*) VIDEO_ADDRESS;
|
||||
|
||||
for (i = 0; i < screen_size; i++) {
|
||||
screen[i*2] = ' ';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef SCREEN_H
|
||||
#define SCREEN_H
|
||||
|
||||
#include "../cpu/types.h"
|
||||
|
||||
#define VIDEO_ADDRESS 0xb8000
|
||||
#define MAX_ROWS 25
|
||||
#define MAX_COLS 80
|
||||
|
||||
Reference in New Issue
Block a user