『第
2 楼』:
这是从UCDOS中找到的,中间的ClearPromptLine(int Color)应该可以做到,把Color设置为你的背景色吧。
#include <stdio.h>
#include <dos.h>
int IsUcdosResident(void)
{
union REGS regs; regs.x.ax = 0xdb00;
int86(0x2f,&regs,&regs);
return regs.x.bx == 0x5450;
}void SetPromptLineColor(int Color1,int Color2,int Color3,int Color4)
{
union REGS regs; regs.x.ax = 0xff0f;
regs.h.bl = 0x8b;
regs.h.cl = Color1;
regs.h.ch = Color2;
regs.h.dl = Color3;
regs.h.dh = Color4;
int86(0x10,&regs,&regs);
}void InitPromptLine(void)
{
union REGS regs; regs.x.ax = 0xff07;
int86(0x16,&regs,&regs);
}void ClearPromptLine(int Color)
{
union REGS regs; regs.x.ax = 0xff10;
regs.h.bl = 0;
regs.h.bh = Color;
int86(0x10,&regs,&regs);
}void WritePromptMoreChar(char ch,int Color,int Count)
{
union REGS regs; regs.x.ax = 0xff10;
regs.h.bl = 1;
regs.h.bh = Color;
regs.x.cx = Count;
regs.h.dl = ch;
int86(0x10,&regs,&regs);
}void WriteUcdosPromptLine(const char *msg)
{
// char msg[81]="一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五";
if (IsUcdosResident()) {
char *p;
SetPromptLineColor(0x17,0x11,0x1c,0xb1);
InitPromptLine();
ClearPromptLine(0x7);
for (p=msg;*p;p++)
WritePromptMoreChar(*p,0xb4,1);
}
else {
printf("The UCDOS is not residented.\n");
}
}
|