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

📄 sph1.c

📁 LED点阵屏字模发送程序,该程序是用VC++编写
💻 C
字号:
#include "dos.h"
#include "stdio.h"
#include "conio.h"
#include <bios.h>
#define COM1   0
#define DATA_READY 0x100
#define TRUE   1
#define FALSE  0
#define SETTINGS  0xFB

FILE *fphz;
FILE *fpfh;
FILE *fpfile;
char Style;
void OpenLIB(void);
void CC256(char *Str,int i);
void ErrMsg();
void Quit();

int main(void)
{
    char Str[600];
    char *FileName;
    char *FNChange,*FNSave;
    char temp;
    int Choose,i,j,k;
 //   int ZJS;
    clrscr();
restart:   printf("s:Static    m:Move   q:Quit");
	   printf("\nPlease To Choose Display Style:");
	   Choose=getch();
	   putchar(Choose);
    if(Choose=='s')
       Style=1;
       else if(Choose=='m')
	Style=1;
	else if(Style=='q')
	   exit(0);
	   else
	   {
	    printf("\n\n\tInput Mistake!\n");
	    goto restart;
	   }
retry:	printf("\nPlease Input Path\Filename:");
	gets(FileName);
	//puts(FileName);
	if((fpfile = fopen(FileName, "rb")) == NULL)
	   { ErrMsg();
	     printf("\nFileName Mistake! Please retry!");
	     goto retry;
	   }

	   fseek(fpfile,0, SEEK_SET);
	   i=0;
	   while((temp=getc(fpfile))!=EOF)
	    {
	     if(temp!='\r'&&temp!='\n')
	     {
	      Str[i]=temp;
	      i++;
	     }
	    }
	    OpenLIB();
	 CC256(Str,i/2);

    Quit();
    return 0;
}


void OpenLIB(void)
{
    if ((fphz = fopen("d:\\ucdos\\fnt\\hzk24s", "rb")) == NULL) ErrMsg();
    if ((fpfh = fopen("d:\\ucdos\\fnt\\hzk24t", "rb")) == NULL) ErrMsg();
}

void CC256(char *Str,int zs)
{
   unsigned  Zcode, Bcode;
   int  i, j, k, BitCount,Rec;
   int  Status,out,DOWN;
   long Len;
   char Buf[72];
   char BufD[18600];
   char s;
   BitCount=0;
   for(i=0;i<zs;i++)
   {  if ((*Str & 0x80) && (*(Str+1) &0x80))
      {  Zcode = (*Str-0xa0) & 0x07f;
	 Bcode = (*(Str+1)-0xa0) & 0x07f;

	 if(Zcode>16)
	   {Rec = (Zcode-16)*94+Bcode-1;
	    Len = Rec*72L;
	    fseek(fphz, Len, SEEK_SET);
	    fread(Buf, 1, 72, fphz);
	   }
	  else
	   {Rec = (Zcode-1)*94+Bcode-1;
	    Len = Rec*72L;
	    fseek(fpfh, Len, SEEK_SET);
	    fread(Buf, 1, 72, fpfh);
	    }
	 for(j=0;j<72;j++)
	 {k=BitCount+j;
	  BufD[k]=~Buf[j];
	 }
	  BitCount+=72;
	 Str += 2;
      }
   }
	bioscom(0,SETTINGS,COM1);
	Status=bioscom(3,0,COM1);
	if(Status&0x2000)
	     bioscom(1,'a',COM1);
	 S:  Status=bioscom(3,0,COM1);
	if(Status&0x100)
	  if((out=bioscom(2,0,COM1)&0X7F)!=0)
	  putch(out);
	  if(out!='a')goto S;

	  //getch();

 /* zt:	   if(Status&0x2000)
	     bioscom(1,Style,COM1);
	      else goto zt;

   */
	    delay(40);
	    BitCount+=576;

  zd:	   if(Status&0x2000)
	    {
	      s=0xb8;//BitCount&0x00ff;
	      bioscom(1,s,COM1);
	    }
	    else goto zd;
	    delay(40);
  zg:	   if(Status&0x2000)
	    {
	      s=0x05;//BitCount&0xff00;
	      bioscom(1,s,COM1);
	    }
	   else goto zg;
	 delay(40);

	if(Style==1)
	  for(i=0;i<288;i++)
	    {DOWN=TRUE;
	      while(DOWN)
		 {
		    Status=bioscom(3,0,COM1);
		    if(Status&0x2000)
			{
			  bioscom(1,0xff,COM1);
			  DOWN=FALSE;
			//  delay(40);
			}
		       else DOWN=TRUE;
		 }
	     }

	for(k=0;k<BitCount-576*2;k++)
	   { DOWN=TRUE;

	     while(DOWN)
		 {
		    Status=bioscom(3,0,COM1);
		    if(Status&0x2000)
			{
			  bioscom(1,BufD[k],COM1);
			  DOWN=FALSE;
		      //	  delay(40);
			}
		       else DOWN=TRUE;
		 }
	   }
	 DOWN=TRUE;
	if(Style==1)
	  for(i=0;i<288;i++)
	    {DOWN=TRUE;
	      while(DOWN)
		 {
		    Status=bioscom(3,0,COM1);
		    if(Status&0x2000)
			{
			  bioscom(1,0xff,COM1);
			  DOWN=FALSE;
		   //	  delay(40);
			}
		       else DOWN=TRUE;
		 }

	     }
     return;
 }


void Quit()
{
    fcloseall();
    exit(0);
}

void ErrMsg()
{
    printf("\n\n\nOpen LIB File Error!");
    //getch();
}

⌨️ 快捷键说明

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