/*---------------------------------------------------------------------------*/
/* ETFONT.CPP use Mode 0x12 (graphics) 80x30 [640x480 (8x16)] */
/*---------------------------------------------------------------------------*/
// #pragma inline #include
#include
#include
#include
#include
#include void SetVideoMode(unsigned char videomode)
{
asm mov ah,00h
asm mov al,videomode
asm int 10h
}
void gotoxy0(unsigned char x,unsigned char y)
{
x--;y--;
asm mov ax,0200h
asm mov bh,0
asm mov dh,y // Zero Base
asm mov dl,x // Zero Base
asm int 10h
}
void wherexy0(unsigned char *x,unsigned char *y)
{
unsigned char xx,yy;
asm mov ax,0300h
asm mov bh,0
asm int 10h
asm mov yy,dh // Zero Base
asm mov xx,dl // Zero Base
*x=xx 1; *y=yy 1;
} void ScrollUp(unsigned char lines_up,unsigned char attr,
unsigned char upperleft_x,unsigned char upperleft_y,
unsigned char loweright_x,unsigned char loweright_y)
{ // The Coord. is ZERO based
asm mov ah,06h
asm mov al,lines_up
asm mov bh,attr
asm mov ch,upperleft_y
asm mov cl,upperleft_x
asm mov dh,loweright_y
asm mov dl,loweright_x
asm int 10h
} void ScrollDown(unsigned char lines_down,unsigned char attr,
unsigned char upperleft_x,unsigned char upperleft_y,
unsigned char loweright_x,unsigned char loweright_y)
{
asm mov ah,07h
asm mov al,lines_down
asm mov bh,attr
asm mov ch,upperleft_y
asm mov cl,upperleft_x
asm mov dh,loweright_y
asm mov dl,loweright_x
asm int 10h
}
void PutPixel(int x,int y,unsigned char attr,unsigned char page=0)
{
asm mov ah,0Ch
asm mov al,attr
asm mov bh,page
asm mov cx,x
asm mov dx,y
asm int 10h
}
unsigned char GetPixel(int x,int y,unsigned char page=0)
{
unsigned char attr;
asm mov ah,0Dh
asm mov bh,page
asm mov cx,x
asm mov dx,y
asm int 10h
asm mov attr,al
return attr;
} void Get_Video_State0(void)
{
unsigned char far *CurrentVideoMode =(unsigned char far *)0x00400049;
unsigned int far *NumberofColumns =(unsigned int far *)0x0040004A;
unsigned int far *VideoBufferSize =(unsigned int far *)0x0040004C;
unsigned int far *VideoBufferOffset=(unsigned int far *)0x0040004E;
unsigned char far *ActiveDisplayPage=(unsigned char far *)0x00400062;
unsigned char far *NumberofRows =(unsigned char far *)0x00400084;
unsigned int far *HeightofCharacter=(unsigned int far *)0x00400085; printf(" CurrentVideoMode = %6u\n",*CurrentVideoMode );
printf(" NumberofColumns = %6u\n",*NumberofColumns );
printf(" VideoBufferSize = %6u\n",*VideoBufferSize );
printf(" VideoBufferOffset = %6u\n",*VideoBufferOffset);
printf(" ActiveDisplayPage = %6u\n",*ActiveDisplayPage);
printf(" NumberofRows = %6u\n",*NumberofRows );
printf(" HeightofCharacter = %6u\n",*HeightofCharacter);
}
void Set_Video_State0(void)
{
unsigned char far *NumberofRows =(unsigned char far *)0x00400084;
unsigned int far *HeightofCharacter=(unsigned int far *)0x00400085;
char c=*NumberofRows;
int i=*HeightofCharacter; *NumberofRows =(unsigned char)c/2;
*HeightofCharacter=(unsigned int )i*2;
} void FileOpenError(char *f,char flagexit=0)
{
printf("\nFile Open Error : %s\n",f);
if(flagexit) { fcloseall(); exit(1); }
}
void ReadFileError(void)
{
printf("\nReading File Error\n");
fcloseall();
exit(1);
}
void SeekFileError(void)
{
printf("\nSEEK file ERROR\n");
fcloseall();
exit(1);
}
void MemoryNotEnough(void)
{
printf("\nMemory Not Enough\n");
exit(1);
}
void showOneChineseWord0(int *xx,int *yy,unsigned char *fbuf)
{
int x=*xx, y=*yy;
int i,j;
unsigned char mask;
for(j=0;j<15;j )
{
for(mask=0x80,i=0;i<8;i ,mask>>=1) if(fbuf[j*2]&mask) PutPixel(x i,y j,0x0F);
for(mask=0x80,i=0;i<8;i ,mask>>=1) if(fbuf[j*2 1]&mask) PutPixel(x 8 i,y j,0x0F);
}
*xx =16;*xx%=640;
if(x>*xx)
{
if(*yy 16>=480) ScrollUp(1,0x71,0,0,79,29); // ScrollUp One Line
else { *yy =16;*yy%=480; }
}
}
void showOneChineseWord(int *xx,int *yy,unsigned char *fbuf)
{
int x=*xx, y=*yy; // ZERO based
char far *farptr=(char far *)0xA0000000L y*80 x;
int j;
for(j=0;j<15;j )
{
farptr[j*80] =fbuf[j*2];
farptr[j*80 1]=fbuf[j*2 1];
}
*xx =2;*xx%=80;
if(x>*xx)
{
if(*yy 16>=480) ScrollUp(1,0x71,0,0,79,29); // ScrollUp One Line
else { *yy =16;*yy%=480; }
}
} char *ETfontfile[5];
char *ETascfont ="c:\\c\\et35\\ascfont.15";
char *ETstdfont ="c:\\c\\et35\\stdfont.15";
char *ETspcfont ="c:\\c\\et35\\spcfont.15";
char *ETspcfsupp="c:\\c\\et35\\spcfsupp.15";
char *ETusrfont ="c:\\c\\et35\\usrfont.15m";
void showChineseWord(void)
{
FILE *Ffile;
unsigned char filebuf[2*15];
int fontnumber[5];
int scrx,scry; ETfontfile[0]=ETascfont; fontnumber[0]=256;
ETfontfile[1]=ETstdfont; fontnumber[1]=13094;
ETfontfile[2]=ETspcfont; fontnumber[2]= 408;
ETfontfile[3]=ETspcfsupp; fontnumber[3]= 365;
ETfontfile[4]=ETusrfont; fontnumber[4]= 5809; scrx=0;scry=0;
for(int j=1;j<5;j )
{
ScrollUp(1,0x71,0,0,79,29); // ScrollUp One Line
scrx=0; if((Ffile=fopen(ETfontfile[j],"rb"))==NULL) FileOpenError(ETfontfile[j],1);
if(j==4) fseek(Ffile,256,SEEK_SET);
for(int i=0;i 沒空更新的網頁...
http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... big5.to/吃軟也吃硬 dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....