kern
diff src/vid.c @ 4:0489a34ab348
- reverted the trunk back to hardware scrolling
- added a missing include (ctype.h in term.c)
- added a comment explaining what memset16 does
- beefed up the README file
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 10 Dec 2010 03:44:34 +0200 |
parents | 86781ef20689 |
children | eaec918de072 |
line diff
1.1 --- a/src/vid.c Sat Dec 04 10:12:39 2010 +0200 1.2 +++ b/src/vid.c Fri Dec 10 03:44:34 2010 +0200 1.3 @@ -1,5 +1,3 @@ 1.4 -#if 0 1.5 - 1.6 #include <string.h> 1.7 #include "vid.h" 1.8 #include "asmops.h" 1.9 @@ -82,64 +80,3 @@ 1.10 outb(CRTC_START_HIGH, CRTC_ADDR); 1.11 outb((start_addr >> 8) & 0xff, CRTC_DATA); 1.12 } 1.13 -#endif /* 0 */ 1.14 - 1.15 -#include <string.h> 1.16 -#include "vid.h" 1.17 -#include "asmops.h" 1.18 - 1.19 -#define WIDTH 80 1.20 -#define HEIGHT 25 1.21 - 1.22 -/* CRTC ports */ 1.23 -#define CRTC_ADDR 0x3d4 1.24 -#define CRTC_DATA 0x3d5 1.25 - 1.26 -/* CRTC registers */ 1.27 -#define CRTC_CURSOR_HIGH 0xe 1.28 -#define CRTC_CURSOR_LOW 0xf 1.29 - 1.30 -/* construct a character with its attributes */ 1.31 -#define VMEM_CHAR(c, fg, bg) \ 1.32 - ((uint16_t)(c) | (((uint16_t)(fg) & 0xf) << 8) | \ 1.33 - (((uint16_t)(bg) & 0xf) << 12)) 1.34 - 1.35 -#define CLEAR_CHAR VMEM_CHAR(' ', LTGRAY, BLACK) 1.36 - 1.37 -/* pointer to the text mode video memory */ 1.38 -static uint16_t *vmem = (uint16_t*)0xb8000; 1.39 - 1.40 -void clear_scr(void) 1.41 -{ 1.42 - memset16(vmem, CLEAR_CHAR, WIDTH * HEIGHT); 1.43 -} 1.44 - 1.45 -void set_char(char c, int x, int y, int fg, int bg) 1.46 -{ 1.47 - vmem[y * WIDTH + x] = VMEM_CHAR(c, fg, bg); 1.48 -} 1.49 - 1.50 -void set_cursor(int x, int y) 1.51 -{ 1.52 - int loc; 1.53 - if(x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) { 1.54 - loc = 0xffff; 1.55 - } else { 1.56 - loc = y * WIDTH + x; 1.57 - } 1.58 - 1.59 - /* tell the vga where we want the cursor by writing 1.60 - * to the "cursor address" register of the CRTC */ 1.61 - outb(CRTC_CURSOR_LOW, CRTC_ADDR); 1.62 - outb(loc, CRTC_DATA); 1.63 - outb(CRTC_CURSOR_HIGH, CRTC_ADDR); 1.64 - outb(loc >> 8, CRTC_DATA); 1.65 -} 1.66 - 1.67 -void scroll_scr(void) 1.68 -{ 1.69 - /* simple scrolling by manually copying memory */ 1.70 - memmove(vmem, vmem + WIDTH, WIDTH * (HEIGHT - 1) * 2); 1.71 - memset16(vmem + WIDTH * (HEIGHT - 1), CLEAR_CHAR, WIDTH); 1.72 -} 1.73 -