直接向视频缓冲区输出的问题!!
我买了一本《Linux0.01内核分析与操作系统设计》一书,里面有个直接向视频缓冲区输出的程序,但是我在window 2000pro下用gcc编译出错:
程序如下:
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define LIGHTGRAY 7
#define DARKGRAY 8
#define LIGHTBLUE 9
#define LIGHTGREEN 10
#define LIGHTCYAN 11
#define LIGHTRED 12
#define LIGHTMAGENTA 13
#define YELLOW 14
#define WHITE 15
#define BLINK 28
void write_string(char *pstring, int color)
{
char far *pvideo = (char far *)0xB8000000;
while(*pstring)
{
*pvideo=*pstring;
pstring++;
pvideo++;
*pvideo=color;
pvideo++;
}
}
void main(){
write_string("Hello,world!", RED);
}
错误如下:
In function 'write_string':
syntax error before '*' token //21行
'pvideo' undeclared (first use in this function)//24行
书中还提到:彩色显示器的字符屏幕显存起始地址在0xB8000000处,单色显示器的视频缓冲区起始地址在0xB8000000处。对于这两点不是一样的概念吗?怎么理解?对了,顺便说一下,我用的是彩色显示器!