我这段时间正在学习ucos,在使用到显示字符函数PC_DispChar时总是报错,其中的DISP_BASE不知道取什么值? #define DISP_BASE 0xB800 /* Base segment of display (0xB800=VGA, 0xB000=Mono) */ 我的一个测试代码如下,麻烦各位帮我看一下,多谢: #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <conio.h> #include <setjmp.h> #define MK_FP(seg,ofs) ((void *) (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
#define DISP_BASE 0xB800 /* Base segment of display (0xB800=VGA, 0xB000=Mono) */ #define DISP_MAX_X 80 /* Maximum number of columns */ #define DISP_MAX_Y 25 /* Maximum number of rows */
#define DISP_FGND_WHITE 0x0F
#define DISP_BGND_BLACK 0x00
typedef unsigned char INT8U; /* Unsigned 8 bit quantity */ typedef signed char INT8S; /* Signed 8 bit quantity */ typedef unsigned int INT16U; /* Unsigned 16 bit quantity */ typedef signed int INT16S; /* Signed 16 bit quantity */ typedef unsigned long INT32U; /* Unsigned 32 bit quantity */ typedef signed long INT32S; /* Signed 32 bit quantity */
void PC_DispChar (INT8U x, INT8U y, INT8U c, INT8U color);
void main (void) {
char * s="M"; PC_DispChar(0,0,*s,DISP_BGND_BLACK+DISP_FGND_WHITE); }
void PC_DispChar (INT8U x, INT8U y, INT8U c, INT8U color) { INT8U *pscr; INT16U offset; offset = (INT16U)y * DISP_MAX_X * 2 + (INT16U)x * 2; /* Calculate position on the screen */ pscr = (INT8U *)MK_FP(DISP_BASE, offset); *pscr++ = c; /* Put character in video RAM */ *pscr = color; /* Put video attribute in video RAM */ } 编译通过了,但是在调试运行到PC_DispChar函数中的*pscr = color; 就报以下错:
DISP_BASE的取值是不是固定的,是不是跟显卡有关啊?我的显示是 NVIDIARIVATNT2非曲直Model 64/Model 64 Pro,是不是其它的原因?大家帮帮我,谢谢!
|