⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hzkload2.c

📁 在C环境下文字显示的原来
💻 C
字号:
#include<io.h>
#include<stdio.h>
#include<dos.h>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<bios.h>
#include<mem.h>
#include<fcntl.h>
#include<stdlib.h>
#include<conio.h>
#define VGA256 0x13
#define TEXT_MODE 0x03

unsigned char far *video_buffer=(char far *)0xA0000000L;

unsigned char bit[8]={128,64,32,16,8,4,2,1};

void Plot_Pixel_Fast(int x,int y,char color)
{
video_buffer[((y<<8)+(y<<6))+x]=color;
}

void Hzk_File_Out2(char *file,int x,int y,int color,char *str)
{
register int i,j,k;
unsigned vpos;
char bitdata[32];
FILE *out;
char str1[2];
int offset=0,flag=1;
if((out=fopen(file,"rb"))==NULL){
printf("Open %s error!\n",file);
exit(0);
}
do
{
fseek(out,34*offset,SEEK_SET);
flag=fread(str1,2,1,out);
offset++;
}while(((str1[0]!=str[0])||(str1[1]!=str[1]))&&flag!=0);
if(flag!=0)
	fread( bitdata, 32, 1, out);
else
	printf("this chinese word can not be found");
fclose(out);

for(i=0;i<16;i++)
for(j=0;j<8;j++){
if(bitdata[2*i]&bit[j])
	Plot_Pixel_Fast(x+j,i+y,color);
if(bitdata[2*i+1]&bit[j])
	Plot_Pixel_Fast(x+8+j,i+y,color);
}
}

void Hzks_File_Out2(char *file,int x,int y,int color,char *str)
{
int i=0;
char now[2];
do
{
	now[0]=str[i];
	now[1]=str[i+1];
	Hzk_File_Out2(file,x+i*8,y,YELLOW,now);
	i=i+2;
}while(str[i]!='\x0');
}

void Set_Video_Mode(int mode)
{
	union REGS inregs,outregs;
	inregs.h.ah=0;
	inregs.h.al=(unsigned char)mode;
	int86(0x10,&inregs,&outregs);
}
void main(void)
{
char *file="words2.dat";
char *str="游戏";
Set_Video_Mode(VGA256);
Hzk_File_Out2(file,0,0,YELLOW,str);
getch();
Hzks_File_Out2(file,0,20,YELLOW,str);
getch();
Set_Video_Mode(TEXT_MODE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -