2 Copyright (C) 1998 BJ Eirich (aka vecna)
\r
3 This program is free software; you can redistribute it and/or
\r
4 modify it under the terms of the GNU General Public License
\r
5 as published by the Free Software Foundation; either version 2
\r
6 of the License, or (at your option) any later version.
\r
7 This program is distributed in the hope that it will be useful,
\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
10 See the GNU General Public Lic
\r
11 See the GNU General Public License for more details.
\r
12 You should have received a copy of the GNU General Public License
\r
13 along with this program; if not, write to the Free Software
\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
28 unsigned char *csrc, *cb;
\r
30 void EmitC (unsigned char c)
\r
36 void Compress(unsigned char *p, int len)
\r
39 unsigned char byt,samect;
\r
40 unsigned char repcode;
\r
47 while (samect<254 && i<len && byt==p[i])
\r
52 if (samect==2 && byt != 0xFF) { EmitC(byt); }
\r
53 if (samect==3 && byt != 0xFF) { EmitC(byt); EmitC(byt); }
\r
54 if (samect>3 || byt == 0xFF)
\r
58 repcode=(char) samect;
\r
65 int main(int argc, char *argv[])
\r
69 printf("CHRCONV v.1.00 Copyright (C)1998 BJ Eirich \n");
\r
72 printf("CHR filename: "); fflush(stdout);
\r
78 memcpy(c, argv[1], strlen(argv[1]));
\r
79 printf("Converting %s.\n",c);
\r
84 printf("Invalid filename.\n");
\r
87 jalblkasd=(char *) malloc(15360);
\r
88 fread(jalblkasd, 1, 15360, f);
\r
92 byte=2; fwrite(&byte, 1, 1, f);
\r
93 word=16; fwrite(&word, 1, 2, f);
\r
94 word=32; fwrite(&word, 1, 2, f);
\r
95 word=0; fwrite(&word, 1, 2, f);
\r
96 word=16; fwrite(&word, 1, 2, f);
\r
97 word=16; fwrite(&word, 1, 2, f);
\r
98 word=16; fwrite(&word, 1, 2, f);
\r
99 word=30; fwrite(&word, 1, 2, f);
\r
101 cb=(char *) malloc(512*30);
\r
102 Compress(jalblkasd, 512*30);
\r
104 fwrite(&bufsize, 1, 4, f);
\r
105 fwrite(cb, 1, bufsize, f);
\r
108 quad=15; fwrite(&quad, 1, 4, f);
\r
109 quad=10; fwrite(&quad, 1, 4, f);
\r
110 quad=5; fwrite(&quad, 1, 4, f);
\r
111 quad=0; fwrite(&quad, 1, 4, f);
\r
113 t="F16W10F17W10F16W10F15W10F18W10F19W10F18W10F15W10";
\r
114 i=(strlen(t)+1); fwrite(&i, 1, 4, f); fwrite(t, 1, i, f);
\r
115 t="F11W10F12W10F11W10F10W10F13W10F14W10F13W10F10W10";
\r
116 i=(strlen(t)+1); fwrite(&i, 1, 4, f); fwrite(t, 1, i, f);
\r
117 t="F6W10F7W10F6W10F5W10F8W10F9W10F8W10F5W10";
\r
118 i=(strlen(t)+1); fwrite(&i, 1, 4, f); fwrite(t, 1, i, f);
\r
119 t="F1W10F2W10F1W10F0W10F3W10F4W10F3W10F0W10";
\r
120 i=(strlen(t)+1); fwrite(&i, 1, 4, f); fwrite(t, 1, i, f);
\r