home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************/
- /*** ***/
- /****************************************************************************/
-
- #include <graphics.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <conio.h>
- #include <io.h>
- #include <dos.h>
- #include <stdio.h>
- #include <time.h>
- #include <string.h>
-
- /****************************************************************************/
- /*** ***/
- /****************************************************************************/
- typedef struct DotFile
- {int Index;
- char *FileName;
- };
- struct DotFile DotFiles[]={ {0, "SLST"},
- {1, "SLFS"},
- {2, "SLKT"},
- {3, "SLHT"},
- {4, "SLWB"},
- {5, "SLLS"},
- {6, "SLXY"},
- {7, "SLBS"},
- {8, "SLXK"},
- {11, "SLLB"},
- {12, "SLDH"},
- {13, "SLYT"},
- {14, "SLMH"},
- {15, "SLSTF"},
- {16, "SLFSF"},
- {17, "SLKTF"},
- {18, "SLHTF"},
- {21, "SLXYF"},
- {22, "SLZYF"},
- {23, "SLLBF"},
- {24, "SLDHF"},
- {25, "SLWBF"},
- {26, "SLXKF"},
- {27, "SLHBF"},
- {28, "SLZYIF"},
- };
-
- char * GetDOTS(unsigned int ccode,int FileIndex, int FHandle, int Width, int Height);
- /****************************************************************************/
- /*** ***/
- /****************************************************************************/
- int quwei(unsigned int hz)
- {
- int number;
- int tmp1,tmp2;
- tmp1= (hz & 0xff) - 160;
- tmp2= (hz & 0xff00)>>8;
- number = tmp1*100 + tmp2-160;
- return number;
- }
-
- /****************************************************************************/
- /*** ***/
- /****************************************************************************/
- main(int args, char *argv[])
- {
- int Height=96,hh=120, Width=96,hw=120, Handle;
- unsigned char BitValue[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
- unsigned int ccode=1601,code1,code2,code;
- int i,j,k,m,n,retv;
- char * buf;
- unsigned char hzstr[50];
- /* request auto detection */
- int gdriver = DETECT, gmode, errorcode;
-
- strcpy(hzstr,"╕▀╛½╢╚╩╕┴┐║║╫╓");
- if(args>1)
- {i=atoi(argv[1]);
- if(i>0 && i<=87) ccode=i*100+1;
- else if(i>=1601 && i<=8794)
- {if((j=(i % 100))>=1 && j<=94) ccode=i;
- }
- }
-
- /* initialize graphics mode */
- initgraph(&gdriver, &gmode, "");
-
- /* read result of initialization */
- errorcode = graphresult();
-
- if (errorcode != grOk) /* an error occurred */
- {
- printf("Graphics error: %s\n", grapherrormsg(errorcode));
- printf("Press any key to halt:");
- getch();
- exit(1); /* return with error code */
- }
-
- clearviewport();
- setbkcolor(7);
- setcolor(1);
- rectangle(0,0,getmaxx(),getmaxy());
- rectangle(2,2,getmaxx()-2,getmaxy()-2);
- for(i=0; i<20; i++)
- {
- if((Handle=open(DotFiles[i].FileName, 0))!=-1)
- {
-
- code1=hzstr[i*2];
- code2=hzstr[i*2+1];
- code1=code1+(code2<<8);
- code=quwei(code1);
- buf=GetDOTS(code, DotFiles[i].Index, Handle,hw,hh);
- close(Handle);
- if(buf != (unsigned char *)0)
- {for(m=0; m<hw; m++)
- for(n=0; n<hh; n++)
- {j=(m/8)*hh+n;
- k=m % 8;
- if(BitValue[k] & buf[j])
- putpixel((i%5)*hw+6+m,(i/5)*hh+n,1);
- }
- }
- }
- }
- getch();
-
- while(1)
- {if((ccode % 100)>94)
- ccode=((ccode / 100)+1)*100+1;
- if((ccode / 100)>87) ccode=1601;
- clearviewport();
- setbkcolor(7);
- setcolor(1);
- rectangle(0,0,getmaxx(),getmaxy());
- rectangle(2,2,getmaxx()-2,getmaxy()-2);
- for(i=0; i<25; i++)
- {
- if((Handle=open(DotFiles[i].FileName, 0))!=-1)
- {
- buf=GetDOTS(ccode, DotFiles[i].Index, Handle,Width,Height);
- close(Handle);
- if(buf != (unsigned char *)0)
- {for(m=0; m<Width; m++)
- for(n=0; n<Height; n++)
- {j=(m/8)*Height+n;
- k=m % 8;
- if(BitValue[k] & buf[j])
- putpixel((i % 5)*Width+6+m, (i/5)*Height+n,i%8+8);
- }
- }
- }
- }
- ccode++;
- if(kbhit())
- {
- if((i=getch())==0) i=getch()<<8;
- if(i==27) break;
- }
- else
- {for(i=0; i<5000; i++) {} ; delay(1000);
- }
- }
- /* clean up */
- closegraph();
- return 0;
- }
-