?? 小字庫diy.c
字號:
有一段時間直接讀取漢字庫,以期不用漢字系統也能顯示漢字,是很流行的技術,現在也就在工控行業用得上了。這是硬件發展、大肆浪費內存的結果。暫且不論,讓我們看看漢字庫。
16X16點陣的字庫按照內碼順序排列,每個字用32字節(256BIT)存放點陣信息。格式如下:
第一字節第二字節
第三字節第四字節
第五字節第六字節
第七字節第八字節
你看程序吧,很清楚的。
但是,又不是每個字庫都一樣。可能是因為有些字庫把英文字模也放在一起吧。我所用的是UCDOS的字庫
#include < io.h>
#include < fcntl.h>
#include < stdio.h>
#include < dos.h>
#define CCLIB "c:\hzk16"
display(unsignedchar *hzmp, int x, int y, int color, int bkcolor)
{ charfar *p;
int i, j, k;
p= (char far *)(0xa0000000+80*y+x/8);
for (i= 0; i < 16; i++)
for(j = 0; j < 2; j++)
{ outport(0x3ce, 0x0205); // kernel here
k=*(p+80*i+j);
outportb(0x3ce, 0x08);
outportb(0x3cf, hzmp[2*i+j]);
*(p+80*i+j)=color;
k=*(p+80*i+j);
outportb(0x3ce, 0x08);
outportb(0x3cf, ~hzmp[2*i+j]);
*(p+80*i+j)=bkcolor;
}
outport(0x3ce, 0x005); //reset
outport(0x3ce, 0xff08);
}
main()
{
union REGS r;
int handle, mode;
int i;
int qh, wh, col, row;
long offset;
unsigned char *hz, hzm[32];
handle=open(CCLIB, O_RDONLY|O_BINARY);
r.h.ah=0x0f;int86(0x10, &r, &r);
mode=r.h.al;
r.x.ax= 0x0012;
int86(0x10, &r, &r);
for(i=0; i < 20; i++){
col=0;row=20*i;
hz="希望電腦公司:為了檢驗此程序的執行速度特意如此但是沒有標點符號這里是寫字軟件";
while(*hz){ /*find theqh, wh*/
qh = *hz-0xa0;
wh = *(hz+1)-0xa0;
offset = (94l*(qh-1)+(wh-1))*32l;
lseek(handle, offset, SEEK_SET);
read(handle, hzm, 32);/*display*/
display(hzm, col, row, 4, 3);
col += 16;
hz += 2;
}
}
r.h.ah=0x00;
r.h.al= mode;
int86(0x10, &r, &r);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -