对地址B800:0070写入41H(十进制的65,大写的A),对地址B800:0071写入17H,屏幕上的第2行的第32列拉置将显示兰底白字的大写A字符.
我按资料上的公式分析了一下,怎么也不是第2行第32列啊???????
高手帮忙分析一下!
不是汇编啊! 是显示器方面的知识!
我发个程序就知道了:(千万不要以为是graphics的!!!)
不发意思!本来程序源码是C++的!不过用C的也行!把第一句去了就行了!
[CODE]// program (MOVE_W.CPP) move windows by direct kay
#include<iostream.h>
#include<stdio.h>
#include<conio.h> // getch() in
#include<stdlib.h> //system() in
#define XLEN 20;
#define YHIGH 8;
op_offset(int,int);
sc_prt(int,int,int,int,int,int);
sc_prt1(int,int,int,int,int,int);
write_to(int,int,int,int,int,int);
int system(const char *command);
static char a[]=" Wellcom to screen! ";
static char b[]=" Q Key quit ?";
main()
{
int x1,y1,x2,y2,fc=7,bc=1;
int x11,y11,x22,y22,fc1,bc1;
char c;
x1=0;
x2=x1+XLEN;
y1=0;
y2=y1+YHIGH;
x11=x1;
x22=x2;
y11=y1;
y22=y2;
fc1=fc;
bc1=0;
system("cls");
sc_prt(x11,y11,x22,y22,fc1,bc);
for(;;){
c = getch();
switch(c){
case 72:
sc_prt1(x11,y11,x22,y22,fc1,bc1);
if (y1==0){
y1=0;
y2=y1+YHIGH;
}
else{
y1-=1;
y2-=1;
}
y11=y1;
y22=y2;
sc_prt(x1,y1,x2,y2,fc,bc);
break;
case 80:
sc_prt1(x11,y11,x22,y22,fc1,bc1);
if (y2==24){
y1=y2-YHIGH;
y2=24;}
else{
y1+=1;
y2+=1;
}
y11=y1;
y22=y2;
sc_prt(x1,y1,x2,y2,fc,bc);
break;
case 75:
sc_prt1(x11,y11,x22,y22,fc1,bc1);
if (x1==0){
x1=0;
x2=x1+XLEN;}
else{
x1-=1;
x2-=1;
}
x11=x1;
x22=x2;
sc_prt(x1,y1,x2,y2,fc,bc);
break;
case 77:
sc_prt1(x11,y11,x22,y22,fc1,bc1);
if (x1==79){
x1=x2-XLEN;
x2=79;}
else{
x1+=1;
x2+=1;
}
x11=x1;
x22=x2;
sc_prt(x1,y1,x2,y2,fc,bc);
break;
case 'q':
return 0;
case 'Q':
return 0;
default:
break;
}
}
}
sc_prt(int x1,int y1,int x2,int y2,int fcol,int bcol)
{
unsigned char far *letter;
int i,j,col;
bcol*=16;
col=fcol+bcol;
for (i=x1;i<=x2;i++)
for (j=y1;j<=y2;j++){
letter=(unsigned char far*)0xB8000000;
letter+=op_offset(i,j);
*letter='A';
*(letter+1)=col;
}
write_to(x1,y1,x2,y2,fcol,bcol);
return 0;
}
sc_prt1(int x1,int y1,int x2,int y2,int fcol,int bcol)
{
unsigned char far *letter;
int i,j,col;
bcol*=16;
col=fcol+bcol;
for (i=x1;i<=x2;i++)
for (j=y1;j<=y2;j++){
letter=(unsigned char far*)0xB8000000;
letter+=op_offset(i,j);
*letter=' ';
*(letter+1)=col;
}
write_to(x1,y1,x2,y2,fcol,bcol);
return 0;
}
write_to(int x1,int y1,int x2,int y2,int fcol,int bcol)
{
unsigned char far*letter;
int i,j,k=1;
for(i=x1+1,j=y1+4;i<x1+19;i++){
letter=(unsigned char far*)0xB8000000;
letter+=op_offset(i,j);
*letter=a[k++];
*(letter+1)=bcol*16+fcol; //chang background color
}
k=1;
for(i=x1+4,j=y1+6;i<x1+16;i++){
letter=(unsigned char far*)0xB8000000;
letter+=op_offset(i,j);
*letter=b[k++];
*(letter+1)=bcol*16+fcol+3; //chang background color
}
return 0;
}
op_offset(int sc_x,int sc_y)
{
int s;
s=(sc_y*80+sc_x)*2;
return(s);
}