直接向视频缓冲区输出的问题!!

sunzhikai1978 2004-12-06 12:58:09
我买了一本《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处。对于这两点不是一样的概念吗?怎么理解?对了,顺便说一下,我用的是彩色显示器!

...全文
77 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
arnold8792 2004-12-06
  • 打赏
  • 举报
回复
0xB8000000
什么模式下的啊?
xtzyz 2004-12-06
  • 打赏
  • 举报
回复
在linux下编译看行不行,不行把far去掉

4,438

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧