home *** CD-ROM | disk | FTP | other *** search
- /* ╓≈╠Γú║┤≥╙í╫╓┐Γ╢┴╚í */
- /*
- 1 DispChinese ╢┴╚íPostscript╫╓┐Γ╡π╒≤ INT 7EH
- */
- #include <dos.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- #define TRUE 1
- #define FALSE 0
-
- int IsUcdosResident(void)
- {
- union REGS regs;
-
- regs.x.ax = 0xdb00;
- int86(0x2f,®s,®s);
- return regs.x.bx == 0x5450;
- }
-
- int QueryModuleResident(int ModuleNo)
- {
- union REGS regs;
-
- if (!IsUcdosResident()) return 0;
- regs.h.ah = 0;
- regs.h.al = ModuleNo;
- int86(0x79,®s,®s);
- return regs.x.flags & 0x40 ? 1 : 0;
- }
-
-
- void SetDisplayMode(int Mode)
- {
- union REGS regs;
-
- regs.h.ah = 0;
- regs.h.al = Mode;
- int86(0x10,®s,®s);
- }
-
- void SetPixel(int Col,int Row,int Color)
- {
- union REGS regs;
-
- regs.h.ah = 0xc;
- regs.h.al = Color;
- regs.x.cx = Col;
- regs.x.dx = Row;
- int86(0x10,®s,®s);
- }
-
- /******************************************************************************
- ▓╬╩²╦╡├≈: x,y ╧╘╩╛║║╫╓╡─╫≤╔╧╜╟╫°▒Ω
- FrColor ╧╘╩╛║║╫╓╡─╟░╛░╔½
- BgColor ╧╘╩╛║║╫╓╡─▒│╛░╔½
- ChineseCode ╙√╧╘╩╛╡─║║╫╓
- Font ╩╣╙├╡─╫╓┐Γ▒α║┼
- Fontx ╧╘╩╛║║╫╓╡─╦«╞╜┐φ╢╚
- Fonty ╧╘╩╛║║╫╓╡─┤╣╓▒╕▀╢╚
- ******************************************************************************/
- int DispChinese(int x,int y,int FrColor,int BgColor,char *ChineseCode,
- int Font,int Fontx,int Fonty)
- {
- union REGS regs;
- struct SREGS sregs;
- struct Int7eStru{
- unsigned char Word[2]; /* ║║╫╓╗·─┌┬δ */
- unsigned int Font; /* ╫╓┐Γ▒α║┼ */
- unsigned int Fontx,Fonty; /* ║║╫╓╕▀╢╚║═┐φ╢╚ */
- unsigned int Top,Bot; /* ╞≡╩╝╧▀║═╓╒╓╣╧▀ */
- unsigned int Attribute; /* ╩⌠╨╘ */
- unsigned int BufLen; /* ╗║│σ╟°│ñ╢╚ */
- }Int7eArg;
-
- unsigned char *DotBuf,*s,c;
- int i,j,n;
-
- DotBuf=malloc(max(4096,((Fontx+7)/8*Fonty)*4));
-
- if (DotBuf == NULL) return FALSE;
-
- Int7eArg.Word[0]=ChineseCode[1];
- Int7eArg.Word[1]=ChineseCode[0]; /* ║║╫╓▒α┬δ▒╪╨δ╡╣╥╗╧┬ */
- Int7eArg.Font=Font; /* ╫╓┐Γ▒α║┼ */
- Int7eArg.Fontx=Fontx; /* ║║╫╓┐φ╢╚ */
- Int7eArg.Fonty=Fonty; /* ║║╫╓╕▀╢╚ */
- Int7eArg.Top=0; /* ╞≡╩╝╧▀, 0▒φ╩╛╢Ñ╢╦ */
- Int7eArg.Bot=Fonty-1; /* ╓╒╓╣╧▀, Fonty-1╬¬╬▓╢╦*/
- Int7eArg.Attribute=1; /* ╩⌠╨╘=1, ▒φ╩╛╧╘╩╛╕±╩╜ */
- Int7eArg.BufLen=((Fontx+7)/8*Fonty)*2 + 3*1024;
- /* ╗║│σ╟°┤≤╨í */
- regs.x.si=FP_OFF(&Int7eArg);
- regs.x.di=FP_OFF(DotBuf);
- sregs.ds=FP_SEG(&Int7eArg);
- sregs.es=FP_SEG(DotBuf);
-
- int86x(0x7e,®s,®s,&sregs);
-
- s=DotBuf;
- for (i=0;i<Fonty;i++){
- for (j=0;j<Fontx;j++){
- if (!(j % 8)){
- c=*s++;
- n=0x80;
- }
- if (c & n) SetPixel(x+j,y+i,FrColor);
- else SetPixel(x+j,y+i,BgColor);
- n>>=1;
- }
- }
- }
-
- void main(void)
- {
- if (!QueryModuleResident(0x1)) { /* RDPS╡──ú┐Θ║┼╬¬1 */
- printf("RDPS not in memory!\n");
- exit(0);
- }
- SetDisplayMode(3);
- if (!DispChinese(220,110,15,1,"░í",0,200,260)){
- printf("─┌┤µ▓╗╣╗\n\7");
- }
- getch();
- SetDisplayMode(3);
- }
-