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

📄 hzkload1.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_Out(char *file,int x,int y,int color,int offset)
{
register int i,j,k;
unsigned vpos;
char bitdata[32];
FILE *out;

if((out=fopen(file,"rb"))==NULL){
printf("Open %s error!\n",file);
exit(0);
}
fseek(out,32*offset,SEEK_SET);
fread( bitdata, 32, 1, out);
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_Out(char *file,int x,int y,int color,int num,int offset)
{
register int i,j,k;
unsigned vpos;
int index=0;
char *bitdata;
FILE *out;
bitdata=malloc(sizeof(char)*32*num);

if((out=fopen(file,"rb"))==NULL){
printf("Open %s error!\n",file);
exit(0);
}
fseek(out,32*offset,SEEK_SET);
fread( bitdata, 32*num, 1, out);
fclose(out);
while(index<num)
{
for(i=0;i<16;i++)
for(j=0;j<8;j++){
if(bitdata[index*32+2*i]&bit[j])
Plot_Pixel_Fast(index*16+x+j,i+y,color);
if(bitdata[index*32+2*i+1]&bit[j])
Plot_Pixel_Fast(index*16+x+8+j,i+y,color);
}
index++;
}
}

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="words.dat";
Set_Video_Mode(VGA256);
Hzk_File_Out(file,0,0,YELLOW,1);
getch();
Hzks_File_Out(file,0,20,YELLOW,2,0);
getch();
Set_Video_Mode(TEXT_MODE);
}

⌨️ 快捷键说明

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