This commit is contained in:
Frater 2017-09-24 01:45:36 +02:00
commit 43352ff262
1291 changed files with 220976 additions and 0 deletions

324
GRAB/AO.C Normal file
View file

@ -0,0 +1,324 @@
#include <bios.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
#include <memory.h>
#include <malloc.h>
int xit=0;
int showonly=0;
int greycol,blackcol;
int fcp4plane=0;
int fcptransp=1;
int fcporigo=0;
int fcpsavepal=1;
int fcpstyle=15; /* wing commander style */
int setback255=0;
char filename[64];
char showname[16][64];
int shownum=0;
int paletteset=0;
int bx1,by1,bx2,by2;
int pass;
int picnum=0,picwrt=0;
FILE *f1;
FILE *f2; /* out */
union REGS reg;
unsigned char far *vram=(char far *)0xa0000000;
char apubuf[512];
unsigned char pal[768];
unsigned char pic[64000];
unsigned char pic2[64000];
unsigned char picorg[64000];
int backcol=0;
#define SUBMAX 384
long picpos[SUBMAX],pics; /* for loading FCP:s */
long wpicpos[SUBMAX],wpics; /* for loading FCP:s */
#define pxor(xx,yy) *(vram+(xx)+(yy)*320)=255-*(vram+(xx)+(yy)*320)
#define pset(xx,yy,zz) *(vram+(xx)+(yy)*320)=(zz)
#define pget(xx,yy) *(vram+(xx)+(yy)*320)
#define AOLOAD
#include "lfcp.c"
#include "sfcp.c"
main(int argc,char *argv[])
{
int a,b,c;
*filename=0;
for(a=1;a<argc;a++)
{
if(*argv[a]=='/' || *argv[a]=='-') switch(*(argv[a]+1))
{
case 'h' :
case 'H' :
case '?' : *filename=0; a=argc; break;
case 'o' : backcol=0; break;
default :
printf("Unknown option: %s\n",argv[a]);
exit(1);
}
else
{
if(*filename==0) strcpy(filename,argv[a]);
else strcpy(showname[shownum++],argv[a]);
}
}
if(!*filename)
{
printf("FCP Animation Optimizer V2.0 - input format: FCP\n"
"usage: VP2 <destfile> <strfile(s)> Switches:\n"
"-h help\n"
"-o0 set backg. color to 0\n"
); return(0);
}
else printf("FCP Animation Optimizer V2.0\n");
/* do some real stuff */
reg.x.ax=0x13;
int86(0x10,&reg,&reg);
{
pass=0;
bx1=by1=bx2=by2=0;
memset(pic,backcol,64000);
memset(picorg,backcol,64000);
viewpic();
for(b=0;b<shownum;b++)
{
a=loadfcp(showname[b]);
if(a==3)
{
printf("\nFile not found. Program aborted.\n");
return(0);
}
else if(a==1)
{
printf("\nError loading picture. Program aborted.\n");
return(0);
}
}
}
if(savefcp(filename))
{
printf("Save error (filename:%s)!\n",filename);
exit(3);
}
reg.x.ax=0x3;
int86(0x10,&reg,&reg);
}
int onepicdone(void)
{
unsigned int u;
if(pass==0)
{
picnum++;
viewpic(0);
}
else
{
#ifdef DOANALYZE
/* analyze */
for(u=0;u<64000;u++)
{
if(pic[u+0]==backcol) pic[u]=backcol;
else picorg[u]=pic[u];
}
/*for(u=0;u<63999;u++)
{
if(pic[u]!=backcol && pic[u+1]==backcol && pic[u+2]==backcol)
pic[u]=picorg[u];
}*/
#endif
viewpic(0);
/* save */
wpicpos[picwrt++]=ftell(f2);
savefcpdata(f2,bx1,by1,bx2,by2);
}
}
int eschit(void)
{
int a;
if(kbhit())
{
a=getch();
if(a==27 || a==32) return(1);
}
return(0);
}
int findcol(int r,int g,int b)
{
int dif=999,a,c,e,col=0;
for(a=0;a<256;a++)
{
c=r-pal[a*3+0]; if(c<0) c=-c;
e=c;
c=g-pal[a*3+1]; if(c<0) c=-c;
e+=c;
c=b-pal[a*3+2]; if(c<0) c=-c;
e+=c;
if(e<dif) { dif=e; col=a; }
}
return(col);
}
int gotoxy(int x,int y)
{
reg.h.ah=0x02;
reg.h.bh=0x00;
reg.h.dh=y;
reg.h.dl=x;
int86(0x10,&reg,&reg);
}
int area(int x1,int y1,int x2,int y2,int c)
{
int x,y;
if(c==-1)
{
for(y=y1;y<=y2;y++) for(x=x1;x<=x2;x++)
{
pxor(x,y);
}
}
else
{
for(y=y1;y<=y2;y++) for(x=x1;x<=x2;x++)
{
pset(x,y,c);
}
}
}
int xorrec(int x1,int y1,int x2,int y2)
{
int x,y;
for(y=y1+1;y<y2;y++)
{
pxor(x1,y);
pxor(x2,y);
}
for(x=x1;x<=x2;x++)
{
pxor(x,y1);
pxor(x,y2);
}
}
int waitborder(void)
{
while(inp(0x3da)&8);
while(!(inp(0x3da)&8));
}
int viewpal(int flag)
{
int a;
waitborder();
outp(0x3c8,0);
if(flag)
{
for(a=0;a<3;a++) outp(0x3c9,0);
for(a=0;a<768-6;a++) outp(0x3c9,63-pal[a]);
for(a=0;a<3;a++) outp(0x3c9,pal[a+768-3]);
}
else { for(a=0;a<768;a++) outp(0x3c9,pal[a]); }
}
int viewpic(int flag)
{
gotoxy(0,0);
memcpy(vram,pic,64000);
}
int cls(void)
{
int a;
memset(vram,0,64000);
/* set palettes 16 first colors to greyscale */
waitborder();
outp(0x3c8,0);
for(a=0;a<8;a++)
{
outp(0x3c9,a*7);
outp(0x3c9,a*7);
outp(0x3c9,a*7);
}
gotoxy(0,0);
}
int savefcp(char *fname)
{
int style;
int xo,yo;
int x,y,z,zm=1;
int a,b,c,d,w,wc;
unsigned u;
long tell4,telltbl;
long planepos[4];
wpics=picnum;
strcat(fname,".FCP");
f2=fopen(fname,"w+b");
if(f2==NULL) return(1);
putc('F',f2);
putc('C',f2);
putc('P',f2);
putc(0x1a,f2);
putc(0x10,f2); /* file ver */
a=2; /* +2=AO file */
if(fcpsavepal) a|=1;
putc(a,f1);
putw(wpics,f2); /* single file */
telltbl=ftell(f2);
fwrite(wpicpos,4,wpics,f2);
if(fcpsavepal)
{
fwrite(pal,256,3,f2);
}
{
pass=1;
memset(pic,backcol,64000);
viewpic(0);
picwrt=0;
for(b=0;b<shownum;b++)
{
a=loadfcp(showname[b]);
if(a==3)
{
printf("\nFile not found. Program aborted.\n");
return(0);
}
else if(a==1)
{
printf("\nError loading picture. Program aborted.\n");
return(0);
}
}
}
fseek(f2,telltbl,SEEK_SET);
fwrite(wpicpos,4,wpics,f2);
fseek(f2,0L,SEEK_END);
fclose(f2);
if(fcp4plane)
{
memcpy(pic,pic2,64000);
}
return(0);
}

BIN
GRAB/AO.EXE Normal file

Binary file not shown.

BIN
GRAB/ATM1.4SR Normal file

Binary file not shown.

1
GRAB/BACKB.BAT Normal file
View file

@ -0,0 +1 @@
pkzip b:grab -x*.~* -x*.obj -x*.bak

1
GRAB/BACKX.BAT Normal file
View file

@ -0,0 +1 @@
pkzip %1 -x*.~* -x*.obj -x*.bak

BIN
GRAB/BLOWFNT.1BM Normal file

Binary file not shown.

326
GRAB/COL.C Normal file
View file

@ -0,0 +1,326 @@
#include <stdio.h>
#include <bios.h>
#include <malloc.h>
#include <memory.h>
int colsreserved=1;
int setback255=0;
int filetype; /* 1=LBM */
int backcol=255;
unsigned char far *vram=(char far *)0xa0000000;
union REGS reg;
unsigned char far pic[64000];
unsigned char far pic1[64000];
unsigned char far pic2[64000];
unsigned char far bigpal[8192*3];
unsigned char far bigpalhsv[8192*3];
unsigned int bigcnt[8192];
unsigned int bigcntbak[8192];
int bigpalpnt,bigpalnum;
unsigned char palmap[256];
unsigned char far pal1[768];
unsigned char far pal2[768];
unsigned char far palhsv[768];
unsigned char far tmphsv[768];
unsigned char far pal[768];
unsigned char far defpal[16*3]={
00,00,00,
00,00,40,
00,40,00,
00,40,40,
40,00,00,
40,00,40,
40,20,00,
40,40,40,
20,20,20,
20,20,60,
20,60,20,
20,60,60,
60,20,20,
60,20,60,
60,60,20,
60,60,60,
};
int eschit(void)
{
return(kbhit());
}
#include "loadlbm.c"
main(int argc,char *argv[])
{
int a,b,c,d,x,y;
printf("\nColorMixer V1.0 (C) 1991 Sami Tammilehto \n\n");
if(argc==1)
{
printf("usage: col [?###] <src1> <src2>\n"
"when picture is in screen, press space to\n"
"toggle pics/palette, ESC to exit.\n"
"!### means reserve ### first colors for other\n"
"purposes (leave empty/to default pal)\n");
return(0);
}
if(*argv[1]=='?')
{
colsreserved=atoi(argv[1]+1);
argv[1]=argv[2];
argv[2]=argv[3];
}
bigpalpnt=0;
printf("Processing, please wait...\n");
printf("File: %s",argv[1]);
memset(pic,0,64000);
memset(pal,0,768);
loadlbm(argv[1]); printf("100%%\n");
memcpy(pic1,pic,64000);
memcpy(pal1,pal,768);
analyze(pic1,pal1);
printf("File: %s",argv[2]);
memset(pic,0,64000);
memset(pal,0,768);
loadlbm(argv[2]); printf("100%%\n");
memcpy(pic2,pic,64000);
memcpy(pal2,pal,768);
analyze(pic2,pal2);
bigpalnum=bigpalpnt;
printf("Colors in big palette: %i\n",bigpalnum);
printf("Combining and optimizing palettes...\n");
memset(pal,0,768);
memcpy(pal,defpal,16*3);
createpal();
printf("Remapping first picture... \n");
remap(pic1,pal1,pal);
printf("Remapping second picture... \n");
remap(pic2,pal2,pal);
reg.x.ax=0x13;
int86(0x10,&reg,&reg);
{
outp(0x3c8,0);
for(a=0;a<768;a++) outp(0x3c9,pal[a]);
}
for(;;)
{
memset(vram,0,64000);
for(a=0;a<16;a++) for(b=0;b<16;b++)
{
x=a*12; y=b*10;
for(c=0;c<11;c++) for(d=0;d<9;d++)
{
*(vram+x+c+(y+d)*320)=b+a*16;
}
}
a=getch();
if(a==13 || a==27) break;
memcpy(vram,pic1,64000);
a=getch();
if(a==13 || a==27) break;
memcpy(vram,pic2,64000);
a=getch();
if(a==13 || a==27) break;
}
reg.x.ax=0x3;
int86(0x10,&reg,&reg);
}
unsigned colcnt[256];
int analyze(unsigned char *pic,unsigned char *pal)
{
int a,b,c,x,y;
printf("Generating big palette and calculating relative color importances...\n");
memset(colcnt,0,256*2);
for(y=0;y<200;y++) for(x=0;x<320;x++)
{
colcnt[pic[x+y*320]]++;
}
for(a=0;a<256;a++)
{
if(colcnt[a]!=0)
{
bigpal[bigpalpnt*3+0]=pal[a*3+0];
bigpal[bigpalpnt*3+1]=pal[a*3+1];
bigpal[bigpalpnt*3+2]=pal[a*3+2];
bigcnt[bigpalpnt++]=colcnt[a];
}
}
}
int createpal(void)
{
int testval,testcnt;
int colors=256-colsreserved,firstcol=colsreserved;
int xr,xb,xg,xh,xs,xv;
int a,b,c,d,e,f,g,h;
int x,y;
int s;
rgb2hsv(bigpalhsv,bigpal,bigpalnum);
for(testcnt=0;testcnt<5;testcnt++)
{
switch(testcnt)
{
case 0 : testval=0; break;
case 1 : testval=1; break;
case 2 : testval=3; break;
case 3 : testval=5; break;
case 4 : testval=8; break;
}
memset(pal+firstcol*3,0,colors*3);
memcpy(bigcntbak,bigcnt,bigpalnum*2);
for(a=0;a<colors;)
{
printf("Processing pass %i/5: %i%% complete \r",testcnt+1,100*a/256);
{
unsigned int c;
c=0; /* max */
d=0; /* maxcolowner */
for(b=0;b<bigpalnum;b++)
{
if(bigcnt[b]>c) { c=bigcnt[b]; d=b; }
}
if(c==0) { testcnt=999; break; }
s=d; bigcnt[d]=0;
}
{
xr=bigpal[s*3+0];
xg=bigpal[s*3+1];
xb=bigpal[s*3+2];
xh=bigpalhsv[s*3+0];
xs=bigpalhsv[s*3+1];
xv=bigpalhsv[s*3+2];
c=999; /* difference */
for(b=firstcol;b<a+firstcol;b++)
{
f=b*3;
g=((xr-(unsigned int)pal[f+0]));
e=(g<0?-g:g);
g=((xg-(unsigned int)pal[f+1]));
e+=(g<0?-g:g);
g=((xb-(unsigned int)pal[f+2]));
e+=(g<0?-g:g);
/*g=((xh-(unsigned int)palhsv[f+0]));
e=(g<0?-g:g)*2;
g=((xs-(unsigned int)palhsv[f+1]));
e+=(g<0?-g:g)*2;
g=((xv-(unsigned int)palhsv[f+2]));
e+=(g<0?-g:g);*/
if(e<c) { c=e; }
}
}
if(c>testval)
{
d=a+firstcol;
pal[d*3]=bigpal[s*3];
pal[d*3+1]=bigpal[s*3+1];
pal[d*3+2]=bigpal[s*3+2];
rgb2hsv(palhsv+d*3,pal+d*3,1);
a++;
}
}
memcpy(bigcnt,bigcntbak,bigpalnum*2);
}
rgb2hsv(palhsv,pal,256);
}
int remap(unsigned char *pic,unsigned char *spal,unsigned char *pal)
{
int xr,xb,xg,xh,xs,xv;
int a,b,c,d,e,f,g,h;
memset(palmap,0,256);
rgb2hsv(tmphsv,spal,256);
for(a=0;a<256;a++)
{
printf("Processing: %i%% complete \r",100*a/256/2);
xr=spal[a*3+0];
xg=spal[a*3+1];
xb=spal[a*3+2];
xh=tmphsv[a*3+0];
xs=tmphsv[a*3+1];
xv=tmphsv[a*3+2];
h=0; c=999; /* difference */
for(b=colsreserved;b<256;b++)
{
f=b*3;
/*g=(xh-(unsigned int)palhsv[f+0]);
e=(g<0?-g:g)*2;
g=(xs-(unsigned int)palhsv[f+1]);
e+=(g<0?-g:g);
g=(xv-(unsigned int)palhsv[f+2]);
e+=(g<0?-g:g)*2;*/
g=((xr-(unsigned int)pal[f+0]));
e=(g<0?-g:g);
g=((xg-(unsigned int)pal[f+1]));
e+=(g<0?-g:g);
g=((xb-(unsigned int)pal[f+2]));
e+=(g<0?-g:g);
if(e<c) { c=e; h=b; }
}
palmap[a]=h;
}
for(a=0;a<200;a++)
{
printf("Processing: %i%% complete \r",100*a/200/2+50);
for(b=0;b<320;b++)
{
pic[a*320+b]=palmap[pic[a*320+b]];
}
}
}
int minval(int v1,int v2,int v3)
{
if(v1<v2 && v1<v3) return(v1);
if(v2<v1 && v2<v3) return(v2);
if(v3<v1 && v3<v2) return(v3);
return(v1);
}
int maxval(int v1,int v2,int v3)
{
if(v1>v2 && v1>v3) return(v1);
if(v2>v1 && v2>v3) return(v2);
if(v3>v1 && v3>v2) return(v3);
return(v1);
}
int rgb2hsv(unsigned char *dst,unsigned char *src,int num)
{
int cr,cg,cb;
int tmp,i;
int xr,xg,xb,zh,zs,zv;
for(i=0;i<num;i++)
{
xr=*(src++);
xg=*(src++);
xb=*(src++);
/* value */
zv=maxval(xr,xg,xb);
/* saturation */
tmp=minval(xr,xg,xb);
if(zv==0) zs=0; else zs=63*(zv-tmp)/zv;
/* hue */
if(zs==0) zh=127;
else
{
cr=100*(zv-xr)/(zv-tmp);
cg=100*(zv-xg)/(zv-tmp);
cb=100*(zv-xb)/(zv-tmp);
if(xr==zv) zh=cb-cg;
if(xg==zv) zh=200+cr-cb;
if(xb==zv) zh=400+cg-cr;
if(zh<0) zh+=500;
zh/=8;
}
*(dst++)=zh;
*(dst++)=zs;
*(dst++)=zv;
}
}

BIN
GRAB/COL.EXE Normal file

Binary file not shown.

51
GRAB/DEFLBM.INC Normal file
View file

@ -0,0 +1,51 @@
db 70,79,82,77,0,1,03h,70h,73,76,66,77,66,77,72,68,0
db 0,0,20,1,64,0,200,0,0,0,0,8,0,1,0,0,255
db 1,1,1,64,0,200,67,77,65,80,0,0,3,0,0,0,0
db 0,0,171,0,171,0,0,171,171,171,0,0,171,0,171,171,87
db 0,171,171,171,87,87,87,87,87,255,87,255,87,87,255,255,255
db 87,87,255,87,255,255,255,87,255,255,255,239,239,239,223,223,223
db 211,211,211,195,195,195,183,183,183,171,171,171,155,155,155,143,143
db 143,127,127,127,115,115,115,103,103,103,87,87,87,75,75,75,59
db 59,59,47,47,47,35,35,35,255,199,199,255,167,167,255,139,139
db 255,111,111,255,83,83,255,55,55,255,27,27,255,0,0,231,0
db 0,207,0,0,183,0,0,159,0,0,135,0,0,111,0,0,87
db 0,0,67,0,0,187,255,183,159,255,155,135,255,127,107,255,103
db 79,255,75,55,255,51,27,255,23,0,255,0,0,231,0,0,207
db 0,0,183,0,0,159,0,0,135,0,0,111,0,0,87,0,0
db 67,0,255,255,207,255,255,187,251,255,167,251,255,151,251,255,131
db 251,255,115,251,255,95,251,255,79,227,231,63,203,207,47,183,183
db 35,159,163,23,139,139,15,115,115,7,91,91,0,71,71,0,183
db 179,255,155,151,255,131,127,255,103,99,255,79,75,255,51,47,255
db 27,23,255,0,0,255,0,0,231,0,0,207,0,0,183,0,0
db 159,0,0,135,0,0,111,0,0,87,0,0,67,255,211,179,255
db 203,167,255,195,155,255,187,143,255,179,131,255,171,119,255,167,107
db 255,159,95,235,143,87,215,131,79,195,119,71,175,107,63,155,95
db 55,135,83,47,115,71,43,95,59,35,255,255,255,215,255,255,179
db 255,255,143,255,255,107,255,255,71,255,255,35,255,255,0,255,255
db 0,235,235,0,215,215,0,195,195,0,175,175,0,155,155,0,135
db 135,0,115,115,0,99,99,7,0,0,7,0,0,7,0,0,7
db 0,0,7,0,0,7,0,0,7,0,0,7,0,0,7,0,0
db 7,0,0,7,0,0,7,0,0,7,0,0,7,0,0,7,0
db 0,7,0,0,131,0,255,151,0,223,163,0,191,163,0,163,151
db 0,131,139,0,103,127,0,79,115,0,59,135,255,135,155,251,63
db 223,219,0,251,179,0,251,103,0,215,103,0,179,103,0,147,95
db 0,243,147,0,215,103,0,191,71,0,167,27,0,143,0,0,123
db 0,23,99,0,39,79,0,47,0,231,187,0,219,219,0,163,211
db 0,115,203,0,67,187,23,0,155,83,0,123,91,0,71,255,159
db 175,251,123,147,251,91,123,223,83,111,195,79,99,167,71,83,139
db 59,71,111,51,59,183,223,171,159,207,147,139,191,127,123,171,115
db 111,151,99,95,135,87,83,115,75,71,99,63,255,187,99,255,163
db 47,255,143,0,227,127,0,199,111,0,175,95,0,147,79,0,123
db 67,0,239,147,255,227,71,255,223,0,255,191,0,219,163,0,187
db 131,0,151,103,0,119,75,0,87,199,199,255,163,163,255,127,127
db 255,115,115,231,103,103,211,95,95,191,83,83,171,75,75,151,239
db 255,183,219,255,91,203,255,0,175,223,0,151,191,0,123,159,0
db 99,127,0,75,95,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,199,43,43,199
db 79,43,199,119,43,199,159,43,199,199,43,159,199,43,119,199,43
db 79,199,43,43,199,51,43,199,95,43,199,139,43,199,183,43,171
db 199,43,127,199,43,83,199,47,43,199,91,43,199,135,43,199,179
db 43,199,199,43,175,199,43,131,199,43,87,199,43,43,179,147,135
db 66,79,68,89,0,1,0,64

9
GRAB/DOFLAG.BAT Normal file
View file

@ -0,0 +1,9 @@
sp d:\wc2gfx\flagship.1 -h -G
copy gfx.gfx gfx1.gfx
sp d:\wc2gfx\flagship.2 -h -G
copy gfx.gfx gfx2.gfx
sp d:\wc2gfx\flagship.3 -h -G
copy gfx.gfx gfx3.gfx
sp d:\wc2gfx\flagship.4 -h -G
copy gfx.gfx gfx4.gfx
gfx -j anim gfx1 gfx2 gfx3 gfx4

3
GRAB/DOGLVP.BAT Normal file
View file

@ -0,0 +1,3 @@
cl /AL /Ox glvp.c /link /e
lzexe glvp
copy glvp.exe c:\dos\prg

BIN
GRAB/DP_PREFS Normal file

Binary file not shown.

BIN
GRAB/E.GFX Normal file

Binary file not shown.

BIN
GRAB/E.LBM Normal file

Binary file not shown.

2269
GRAB/FG2.ASM Normal file

File diff suppressed because it is too large Load diff

BIN
GRAB/FG2.EXE Normal file

Binary file not shown.

8
GRAB/FG2.MAP Normal file
View file

@ -0,0 +1,8 @@
Start Stop Length Name Class
00000H 038DAH 038DBH CODE CODE
Program entry point at 0000:0000
Warning: No stack

2610
GRAB/FG3.ASM Normal file

File diff suppressed because it is too large Load diff

BIN
GRAB/FG3.EXE Normal file

Binary file not shown.

8
GRAB/FG3.MAP Normal file
View file

@ -0,0 +1,8 @@
Start Stop Length Name Class
00000H 03D00H 03D01H CODE CODE
Program entry point at 0000:0000
Warning: No stack

BIN
GRAB/FG3.OBJ Normal file

Binary file not shown.

843
GRAB/FGA.ASM Normal file
View file

@ -0,0 +1,843 @@
debuginc MACRO xpos
push ax
push es
mov ax,0b800h
mov es,ax
inc byte ptr es:[xpos*2]
mov byte ptr es:[xpos*2+1],17h
pop es
pop ax
ENDM
dosint MACRO fn
mov ah,fn
int 21h
ENDM
int33 MACRO
pushf
call cs:oldint8
ENDM
code SEGMENT word public 'code'
ASSUME cs:code
start: jmp main
txt db 13,10
db "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»",13,10
db "º Future-Ansi-Grabber V1.0 Copyright (C) 1992 ÀÅÙ / The Future Crew º",13,10
db "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ",13,10
db "º Press the mouse RIGHT-button to grab a TheDraw BIN (PIC???.BIM). º",13,10
db "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ",13,10
db "º In error conditions the screen (border) color is flashed: º",13,10
db "º BLUE: Disk(full) error GREEN: Invalid videomode RED: Unknown problems :-) º",13,10
db "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ",13,10
db '$'
txt2 db 13,10,'Future-Ansi-Grabber already installed!',13,10,'$'
txt3 db 13,10,'MouseDriver not found!',13,10,'$'
INTER equ 33h
INTER2 equ 28h
INTER3 equ 8h
INTER4 equ 10h
INTER5 equ 9h
oldint6 dd ? ;int 10h
oldint7 dd ? ;timer
oldint8 dd ? ;mouse int
oldint9 dd ? ;int 28h
oldint5 dd ? ;keyb
oldint dd ? ;mouse CALL
critoff dw ?
critseg dw ?
newint7 dd ? ;newtimer
whattodo db 0 ;1=savepic,2=savemem,3=menu
counter dw 0
insideint db 0
insidemenu db 0
rowlength dw 0
screenstart dw 0
splitrow dw 0
tweaked dw 0
pleasedoit db 0
lastbuttonstate dw 0
errorcols LABEL BYTE
db -1,63,0,0 ;red/unknown 0
db -1,0,28,0 ;green/videomode 1
db -1,0,0,32 ;blue/disk 2
db -1,8,8,16 ;INFO: saving mem 3
db -1,32,32,0 ;INFO: testtest 4
apu db 0
callmask dw 0
callpnt LABEL DWORD
calloff dw 0
callseg dw 0
mousex dw 0
mousey dw 0
mousegx dw 0
mousegy dw 0
mouseb dw 0
omousex dw 0
omousey dw 0
omouseb dw 0
mymin dw 0
mymax dw 0
mxmin dw 0
mxmax dw 0
defpal LABEL BYTE
db 00,00,00
db 00,00,40
db 00,40,00
db 00,40,40
db 40,00,00
db 40,00,40
db 40,20,00
db 40,40,40
db 20,20,20
db 20,20,60
db 20,60,20
db 20,60,60
db 60,20,20
db 60,20,60
db 60,60,20
db 60,60,60
normalregs db 256 dup(0) ;text mode VGA regs
main: ;DO-IT!!
mov ax,cs
mov es,ax
mov di,OFFSET normalregs
;call fromvgaregs
mov ax,cs
mov ds,ax
mov si,OFFSET normalregs
;call tovgaregs
mov ax,0
mov dx,0
int 33h
cmp dx,100h
jne notins
mov ax,cs
mov ds,ax
mov dx,OFFSET txt2
mov ah,9
int 21h
mov ah,4ch
int 21h
notins: ;chk mousedrv
mov ax,0
int 33h
cmp ax,0
jne notmouseis
mov ax,cs
mov ds,ax
mov dx,OFFSET txt3
mov ah,9
int 21h
mov ah,4ch
int 21h
notmouseis:
mov ah,34h
int 21h
mov cs:critoff,bx
mov cs:critseg,es
mov ax,cs
mov es,ax
mov ax,0ch
mov cx,0ffffh
mov dx,OFFSET intti
int 33h
cli
mov ax,0
mov es,ax
mov ax,es:[INTER*4]
mov WORD PTR cs:[oldint8+0],ax
mov ax,es:[INTER*4+2]
mov WORD PTR cs:[oldint8+0+2],ax
mov ax,OFFSET intti33
mov es:[INTER*4],ax
mov es:[INTER*4+2],cs
mov ax,es:[INTER2*4]
mov WORD PTR cs:[oldint9+0],ax
mov ax,es:[INTER2*4+2]
mov WORD PTR cs:[oldint9+0+2],ax
mov ax,OFFSET intti9
mov es:[INTER2*4],ax
mov es:[INTER2*4+2],cs
mov ax,es:[INTER5*4]
mov WORD PTR cs:[oldint5+0],ax
mov ax,es:[INTER5*4+2]
mov WORD PTR cs:[oldint5+0+2],ax
mov ax,OFFSET intti5
mov es:[INTER5*4],ax
mov es:[INTER5*4+2],cs
mov ax,es:[INTER3*4]
mov WORD PTR cs:[oldint7+0],ax
mov ax,es:[INTER3*4+2]
mov WORD PTR cs:[oldint7+0+2],ax
mov ax,OFFSET intti7
mov es:[INTER3*4],ax
mov es:[INTER3*4+2],cs
mov ax,es:[INTER4*4]
mov WORD PTR cs:[oldint6+0],ax
mov ax,es:[INTER4*4+2]
mov WORD PTR cs:[oldint6+0+2],ax
mov ax,OFFSET intti6
mov es:[INTER4*4],ax
mov es:[INTER4*4+2],cs
sti
mov ax,cs
mov ds,ax
mov ah,9
mov dx,OFFSET txt
int 21h
mov dx,16000/16
mov ah,31h
int 21h
intti33 PROC FAR
cmp ax,0
je mousecheck
cmp ax,03h
je mouseand
cmp ax,0ch
je mousesubr
cmp ax,07h
je mousexrange
cmp ax,08h
je mouseyrange
cmp ax,0fcfch
je callfgc
jmp cs:oldint8
callfgc:
call fgfunctions
iret
mousexrange:
mov cs:mxmin,cx
mov cs:mxmax,dx
int33
iret
mouseyrange:
mov cs:mymin,cx
mov cs:mymax,dx
int33
iret
mouseand:
int33
test bx,4
jz mad2
xor bx,bx ;if middlebutton pressed, lie all others are up
mad2: and bx,3
iret
mousesubr:
mov cs:callmask,cx
mov cs:callseg,es
mov cs:calloff,dx
iret
mousecheck:
push es
push cx
push dx
mov ax,cs
mov es,ax
mov ax,0ch
mov cx,-1
mov dx,OFFSET intti
int33
pop dx
pop cx
pop es
mov ax,-1
mov bx,2 ;say it's a microsoft mouse
mov dx,0100h
iret
intti33 ENDP
intti5 PROC FAR
push ax
;revive mouse
in al,21h
and al,255-16
out 21h,al
pop ax
jmp cs:oldint5
intti5 ENDP
fgfunctions PROC NEAR
push bx
push cx
push dx
push ds
push es
push si
push di
push bp
cmp bx,1
jne fgf1
mov cs:whattodo,1
call dosomething
xor ax,ax
fgf1: pop bp
pop di
pop si
pop es
pop ds
pop dx
pop cx
pop bx
ret
fgfunctions ENDP
intti6 PROC FAR
cmp ah,15
jne i6j1
pushf
call cs:oldint6
and al,127
iret
i6j1: jmp cs:oldint6
intti6 ENDP
intti7 PROC FAR ;timer
push ds
push bx
cmp cs:insideint,0
jne gnope
cmp cs:pleasedoit,0
je gnope
mov bx,cs:critoff
mov ds,cs:critseg
cmp byte ptr ds:[bx],0
jne gnope
;
inc cs:insideint
push ax
push cx
push dx
push si
push di
push bp
push es
mov cs:pleasedoit,0
mov al,20h
out 20h,al
call dosomething
pop es
pop bp
pop di
pop si
pop dx
pop cx
pop ax
dec cs:insideint
;
gnope: pop bx
pop ds
jmp cs:oldint7
ENDP
intti9 PROC FAR
cmp cs:insideint,0
jne nope9
cmp cs:pleasedoit,0
je nope9
inc cs:insideint
push ax
push bx
push cx
push dx
push si
push di
push bp
push ds
push es
mov cs:pleasedoit,0
call dosomething
pop es
pop ds
pop bp
pop di
pop si
pop dx
pop cx
pop bx
pop ax
dec cs:insideint
nope9: jmp cs:oldint9
intti9 ENDP
intti PROC FAR ;FINDMEfindme
cmp cs:insidemenu,0
je notim1
mov cs:mouseb,bx
mov cs:mousegx,cx
mov cs:mousegy,dx
shr cx,1
shr cx,1
shr cx,1
mov cs:mousex,cx
shr dx,1
shr dx,1
shr dx,1
mov cs:mousey,dx
ret
notim1: cmp cs:insideint,0
je nope10x
ret
x2nope: jmp nope
nope10x: inc cs:insideint
push ax
push bx
push cx
push dx
push si
push di
push bp
push ds
push es
mov al,20h
out 20h,al
test bx,2
jnz x2nope ;MIDDLE must be released
test cs:lastbuttonstate,2
jz x2nope ;MIDDLE had to be pressed
;middle now released, check for what was pressed
mov bx,cs:lastbuttonstate
and bx,1
cmp bx,0
je zsavelbm ;only MIDDLE pressed, <SAVELBM>
cmp bx,1+2
je zsavemem ;LEFT+RIGHT+MIDDLE pressed, <SAVEMEM>
cmp bx,2
je zrunmenu ;RIGHT+MIDDLE pressed, <RUNMENU>
cmp bx,1
je zscroll ;LEFT+MIDDLE pressed, <SCROLL>
jmp nope
zsavelbm: mov cs:whattodo,1
jmp trytodoit
zsavemem: mov cs:whattodo,1
jmp trytodoit
zrunmenu: mov cs:whattodo,1
jmp trytodoit
zscroll: mov cs:whattodo,1
jmp trytodoit
trytodoit:
mov cs:pleasedoit,1
nope: pop es
pop ds
pop bp
pop di
pop si
pop dx
pop cx
pop bx
pop ax
or cs:lastbuttonstate,bx
test bx,2
jne nope20 ;if MIDDLE button pressed, no call mask emulation
mov cs:lastbuttonstate,0
and ax,cs:callmask
je nope20
call cs:callpnt
nope20: dec cs:insideint
ret
intti ENDP
dosomething PROC NEAR
cli
mov ax,0
mov es,ax
mov ax,es:[INTER3*4]
mov WORD PTR cs:[newint7+0],ax
mov ax,es:[INTER3*4+2]
mov WORD PTR cs:[newint7+2],ax
mov ax,OFFSET intti7
mov es:[INTER3*4],ax
mov es:[INTER3*4+2],cs
sti
call getpal
sti
mov al,cs:whattodo
mov cs:whattodo,0
mov cs:lastbuttonstate,0
cmp al,1
jne dos1
call savelbm
jmp dos0
dos1: cmp al,2
jne dos2
call savemem
jmp dos0
dos2: cmp al,3
jne dos3
;call runmenu
jmp dos0
dos3: cmp al,4
jne dos4
;call scrollscrn
jmp dos0
dos4:
dos0: cli
mov ax,0
mov es,ax
mov ax,word ptr cs:[newint7+0]
mov dx,word ptr cs:[newint7+2]
mov es:[INTER3*4],ax
mov es:[INTER3*4+2],dx
sti
ret
dosomething ENDP
memname db 'MEMORY.DAT',0
destpal db 786 dup(0)
handle dw 0
filename db 'PIC000.BIN',0
deflbm1 LABEL BYTE ;main header
db 70,79,82,77, 0,0,0,0 ,73,76,66,77,66,77,72,68
; ^filelength-8
db 0,0,0,20,1,64,0,200,0,0,0,0,8,0,1,0
db 0,255,1,1,1,64,0,200,67,77,65,80,0,0,3,0
deflbm2 LABEL BYTE ;BODY header
db 66,79,68,89, 0,0,0,0
; ^bodylength
savelbm PROC NEAR
mov al,1
call setpal
sti
mov cs:filename[3],'0'
mov cs:filename[4],'0'
mov cs:filename[5],'1'
mov ah,0fh
int 10h
cmp al,4
jb dispok
jmp sdispfail
dispok: mov ax,cs
mov ds,ax
sp2: mov ax,3d01h
mov dx,OFFSET filename
int 21h
jc sp1 ;not exists
mov bx,ax
mov ah,3eh
int 21h
inc cs:filename[5]
cmp cs:filename[5],'9'
jna spn1
mov cs:filename[5],'0'
inc cs:filename[4]
cmp cs:filename[4],'9'
jna spn1
mov cs:filename[4],'0'
inc cs:filename[3]
spn1: jmp sp2
sp1: ;create
mov ax,3c01h
mov cx,0
mov dx,OFFSET filename
int 21h
jc spfail
;opened ok
mov cs:handle,ax
call savelbmdata
mov bx,cs:handle
mov ah,3eh
int 21h
mov al,0
call setpal
ret
spfail: mov al,2
call errorpal
ret
sdispfail:
mov al,1
call errorpal
ret
savelbm ENDP
getpal PROC NEAR
cli
mov ax,cs
mov ds,ax
mov dx,03dah
rws1: in al,dx
test al,8
jz rws1
rws2: in al,dx
test al,8
jnz rws2
xor ax,ax
mov dx,3c7h
out dx,al
mov si,OFFSET destpal
mov cx,768
mov dx,3c9h
rwag: in al,dx
shl al,1
shl al,1
mov ds:[si],al
inc si
loop rwag
sti
ret
getpal ENDP
waitborder PROC NEAR
mov dx,03dah
rrws1: in al,dx
test al,8
jz rrws1
rrws2: in al,dx
test al,8
jnz rrws2
ret
waitborder ENDP
errorpal PROC NEAR
cli
mov cs:apu,al
mov si,ax
and si,127
shl si,1
shl si,1
add si,OFFSET errorcols
call waitborder
mov ax,cs
mov ds,ax
xor al,al
mov dx,3c8h
out dx,al
inc dx
mov cx,256
epal1: mov al,ds:[si+1]
out dx,al
mov al,ds:[si+2]
out dx,al
mov al,ds:[si+3]
out dx,al
loop epal1
test cs:apu,128
jz epal3
sti
ret
epal3: mov cx,30
epal2: call waitborder
loop epal2
mov al,0
call setpal
sti
ret
errorpal ENDP
greypal PROC NEAR
push cx
push dx
push ax
xor al,al
mov dx,3c8h
out dx,al
inc dx
pop ax
mov cx,256*3
gpal1: out dx,al
loop gpal1
pop dx
pop cx
ret
greypal ENDP
setpal PROC NEAR
cli
mov cs:apu,al
mov ax,cs
mov ds,ax
call waitborder
xor ax,ax
mov dx,3c8h
out dx,al
mov si,OFFSET destpal
mov cx,768
mov dx,3c9h
mov ah,cs:apu
rrwag: mov al,ds:[si]
shr al,1
shr al,1
cmp ah,0
je rrwag2
xor al,31 ;to create the flashing
rrwag2: out dx,al
inc si
loop rrwag
sti
ret
setpal ENDP
ALIGN 2
prow db 330 dup(0) ;packed row/screen row
row db 8*40 dup(0) ;bitmapped row
datalen dw 0,0
hilolen db 0,0,0,0
getsirow PROC NEAR
mov bp,cs:screenstart
cmp si,cs:splitrow
jb gsr0
sub si,cs:splitrow
xor bp,bp
gsr0: ;row si => es:prow (†††)
cmp cs:tweaked,0
jne gsr1
mov ax,si
mul cs:rowlength
mov si,ax
add si,bp
mov di,OFFSET prow
mov cx,160
rep movsw
ret
gsr1: mov di,OFFSET prow
mov ax,si
mul cs:rowlength
mov si,ax
add si,bp
mov dx,3ceh
mov al,4
out dx,al
inc dx
in al,dx
push ax
mov ax,0004h
gsr3: mov dx,3ceh
out dx,ax
push ax
push di
push si
mov cx,80
gsr2: mov al,ds:[si]
mov es:[di],al
add di,4
inc si
loop gsr2
pop si
pop di
pop ax
inc di
inc ah
cmp ah,4
jb gsr3
mov dx,3ceh
mov al,4
out dx,al
inc dx
pop ax
out dx,al
ret
getsirow ENDP
savelbmdata PROC NEAR
mov ax,cs
mov ds,ax
mov ax,0b800h
mov es,ax
xor si,si
mov cx,25
slb2: push cx
mov cx,80
xor bx,bx
slb1: mov ax,es:[si]
mov word ptr ds:prow[bx],ax
add si,2
add bx,2
loop slb1
;save row to file
mov bx,cs:handle
mov ah,40h
mov dx,OFFSET prow
mov cx,160
int 21h
pop cx
loop slb2
ret
savelbmdata ENDP
savemem PROC NEAR
mov al,3+128
call errorpal
mov dx,cs
mov ds,dx
mov dx,OFFSET memname
mov cx,32
dosint 3ch
jc error
mov cs:[handle],ax
mov cx,20
mov bx,0
maga: mov ds,bx
mov dx,0
push cx
push bx
mov cx,32768
mov bx,cs:[handle]
dosint 40h
cmp ax,32768
jne error3
jc error3
pop bx
pop cx
add bx,2048
mov al,bh
rol al,1
rol al,1
xor al,bh
call greypal
loop maga
mov bx,cs:[handle]
dosint 3eh
jc error
jmp iover
error3: pop bx
pop cx
error: mov al,2
call errorpal
ret
iover: mov al,0
call setpal
ret
savemem ENDP
code ENDS
END

2276
GRAB/FGOK.ASM Normal file

File diff suppressed because it is too large Load diff

2272
GRAB/FGPAL.ASM Normal file

File diff suppressed because it is too large Load diff

BIN
GRAB/FGPAL.EXE Normal file

Binary file not shown.

8
GRAB/FGPAL.MAP Normal file
View file

@ -0,0 +1,8 @@
Start Stop Length Name Class
00000H 039CCH 039CDH CODE CODE
Program entry point at 0000:0000
Warning: No stack

BIN
GRAB/FLIC/AA.CFG Normal file

Binary file not shown.

BIN
GRAB/FLIC/ANIM.FCA Normal file

Binary file not shown.

165
GRAB/FLIC/FLI.FOR Normal file
View file

@ -0,0 +1,165 @@
Autodesk Animator files explanation (.FLI only excerpted). I believe
that the original programmer wrote up this doc. It's correct, as I've
used the info to realtime playback stock .FLIs on a 680x0 machine.
All numbers in a .FLI file are in Intel format, so you may have to
compensate for that, of course. - kevin
8.1 Flic Files (.FLI)
The details of a FLI file are moderately complex, but the
idea behind it is simple: don't bother storing the parts of a
frame that are the same as the last frame. Not only does this
save space, but it's very quick. It's faster to leave a pixel
alone than to set it.
A FLI file has a 128-byte header followed by a sequence of
frames. The first frame is compressed using a bytewise run-length
compression scheme. Subsequent frames are stored as the
difference from the previous frame. (Occasionally the first
frame and/or subsequent frames are uncompressed.) There is one
extra frame at the end of a FLI which contains the difference
between the last frame and the first frame.
The FLI header:
byte size name meaning
offset
0 4 size Length of file, for programs that want
to read the FLI all at once if possible.
4 2 magic Set to hex AF11. Please use another
value here if you change format (even to
a different resolution) so Autodesk
Animator won't crash trying to read it.
6 2 frames Number of frames in FLI. FLI files have
a maxium length of 4000 frames.
8 2 width Screen width (320).
10 2 height Screen height (200).
12
14 2 flags Must be 0.
16 2 speed Number of video ticks between frames.
18 4 next Set to 0.
22 4 frit Set to 0.
26 102 expand All zeroes -- for future enhancement.
Next are the frames, each of which has a header:
byte size name meaning
offset
0 4 size Bytes in this frame. Autodesk Animator
demands that this be less than 64K.
4 2 magic Always hexadecimal F1FA
6 2 chunks Number of 'chunks' in frame.
8 8 expand Space for future enhancements. All zeros.
After the frame header come the chunks that make up the
frame. First comes a color chunk if the color map has changed
from the last frame. Then comes a pixel chunk if the pixels have
changed. If the frame is absolutely identical to the last frame
there will be no chunks at all.
A chunk itself has a header, followed by the data. The
chunk header is:
byte size name meaning
offset
0 4 size Bytes in this chunk.
4 2 type Type of chunk (see below).
There are currently five types of chunks you'll see in a FLI
file:
number name meaning
11 FLI_COLOR Compressed color map
12 FLI_LC Line compressed -- the most common type
of compression for any but the first
frame. Describes the pixel difference
from the previous frame.
13 FLI_BLACK Set whole screen to color 0 (only occurs
on the first frame).
15 FLI_BRUN Bytewise run-length compression -- first
frame only
16 FLI_COPY Indicates uncompressed 64000 bytes soon
to follow. For those times when
compression just doesn't work!
The compression schemes are all byte-oriented. If the
compressed data ends up being an odd length a single pad byte is
inserted so that the FLI_COPY's always start at an even address
for faster DMA.
FLI_COLOR Chunks
The first word is the number of packets in this chunk. This
is followed directly by the packets. The first byte of a packet
says how many colors to skip. The next byte says how many colors
to change. If this byte is zero it is interpreted to mean 256.
Next follows 3 bytes for each color to change (one each for red,
green and blue).
FLI_LC Chunks
This is the most common, and alas, most complex chunk. The
first word (16 bits) is the number of lines starting from the top
of the screen that are the same as the previous frame. (For
example, if there is motion only on the bottom line of screen
you'd have a 199 here.) The next word is the number of lines
that do change. Next there is the data for the changing lines
themselves. Each line is compressed individually; among other
things this makes it much easier to play back the FLI at a
reduced size.
The first byte of a compressed line is the number of packets
in this line. If the line is unchanged from the last frame this
is zero. The format of an individual packet is:
skip_count
size_count
data
The skip count is a single byte. If more than 255 pixels
are to be skipped it must be broken into 2 packets. The size
count is also a byte. If it is positive, that many bytes of data
follow and are to be copied to the screen. If it's negative a
single byte follows, and is repeated -skip_count times.
In the worst case a FLI_LC frame can be about 70K. If it
comes out to be 60000 bytes or more Autodesk Animator decides
compression isn't worthwhile and saves the frame as FLI_COPY.
FLI_BLACK Chunks
These are very simple. There is no data associated with
them at all. In fact they are only generated for the first frame
in Autodesk Animator after the user selects NEW under the FLIC menu.
FLI_BRUN Chunks
These are much like FLI_LC chunks without the skips. They
start immediately with the data for the first line, and go line-
by-line from there. The first byte contains the number of
packets in that line. The format for a packet is:
size_count
data
If size_count is positive the data consists of a single byte
which is repeated size_count times. If size_count is negative
there are -size_count bytes of data which are copied to the
screen. In Autodesk Animator if the "compressed" data shows signs
of exceeding 60000 bytes the frame is stored as FLI_COPY instead.
FLI_COPY Chunks
These are 64000 bytes of data for direct reading onto the
screen.
-eof-
Notes: Since these are animations, the last frame will delta into a
copy of the first one (which was usually a large BRUN chunk). Therefore,
looping should go back to the _second_ frame chunk (usually a LC
or COLOR chunk) instead of all the way back to the file beginning, to
avoid a "stutter" caused by unnecessarily redecoding the original frame.
Also, a very few files may have palette animation, so write your code
so that COLOR chunks can be found at any time. - kevin

1
GRAB/FLIC/KOE.BAT Normal file
View file

@ -0,0 +1 @@
vw2 d:\3ds\images\fcsten.fli

BIN
GRAB/FLIC/PIC000.LBM Normal file

Binary file not shown.

33
GRAB/FLIC/SHOW.C Normal file
View file

@ -0,0 +1,33 @@
#include <stdio.h>
char far *vram=(char far *)0xa0000000L;
main()
{
unsigned int u;
int xit=0;
int a,b,c;
FILE *f1;
f1=fopen("anim.fca","rb");
_asm mov ax,13h
_asm int 10h
outp(0x3c8,0);
for(a=0;a<768;a++) outp(0x3c9,getc(f1));
while(!kbhit() && !xit)
{
u=0;
for(;;)
{
a=getc(f1);
if(a==254) { xit=1; break; }
else if(a==255) break;
else
{
u+=a;
c=getc(f1);
while(c--) vram[u++]=getc(f1);
}
}
}
fclose(f1);
}

BIN
GRAB/FLIC/SHOW.EXE Normal file

Binary file not shown.

3
GRAB/FLIC/VF Normal file
View file

@ -0,0 +1,3 @@
vf.exe : vf.c
qcl /AL vf.c

369
GRAB/FLIC/VF.C Normal file
View file

@ -0,0 +1,369 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
unsigned char far *vram=(char far *)0xa0000000;
int blocksleft=999;
int wid,hig,pics;
long cnt[256];
char lookup[256];
char palette[768];
char ownpal[768];
int docoltable;
int colorlookup;
int oktoviewpal;
int useownpal;
int savefcp;
FILE *out;
main(int argc,char *argv[])
{
int a;
FILE *f1;
out=fopen("fcp","wb");
if(out==NULL) return(0);
f1=fopen(argv[1],"rb");
if(f1==NULL) return(0);
_asm mov ax,19
_asm int 10h
for(a=0;a<256;a++) lookup[a]=a;
docoltable=1;
oktoviewpal=0;
useownpal=0;
savefcp=0;
rewind(f1); readflic(f1,0);
{
long ol,l;
int a;
ol=hig*(wid+8)+10+2;
fprintf(out,"FCP\x1a");
putc(0x10,out);
putc(0x01,out);
putw(pics,out);
for(a=0;a<pics;a++)
{
l=8L+pics*4L+768L+ol*a;
putw(l&65535,out);
putw(l>>16,out);
}
}
donewpalette(256-32,31);
for(a=0;a<768;a++)
{
putc(ownpal[a],out);
}
docoltable=0;
oktoviewpal=1;
useownpal=1;
savefcp=1;
rewind(f1); readflic(f1,0);
_asm mov ax,3
_asm int 10h
fclose(f1);
}
int brightcmp(unsigned char *s1,unsigned char *s2)
{
int v1,v2;
v1=*s1+*(s1+1)+*(s1+2);
v2=*s2+*(s2+1)+*(s2+2);
if(v1<v2) return(-1);
else if(v1>v2) return(1);
else return(0);
}
int donewpalette(int first,int num)
{
int cc,c,c2,a;
int d,rr,gg,bb;
long ba;
int bi,bd;
memset(ownpal,0,768);
for(cc=0;cc<num;cc++)
{
printf("done: %i/%i \r",cc,num);
ba=bi=0;
for(c=0;c<256;c++)
{
rr=palette[c*3+0];
gg=palette[c*3+1];
bb=palette[c*3+2];
if(rr!=0 && gg!=0 && bb!=0 && cnt[c]>ba)
{
ba=cnt[c];
bi=c;
}
}
cnt[bi]=0;
memcpy(ownpal+cc*3,palette+bi*3,3);
}
/* sort by brightness/move */
qsort(ownpal,num,3,brightcmp);
/* create lookup index */
for(cc=0;cc<256;cc++)
{
bi=0; bd=32767;
rr=palette[cc*3+0];
gg=palette[cc*3+1];
bb=palette[cc*3+2];
if(rr==0 && gg==0 && bb==0) lookup[cc]=0;
else
{
for(c=0;c<num;c++)
{
d=0;
a=ownpal[c*3+0]-rr; if(a<0) d+=-a; else d+=a;
a=ownpal[c*3+1]-gg; if(a<0) d+=-a; else d+=a;
a=ownpal[c*3+2]-bb; if(a<0) d+=-a; else d+=a;
if(d<bd)
{
bd=d;
bi=c;
}
}
lookup[cc]=bi+first;
}
}
memmove(ownpal+first*3,ownpal,num*3);
memset(ownpal,0,first*3);
}
int readflic(FILE *f1,int flag)
{
int a;
long len,l,ll;
len=getw(f1);
len+=(long)getw(f1)<<16;
getw(f1);
pics=getw(f1);
wid=getw(f1);
hig=getw(f1);
fseek(f1,0x80L,SEEK_SET);
printf("\n\n\n\n\n\n\n\n\n\n\n");
for(;;)
{
l=ftell(f1);
l+=(long)getw(f1);
l+=(long)getw(f1)<<16;
a=getw(f1);
if(feof(f1)) break;
if(a==0xf1fa)
{
int a;
blocksleft=getw(f1);
for(a=0;a<8;a++) getc(f1);
ll=l;
}
else
{
doblock(f1,(unsigned)a);
fseek(f1,l,SEEK_SET);
blocksleft--;
if(blocksleft==0)
{
fseek(f1,ll,SEEK_SET);
{
int x,y;
unsigned u;
for(y=0;y<hig;y++)
{
u=y*320;
for(x=0;x<wid;x++) cnt[vram[u++]]++;
}
}
if(savefcp)
{
static int framecnt=0;
int x,y;
printf("Frame:%i\r",framecnt++);
/* save fcp */
putc(0x10,out);
putc(0x0f,out);
putw(0,out);
putw(0,out);
putw(wid-1,out);
putw(hig-1,out);
for(y=0;y<hig;y++)
{
putw(y,out);
putw(0,out);
putw(1,out);
putw(wid,out);
for(x=0;x<wid;x++) putc(vram[y*320+x],out);
}
putw(32768,out);
}
if(flag&1) getch();
}
}
}
}
int viewpal(void)
{
int a;
unsigned u;
for(a=0;a<256;a++)
{
u=(a>>4)*3+320-48+((a&15)*3+200-48)*320;
vram[u]=a;
vram[u+1]=a;
vram[u+2]=a;
vram[320+u]=a;
vram[320+u+1]=a;
vram[320+u+2]=a;
vram[640+u]=a;
vram[640+u+1]=a;
vram[640+u+2]=a;
}
}
int doblock(FILE *f1,unsigned type)
{
if((type==0x000b || type==0x0004) && useownpal)
{
int a;
outp(0x3c8,0);
for(a=0;a<768;a++) outp(0x3c9,ownpal[a]);
if(oktoviewpal) viewpal();
return(0);
}
if(type==0x000b)
{
int a,c,d;
c=getc(f1)*256; /* count */
c+=getc(f1);
c*=3;
a=getc(f1)*256; /* first */
a+=getc(f1);
outp(0x3c8,a);
for(a=0;a<c;a++) outp(0x3c9,palette[a]=getc(f1));
if(oktoviewpal) viewpal();
}
else if(type==0x0004)
{
int a,c,d;
c=getc(f1)*256; /* count */
c+=getc(f1);
c*=3;
a=getc(f1)*256; /* first */
a+=getc(f1);
outp(0x3c8,a);
for(a=0;a<c;a++) outp(0x3c9,palette[a]=(getc(f1)>>2));
if(oktoviewpal) viewpal();
}
else if(type==0x000c)
{
int a,b,c,lc,cc,cm,lb,le,lad;
long l;
unsigned int u;
lb=getw(f1);
le=lb+getw(f1);
for(lc=lb;lc<le;lc++)
{
cm=getc(f1);
u=lc*320;
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
u+=a;
a=getc(f1);
if(a<0x80)
{
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
}
else
{
a=256-a;
b=lookup[getc(f1)];
for(c=0;c<a;c++) vram[u++]=b;
}
}
}
u=0;
}
else if(type==0x0007)
{
int a,b,b1,b2,c,lc,cc,cm,lb,le,lad;
int skipcnt;
long l;
unsigned int u;
le=getw(f1);
for(lc=lad=0;lc<le;lc++)
{
cm=getw(f1);
while(cm<0)
{
lad=320*-cm;
cm=getw(f1);
}
u=lc*320+lad;
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
u+=a;
a=getc(f1);
if(a<0x80)
{
for(c=0;c<a;c++)
{
vram[u++]=lookup[getc(f1)];
vram[u++]=lookup[getc(f1)];
}
}
else
{
a=256-a;
b1=lookup[getc(f1)];
b2=lookup[getc(f1)];
for(c=0;c<a;c++)
{
vram[u++]=b1;
vram[u++]=b2;
}
}
}
}
u=0;
}
else if(type==0x000f)
{
int a,b,c,lc,cc,cm;
long l;
unsigned int u;
for(lc=0;lc<hig;lc++)
{
u=lc*320;
cm=getc(f1);
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
if(a<0x80)
{
b=lookup[getc(f1)];
for(c=0;c<a;c++) vram[u++]=b;
}
else
{
a=256-a;
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
}
}
}
u=0;
}
else
{
printf("UNKNOWN BLOCK TYPE: %04X\n",type);
getch();
}
}

BIN
GRAB/FLIC/VF.EXE Normal file

Binary file not shown.

339
GRAB/FLIC/VFLI.C Normal file
View file

@ -0,0 +1,339 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
unsigned char far *vram=(char far *)0xa0000000;
int blocksleft=999;
int wid,hig,pics;
long cnt[256];
char lookup[256];
char palette[768];
char ownpal[768];
int docoltable;
int colorlookup;
int oktoviewpal;
int useownpal;
int savefcp;
FILE *out;
main(int argc,char *argv[])
{
int a;
FILE *f1;
f1=fopen(argv[1],"rb");
if(f1==NULL) return(0);
_asm mov ax,19
_asm int 10h
for(a=0;a<256;a++) lookup[a]=a;
docoltable=1;
oktoviewpal=0;
useownpal=0;
savefcp=0;
rewind(f1); readflic(f1,0);
donewpalette(256-32,31);
docoltable=0;
oktoviewpal=1;
useownpal=1;
savefcp=1;
rewind(f1); readflic(f1,0);
_asm mov ax,3
_asm int 10h
fclose(f1);
}
int brightcmp(unsigned char *s1,unsigned char *s2)
{
int v1,v2;
v1=*s1+*(s1+1)+*(s1+2);
v2=*s2+*(s2+1)+*(s2+2);
if(v1<v2) return(-1);
else if(v1>v2) return(1);
else return(0);
}
int donewpalette(int first,int num)
{
int cc,c,c2,a;
int d,rr,gg,bb;
long ba;
int bi,bd;
memset(ownpal,0,768);
for(cc=0;cc<num;cc++)
{
/*printf("done: %i/%i \r",cc,num);*/
ba=bi=0;
for(c=0;c<256;c++)
{
rr=palette[c*3+0];
gg=palette[c*3+1];
bb=palette[c*3+2];
if(rr!=0 && gg!=0 && bb!=0 && cnt[c]>ba)
{
ba=cnt[c];
bi=c;
}
}
cnt[bi]=0;
memcpy(ownpal+cc*3,palette+bi*3,3);
}
/* sort by brightness/move */
qsort(ownpal,num,3,brightcmp);
/* create lookup index */
for(cc=0;cc<256;cc++)
{
bi=0; bd=32767;
rr=palette[cc*3+0];
gg=palette[cc*3+1];
bb=palette[cc*3+2];
if(rr==0 && gg==0 && bb==0) lookup[cc]=0;
else
{
for(c=0;c<num;c++)
{
d=0;
a=ownpal[c*3+0]-rr; if(a<0) d+=-a; else d+=a;
a=ownpal[c*3+1]-gg; if(a<0) d+=-a; else d+=a;
a=ownpal[c*3+2]-bb; if(a<0) d+=-a; else d+=a;
if(d<bd)
{
bd=d;
bi=c;
}
}
lookup[cc]=bi+first;
}
}
memmove(ownpal+first*3,ownpal,num*3);
memset(ownpal,0,first*3);
}
int readflic(FILE *f1,int flag)
{
int a;
long len,l,ll;
len=getw(f1);
len+=(long)getw(f1)<<16;
getw(f1);
pics=getw(f1);
wid=getw(f1);
hig=getw(f1);
fseek(f1,0x80L,SEEK_SET);
/*printf("\n\n\n\n\n\n\n\n\n\n\n");*/
for(;;)
{
l=ftell(f1);
l+=(long)getw(f1);
l+=(long)getw(f1)<<16;
a=getw(f1);
if(feof(f1)) break;
if(a==0xf1fa)
{
int a;
blocksleft=getw(f1);
for(a=0;a<8;a++) getc(f1);
ll=l;
}
else
{
doblock(f1,(unsigned)a);
fseek(f1,l,SEEK_SET);
blocksleft--;
if(blocksleft==0)
{
fseek(f1,ll,SEEK_SET);
{
int x,y;
unsigned u;
for(y=0;y<hig;y++)
{
u=y*320;
for(x=0;x<wid;x++) cnt[vram[u++]]++;
}
}
if(savefcp)
{
static int framecnt=0;
int x,y;
{
outp(0x3c8,7);
outp(0x3c9,47);
outp(0x3c9,47);
outp(0x3c9,47);
printf("Saveframe:%i\r",framecnt++);
}
}
if(flag&1) getch();
}
}
}
}
int viewpal(void)
{
int a;
unsigned u;
for(a=0;a<256;a++)
{
u=(a>>4)*3+320-48+((a&15)*3+200-48)*320;
vram[u]=a;
vram[u+1]=a;
vram[u+2]=a;
vram[320+u]=a;
vram[320+u+1]=a;
vram[320+u+2]=a;
vram[640+u]=a;
vram[640+u+1]=a;
vram[640+u+2]=a;
}
}
int doblock(FILE *f1,unsigned type)
{
if((type==0x000b || type==0x0004) && useownpal)
{
int a;
outp(0x3c8,0);
for(a=0;a<768;a++) outp(0x3c9,ownpal[a]);
if(oktoviewpal) viewpal();
return(0);
}
if(type==0x000b)
{
int a,c,d;
c=getc(f1)*256; /* count */
c+=getc(f1);
c*=3;
a=getc(f1)*256; /* first */
a+=getc(f1);
outp(0x3c8,a);
for(a=0;a<c;a++) outp(0x3c9,palette[a]=getc(f1));
if(oktoviewpal) viewpal();
}
else if(type==0x0004)
{
int a,c,d;
c=getc(f1)*256; /* count */
c+=getc(f1);
c*=3;
a=getc(f1)*256; /* first */
a+=getc(f1);
outp(0x3c8,a);
for(a=0;a<c;a++) outp(0x3c9,palette[a]=(getc(f1)>>2));
if(oktoviewpal) viewpal();
}
else if(type==0x000c)
{
int a,b,c,lc,cc,cm,lb,le,lad;
long l;
unsigned int u;
lb=getw(f1);
le=lb+getw(f1);
for(lc=lb;lc<le;lc++)
{
cm=getc(f1);
u=lc*320;
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
u+=a;
a=getc(f1);
if(a<0x80)
{
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
}
else
{
a=256-a;
b=lookup[getc(f1)];
for(c=0;c<a;c++) vram[u++]=b;
}
}
}
u=0;
}
else if(type==0x0007)
{
int a,b,b1,b2,c,lc,cc,cm,lb,le,lad;
int skipcnt;
long l;
unsigned int u;
le=getw(f1);
for(lc=lad=0;lc<le;lc++)
{
cm=getw(f1);
while(cm<0)
{
lad=320*-cm;
cm=getw(f1);
}
u=lc*320+lad;
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
u+=a;
a=getc(f1);
if(a<0x80)
{
for(c=0;c<a;c++)
{
vram[u++]=lookup[getc(f1)];
vram[u++]=lookup[getc(f1)];
}
}
else
{
a=256-a;
b1=lookup[getc(f1)];
b2=lookup[getc(f1)];
for(c=0;c<a;c++)
{
vram[u++]=b1;
vram[u++]=b2;
}
}
}
}
u=0;
}
else if(type==0x000f)
{
int a,b,c,lc,cc,cm;
long l;
unsigned int u;
for(lc=0;lc<hig;lc++)
{
u=lc*320;
cm=getc(f1);
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
if(a<0x80)
{
b=lookup[getc(f1)];
for(c=0;c<a;c++) vram[u++]=b;
}
else
{
a=256-a;
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
}
}
}
u=0;
}
else
{
printf("UNKNOWN BLOCK TYPE: %04X\n",type);
getch();
}
}

BIN
GRAB/FLIC/VFLI.EXE Normal file

Binary file not shown.

221
GRAB/FLIC/VFOK.C Normal file
View file

@ -0,0 +1,221 @@
#include <stdio.h>
char far *vram=(char far *)0xa0000000;
int blocksleft=999;
int wid,hig,pics;
main(int argc,char *argv[])
{
FILE *f1;
int a;
long len,l,ll;
f1=fopen(argv[1],"rb");
if(f1==NULL) return(0);
_asm mov ax,19
_asm int 10h
len=getw(f1);
len+=(long)getw(f1)<<16;
getw(f1);
pics=getw(f1);
wid=getw(f1);
hig=getw(f1);
fseek(f1,0x80L,SEEK_SET);
printf("\n\n\n\n\n\n\n\n\n\n\n");
for(;;)
{
l=ftell(f1);
l+=(long)getw(f1);
l+=(long)getw(f1)<<16;
a=getw(f1);
if(feof(f1)) break;
if(a==0xf1fa)
{
int a;
blocksleft=getw(f1);
for(a=0;a<8;a++) getc(f1);
ll=l;
}
else
{
doblock(f1,(unsigned)a);
fseek(f1,l,SEEK_SET);
blocksleft--;
if(blocksleft==0)
{
fseek(f1,ll,SEEK_SET);
getch();
}
}
}
_asm mov ax,3
_asm int 10h
fclose(f1);
}
int viewpal(void)
{
int a;
unsigned u;
for(a=0;a<256;a++)
{
u=(a>>4)*3+320-48+((a&15)*3+200-48)*320;
vram[u]=a;
vram[u+1]=a;
vram[u+2]=a;
vram[320+u]=a;
vram[320+u+1]=a;
vram[320+u+2]=a;
vram[640+u]=a;
vram[640+u+1]=a;
vram[640+u+2]=a;
}
}
int doblock(FILE *f1,unsigned type)
{
if(type==0x000b)
{
int a,c,d;
c=getc(f1)*256; /* count */
c+=getc(f1);
c*=3;
a=getc(f1)*256; /* first */
a+=getc(f1);
outp(0x3c8,a);
for(a=0;a<c;a++) outp(0x3c9,getc(f1));
viewpal();
}
else if(type==0x0004)
{
int a,c,d;
c=getc(f1)*256; /* count */
c+=getc(f1);
c*=3;
a=getc(f1)*256; /* first */
a+=getc(f1);
outp(0x3c8,a);
for(a=0;a<c;a++) outp(0x3c9,getc(f1)>>2);
viewpal();
}
else if(type==0x000c)
{
int a,b,c,lc,cc,cm,lb,le,lad;
long l;
unsigned int u;
lb=getw(f1);
le=lb+getw(f1);
for(lc=lb;lc<le;lc++)
{
cm=getc(f1);
u=lc*320;
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
u+=a;
a=getc(f1);
if(a<0x80)
{
for(c=0;c<a;c++) vram[u++]=getc(f1);
}
else
{
a=256-a;
b=getc(f1);
for(c=0;c<a;c++) vram[u++]=b;
}
}
if(u>64000 || kbhit()) break;
}
u=0;
}
else if(type==0x0007)
{
int a,b,b1,b2,c,lc,cc,cm,lb,le,lad;
int skipcnt,flag=0;
long l;
unsigned int u;
le=getw(f1);
for(lc=lad=0;lc<le;lc++)
{
cm=getw(f1);
while(cm<0)
{
lad=320*-cm;
cm=getw(f1);
}
u=lc*320+lad;
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
u+=a;
a=getc(f1);
if(a<0x80)
{
for(c=0;c<a;c++)
{
vram[u++]=getc(f1);
vram[u++]=getc(f1);
}
}
else
{
a=256-a;
b1=getc(f1);
b2=getc(f1);
for(c=0;c<a;c++)
{
vram[u++]=b1;
vram[u++]=b2;
}
}
if(flag) getch();
}
if(u>64000 || kbhit()) break;
}
u=0;
}
else if(type==0x000f)
{
int a,b,c,lc,cc,cm;
long l;
unsigned int u;
for(lc=0;lc<hig;lc++)
{
u=lc*320;
cm=getc(f1);
for(cc=0;cc<cm && u<64000;cc++)
{
a=getc(f1);
if(a<0x80)
{
b=getc(f1);
for(c=0;c<a;c++) vram[u++]=b;
}
else
{
a=256-a;
for(c=0;c<a;c++) vram[u++]=getc(f1);
}
}
if(u>64000 || kbhit()) break;
}
u=0;
/*for(a=0;a<200;a+=2)
{
vram[a*320]=15;
vram[a*320+321]=14;
}
for(a=0;a<320;a+=2)
{
vram[a]=15;
vram[a+201]=14;
}*/
}
else
{
printf("UNKNOWN BLOCK TYPE: %04X\n",type);
getch();
}
}

233
GRAB/FLIC/VW.C Normal file
View file

@ -0,0 +1,233 @@
/* view flic */
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <memory.h>
int doframe(FILE *f1);
int dochunk(FILE *f1);
int doline1(unsigned u,FILE *f1);
int doline2(unsigned u,FILE *f1);
int saveframe(int frame);
char far *vram=(char far *)0xa0000000L;
char buf[64000];
char pal[768];
char savebuf[64000];
int lw;
struct
{
long filesize;
unsigned magic; /* 0xaf11 */
int frames;
int width;
int heigth;
int RESERVED1;
int flags; /*0*/
int speed;
long next; /*0*/
long frit; /*0*/
char RESERVED2[102];
} header;
struct
{
long size;
unsigned magic; /* 0xf1fa */
int chunks;
int RESERVED[4];
} frameheader;
struct
{
long size;
unsigned type;
} chunkheader;
main(int argc,char *argv[])
{
FILE *f1;
int f;
f1=fopen(argv[1],"rb");
if(f1==NULL) return(0);
fread(&header,sizeof(header),1,f1);
lw=header.heigth;
/**/
_asm mov ax,13h
_asm int 10h
saveframe(-1);
for(f=0;f<header.frames;f++)
{
doframe(f1);
saveframe(f);
}
saveframe(-2);
/**/
fclose(f1);
return(0);
}
int doframe(FILE *f1)
{
int c;
long framestart;
framestart=ftell(f1);
fread(&frameheader,sizeof(frameheader),1,f1);
for(c=0;c<frameheader.chunks;c++) dochunk(f1);
fseek(f1,framestart+frameheader.size,SEEK_SET);
return(0);
}
int dochunk(FILE *f1)
{
unsigned u;
int a,b,c;
long chunkstart;
chunkstart=ftell(f1);
fread(&chunkheader,sizeof(chunkheader),1,f1);
switch(chunkheader.type)
{
case 11 : /* FLI_COLOR */
c=getw(f1);
a=0;
while(c--)
{
a+=getc(f1);
b=getc(f1); if(!b) b=256;
outp(0x3c8,a);
while(b--)
{
outp(0x3c9,getc(f1));
outp(0x3c9,getc(f1));
outp(0x3c9,getc(f1));
}
}
break;
case 12 : /* FLI_LC */
u=getw(f1)*lw;
c=getw(f1);
while(c--)
{
doline1(u,f1);
u+=lw;
}
break;
case 13 : /* FLI_BLACK */
memset(vram,0,64000U);
break;
case 15 : /* FLI_BRUN */
u=0;
c=200;
while(c--)
{
doline2(u,f1);
u+=lw;
}
break;
case 16 : /* FLI_COPY */
fread(buf,1,64000U,f1);
memcpy(vram,buf,64000U);
break;
}
fseek(f1,chunkstart+chunkheader.size,SEEK_SET);
return(0);
}
int doline1(unsigned u,FILE *f1)
{
int a,b,c;
c=getc(f1);
while(c--)
{
u+=getc(f1);
b=(char)getc(f1);
if(b>0)
{
while(b--) vram[u++]=(char)getc(f1);
}
else
{
a=getc(f1);
while(b++) vram[u++]=(char)a;
}
}
return(0);
}
int doline2(unsigned u,FILE *f1)
{
int a,b,c;
c=getc(f1);
while(c--)
{
b=(char)getc(f1);
if(b<0)
{
while(b++) vram[u++]=(char)getc(f1);
}
else
{
a=getc(f1);
while(b--) vram[u++]=(char)a;
}
}
return(0);
}
int saveframe(int frame)
{
unsigned u,u0,ua;
int a,b,c;
static FILE *fo;
switch(frame)
{
case -1 : /* open */
fo=fopen("anim.fca","wb");
break;
case -2 : /* close */
putc(254,fo);
fclose(fo);
break;
default : /* save */
if(frame==0)
{
outp(0x3c7,0);
for(a=0;a<768;a++) pal[a]=(char)inp(0x3c9);
memset(savebuf,0,64000U);
fwrite(pal,1,768U,fo);
}
{
for(u0=u=0;u<64000;u++)
{
if(vram[u]!=savebuf[u])
{
ua=u-u0;
while(ua>253)
{
putc(253,fo);
putc(0,fo);
ua-=253;
}
putc(ua,fo);
for(a=0;a<255 && (unsigned)a+u<64000;a++)
{
if(vram[u+a]==savebuf[u+a]) break;
}
putc(a,fo);
for(b=0;b<a;b++)
{
putc(savebuf[u+b]=vram[u+b],fo);
}
u+=a;
u0=u;
}
}
putc(255,fo);
}
break;
}
return(0);
}

216
GRAB/FLIC/VW2.C Normal file
View file

@ -0,0 +1,216 @@
/* view flic */
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <memory.h>
int doframe(FILE *f1);
int dochunk(FILE *f1);
int doline1(unsigned u,FILE *f1);
int doline2(unsigned u,FILE *f1);
int saveframe(int frame);
char far *vram=(char far *)0xa0000000L;
char buf[64000];
char pal[768];
char savebuf[64000];
int lw;
struct
{
long filesize;
unsigned magic; /* 0xaf11 */
int frames;
int width;
int heigth;
int RESERVED1;
int flags; /*0*/
int speed;
long next; /*0*/
long frit; /*0*/
char RESERVED2[102];
} header;
struct
{
long size;
unsigned magic; /* 0xf1fa */
int chunks;
int RESERVED[4];
} frameheader;
struct
{
long size;
unsigned type;
} chunkheader;
main(int argc,char *argv[])
{
FILE *f1;
int f;
f1=fopen(argv[1],"rb");
if(f1==NULL) return(0);
fread(&header,sizeof(header),1,f1);
lw=header.width;
/**/
_asm mov ax,13h
_asm int 10h
saveframe(-1);
for(f=0;f<header.frames;f++)
{
doframe(f1);
saveframe(f);
}
saveframe(-2);
/**/
fclose(f1);
return(0);
}
int doframe(FILE *f1)
{
int c;
long framestart;
framestart=ftell(f1);
fread(&frameheader,sizeof(frameheader),1,f1);
for(c=0;c<frameheader.chunks;c++) dochunk(f1);
fseek(f1,framestart+frameheader.size,SEEK_SET);
return(0);
}
int dochunk(FILE *f1)
{
unsigned u;
int a,b,c;
long chunkstart;
chunkstart=ftell(f1);
fread(&chunkheader,sizeof(chunkheader),1,f1);
switch(chunkheader.type)
{
case 11 : /* FLI_COLOR */
c=getw(f1);
a=0;
while(c--)
{
a+=getc(f1);
b=getc(f1); if(!b) b=256;
outp(0x3c8,a);
while(b--)
{
outp(0x3c9,getc(f1));
outp(0x3c9,getc(f1));
outp(0x3c9,getc(f1));
}
}
break;
case 12 : /* FLI_LC */
u=getw(f1)*lw;
c=getw(f1);
while(c--)
{
doline1(u,f1);
u+=lw;
}
break;
case 13 : /* FLI_BLACK */
memset(vram,0,64000U);
break;
case 15 : /* FLI_BRUN */
u=0;
c=header.heigth;
while(c--)
{
doline2(u,f1);
u+=lw;
}
break;
case 16 : /* FLI_COPY */
fread(buf,1,64000U,f1);
memcpy(vram,buf,64000U);
break;
}
fseek(f1,chunkstart+chunkheader.size,SEEK_SET);
return(0);
}
int doline1(unsigned u,FILE *f1)
{
int a,b,c;
c=getc(f1);
while(c--)
{
u+=getc(f1);
b=(char)getc(f1);
if(b>0)
{
while(b--) vram[u++]=(char)getc(f1);
}
else
{
a=getc(f1);
while(b++) vram[u++]=(char)a;
}
}
return(0);
}
int doline2(unsigned u,FILE *f1)
{
int a,b,c;
c=getc(f1);
while(c--)
{
b=(char)getc(f1);
if(b<0)
{
while(b++) vram[u++]=(char)getc(f1);
}
else
{
a=getc(f1);
while(b--) vram[u++]=(char)a;
}
}
return(0);
}
int saveframe(int frame)
{
unsigned u,u0,ua;
int a,b,c;
static FILE *fo;
switch(frame)
{
case -1 : /* open */
fo=fopen("anim.fca","wb");
break;
case -2 : /* close */
putc(254,fo);
fclose(fo);
break;
default : /* save */
if(frame==0)
{
outp(0x3c7,0);
for(a=0;a<768;a++) pal[a]=(char)inp(0x3c9);
memset(savebuf,0,64000U);
fwrite(pal,1,768U,fo);
}
{
int x1=160-32-3;
int y1=100-32;
int x2=160+32-3;
int y2=100+32;
int x,y;
for(y=y1;y<y2;y++) for(x=x1;x<x2;x++)
{
vram[x+y*320]^=128;
}
}
break;
}
return(0);
}

BIN
GRAB/FLIC/XO2.LBM Normal file

Binary file not shown.

6
GRAB/FONT/DOFONT.BAT Normal file
View file

@ -0,0 +1,6 @@
echo off
font1 %1.lbm %1.tmp
font2 %1.tmp %1.fnt
del %1.tmp
cls
echo Fonttitiedosto: %1.fnt

403
GRAB/FONT/FONT1.C Normal file
View file

@ -0,0 +1,403 @@
#include <stdio.h>
#include <graph.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>
int scan(void);
int doblock(FILE *f1);
int readlbm(FILE *f1);
int showline(int y);
int bluecol=1;
int backcol=15;
FILE *out;
long f_off[256];
char f_wid[256];
char f_hig[256];
char f_base[256];
long averwid;
int avercnt;
main(int argc,char *argv[])
{
int a;
FILE *f1;
if(argc==1)
{
printf("usage: FONT <srclbm> <desttmpfont>");
return(0);
}
_setvideomode(_VRES16COLOR);
for(a=0;a<256;a++)
{
f_off[a]=0;
f_wid[a]=0;
f_hig[a]=0;
}
avercnt=0; averwid=0;
out=fopen(argv[2],"wb");
fwrite(f_off,4,256,out);
fwrite(f_wid,1,256,out);
fwrite(f_hig,1,256,out);
fwrite(f_base,1,256,out);
f1=fopen(argv[1],"rb");
readlbm(f1);
scan();
fclose(f1);
fseek(out,0L,SEEK_SET);
averwid/=avercnt;
f_wid[32]=averwid;
f_hig[32]=1;
fwrite(f_off,4,256,out);
fwrite(f_wid,1,256,out);
fwrite(f_hig,1,256,out);
fwrite(f_base,1,256,out);
fclose(out);
_setvideomode(_DEFAULTMODE);
}
unsigned char linebuf[1024];
unsigned char pal[768];
int showline(int y)
{
int x;
for(x=0;x<640;x++)
{
_setcolor(linebuf[x]);
_setpixel(x,y);
}
return(0);
}
int cbits[8]={1,2,4,8,16,32,64,128};
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt;
char lasttype[5];
char type[5]={"----"};
long len;
int xsz,ysz,planes,stencil,colors,mode;
char lbmtype[4];
int checktype=0;
int eschit(void)
{
if(kbhit())
{
if(getch()==27) return(1);
}
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int readlbm(FILE *f1)
{
int x,y,a,b,c;
long l;
unsigned u;
int firstone=1;
errtxt=NULL;
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=doblock(f1);
if(errtxt!=NULL)
{
printf("%s\n",errtxt);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
return(1);
}
else if(a==1) break;
}
while(!feof(f1));
return(0);
}
int doblock(FILE *f1)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<colors*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
/* load colors */
for(a=0;a<16;a++) /* vga */
{
inp(0x3da);
outp(0x3c0,a);
outp(0x3c0,a);
outp(0x3c8,a);
outp(0x3c9,pal[a*3+0]);
outp(0x3c9,pal[a*3+1]);
outp(0x3c9,pal[a*3+2]);
}
inp(0x3da);
outp(0x3c0,32);
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
"Size: %i x %i (Colors:%i)\nPlanes:%i Stencil:%i\n",
xsz,ysz,colors,planes,stencil);
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
showline(y);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
showline(y);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}
int letter(int chr,int x,int y)
{
int basey;
int x1,y1,x2,y2,a,c=1;
x1=x2=x; y1=y2=y;
/* expand box */
while(c)
{
c=0;
for(a=x1;a<=x2;a++)
{
if(y1>=0 && _getpixel(a,y1)!=backcol) { y1--; c=1; }
if(y2<=479 && _getpixel(a,y2)!=backcol) { y2++; c=1; }
}
for(a=y1;a<=y2;a++)
{
if(x1>=0 && _getpixel(x1,a)!=backcol) { x1--; c=1; }
if(x2<=639 && _getpixel(x2,a)!=backcol) { x2++; c=1; }
}
if(x1<=0 || y1<=0 || x2>=639 || y2>=479) exit(1);
}
basey=y-y1;
/* erase blue */
for(y=y1;y<=y2;y++)
for(x=x1;x<=x2;x++)
{
if(_getpixel(x,y)==bluecol)
{
_setcolor(backcol);
_setpixel(x,y);
}
}
/* save font */
{
avercnt++;
averwid+=x2-x1+1;
f_wid[chr]=x2-x1+1;
f_hig[chr]=y2-y1+1;
f_base[chr]=basey;
f_off[chr]=ftell(out);
for(y=y1;y<=y2;y++)
for(x=x1;x<=x2;x++)
{
if(_getpixel(x,y)!=backcol) putc(1,out);
else putc(0,out);
}
}
/* erase box */
_setcolor(backcol);
_rectangle(_GFILLINTERIOR,x1,y1,x2,y2);
return(0);
}
unsigned char order[256]={
"!\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~"
"<EFBFBD>Ž™†„”"
"àáâãäåæçèéêëìíîï"};
int scan(void)
{
int y,x,a=0;
for(y=0;y<480;y++) if((bluecol=_getpixel(0,y))!=backcol)
{
for(x=1;x<640;x++) if(_getpixel(x,y)!=backcol)
{
if(letter(order[a++],x,y)) return(1);
}
}
return(0);
}

148
GRAB/FONT/FONT2.C Normal file
View file

@ -0,0 +1,148 @@
/* font converter */
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
unsigned char wid[256];
unsigned char hig[256];
unsigned char basey[256];
unsigned long off[256];
unsigned doff[256];
unsigned dwid[256];
unsigned int base,min,max,ylen;
#define LY 100
#define LX 100
char fnt[LX*LY];
unsigned char fntwid;
char empty;
int readfont(FILE *f1,int a)
{
unsigned int x,y;
fntwid=wid[a];
memset(fnt,0,LX*LY);
empty=1;
if(!off[a]) return(0);
empty=0;
fseek(f1,off[a],SEEK_SET);
for(y=0;y<hig[a];y++)
{
for(x=0;x<fntwid;x++)
{
fnt[x+(y+base-basey[a])*LX]=getc(f1);
}
}
return(0);
}
int printfont(void)
{
unsigned int x,y;
for(y=0;y<ylen*8;y++)
{
for(x=0;x<fntwid;x++)
{
if(fnt[x+y*LX]) printf("Û");
else printf(".");
}
printf("\n");
}
printf("\n");
getch();
return(0);
}
int bits[8]={128,64,32,16,8,4,2,1};
int convert(FILE *f2,int chr)
{
unsigned int x,y0,y;
int a;
dwid[chr]=fntwid;
if(empty)
{
doff[chr]=0;
return(0);
}
doff[chr]=(unsigned)ftell(f2);
for(y0=0;y0<ylen;y0++)
{
for(x=0;x<fntwid;x++)
{
for(a=y=0;y<8;y++)
{
if(fnt[x+(y0*8+y)*LX]) a+=bits[y];
}
putc(a,f2);
}
}
}
main(int argc,char *argv[])
{
long l;
int a,c;
unsigned int b;
FILE *f1,*f2;
if(argc==1)
{
printf("usage: <srctmp> <destprn>");
return(0);
}
f1=fopen(argv[1],"rb");
f2=fopen(argv[2],"wb");
fread(off,4,256,f1);
fread(wid,1,256,f1);
fread(hig,1,256,f1);
fread(basey,1,256,f1);
for(min=max=a=0;a<256;a++) if(off[a])
{
b=hig[a]-basey[a];
if(b>max) max=b;
b=basey[a];
if(b>min) min=b;
}
max--;
ylen=(max+min+7)/8;
base=(ylen*8-(max+min))/2+min;
printf("Maximum heigth: %i\nBase up:%i\nBase down:%i\n",
max+min,min,max);
printf("Heigth in charachters: %i\nBase line in pixels: %i\n",
ylen,base);
fseek(f2,1024L+16L,SEEK_SET);
for(a=0;a<256;a++)
{
printf("Processing charachter %i...\r",a);
readfont(f1,a);
convert(f2,a);
}
fseek(f2,0L,SEEK_SET);
fprintf(f2,"BIGFONT\x01a");
putw(ylen,f2);
putw(0,f2);
putw(0,f2);
putw(0,f2);
fwrite(doff,2,256,f2);
fwrite(dwid,2,256,f2);
fclose(f2);
fclose(f1);
return(0);
}
/*
file format for destination font file:
text: "BIGFONT",0x1b
word: charachter rows
word: -
word: -
word: -
256 times: word: offset (0 for letter not in file)
256 times: word: width
*/

BIN
GRAB/FONT/HELV.LBM Normal file

Binary file not shown.

136
GRAB/FONT/PRINT.C Normal file
View file

@ -0,0 +1,136 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define LINEWIDTH 960 /* printterin rivill„ pisteit„ */
#define MAXHEIGTH 8 /* maksimi korkeus merkeille */
#define BUFFERSIZE 32000 /* tila fonttidatalle */
#define HEADERLENGTH 0x410 /* alkutauluk. pituus ennen varsinaista dataa */
unsigned char fontdata[BUFFERSIZE]; /* file mahtuu varmasti */
int heigth; /* korkeus merkeiss„ */
int offset[256]; /* jokaisen fontin alkupaikka fileess„ */
int width[256]; /* jokaisen fontin leveys (pixeleiss„) */
int spacing=-1; /* lis„v„li merkkien v„liss„ */
unsigned char linebuf[MAXHEIGTH][LINEWIDTH];
int readfont(char *file)
{
int a;
FILE *f1;
f1=fopen(file,"rb"); /* read binary */
/* onko headerin teksti ok? */
if(fgetc(f1)!='B') return(1);
if(fgetc(f1)!='I') return(1);
if(fgetc(f1)!='G') return(1);
if(fgetc(f1)!='F') return(1);
if(fgetc(f1)!='O') return(1);
if(fgetc(f1)!='N') return(1);
if(fgetc(f1)!='T') return(1);
getc(f1);
/* on, korkeus? */
heigth=getw(f1); /* word - korkeus */
a=getw(f1); /* word - ylim. v„li */
if(spacing==-1) spacing=a; /* aseta jos ei jo asetettu */
getw(f1); /* unused */
getw(f1); /* unused */
/* lue offset/width taulukot */
for(a=0;a<256;a++) offset[a]=getw(f1);
for(a=0;a<256;a++) width[a]=getw(f1);
/* lue data */
fread(fontdata,1,BUFFERSIZE,f1);
/* valmista tuli */
fclose(f1);
return(0);
}
int printtext(unsigned char *txt)
{
FILE *prn;
int a,b;
int o,w;
int x=0; /* pixelipaikka rivill„ */
memset(linebuf,0,MAXHEIGTH*LINEWIDTH);
while(*txt)
{ /* niin kauan kuin merkkej„ riitt„„*/
a=(unsigned)*txt; txt++; /* a=merkki, seuraava merkki valmiiksi */
o=offset[a]; /* merkin osoite fileess„ */
if(o==0) o=-1; /* merkill„ ei ole dataa (tyhj„„ t„ynn„) */
else o-=HEADERLENGTH; /* osoite fontdatassa (joka alkaa
filen kohdasta HEADERLENGTH) */
w=width[a]; /* leveys */
if(w+x>LINEWIDTH) break; /* rivi loppui, ulos whilesta */
/* kopio merkki rivibufferiin (jos offset==-1, niin kirjain
on tyhj tynn (space etc.) */
if(o!=-1) for(b=0;b<heigth;b++)
{
for(a=0;a<w;a++)
{
linebuf[b][x+a]=fontdata[o++];
}
}
x+=w+spacing; /* "kursoria" eteenp„in, ja extraa v„liin */
}
printf("(%i pixels)...",x);
/* printtaa linebufferi printterille (EPSON) */
prn=fopen("prn","wb");
/* riviv„li oikeaksi */
putc(27,prn);
putc(51,prn);
putc(24,prn);
for(b=0;b<heigth;b++)
{
/* grafiikkaheaderi */
putc(27,prn);
putc(42,prn);
putc(1,prn); /* 960 pistett„ riville, 8 pinnin grafiikka */
putc(x&255,prn); /* pixel count, low */
putc(x/256,prn); /* pixel count, high */
/* data */
for(a=0;a<x;a++)
{
putc(linebuf[b][a],prn);
}
/* seuraava rivi */
putc(10,prn);
}
fclose(prn);
return(0);
}
unsigned char txt[256]={"\0"};
char *font="default.fnt";
main(int argc,char *argv[])
{
int a;
if(argc==1)
{
printf("usage: PRINT [/F<fontfile>] [/S<spacing pixels>] \"text\"\n");
return(0);
}
*txt=0;
for(a=1;a<argc;a++) if(*argv[a]=='/') switch(*(argv[a]+1))
{
case 'F' :
case 'f' :
font=argv[a]+2;
break;
case 'S' :
case 's' :
spacing=atoi(argv[a]+2);
break;
default :
printf("Error in command line.");
return(1);
}
else strcat(txt,argv[a]);
if(readfont(font))
{
printf("Font could not be loaded.");
return(1);
}
printf("Printing \"%s\" ",txt);
printtext(txt);
}

75
GRAB/FONT/README Normal file
View file

@ -0,0 +1,75 @@
Pikaohjeet fontintekoon:
* Pohjakuva tulee tehd„ DeluxePaintilla resoluutioon 640x480x16v„ri„.
* V„ri 15 pit„„ ottaa taustaksi (sen kirkkautta kannattaa ehk„ v„h„n
pienent„„ silmien s„„st„miseksi).
* Fontit kirjoitetaan v„rill„ 0 siten ett„ jokaisen kirjaimen ymp„rill„
on v„hint„„n 1 tyhj„ pikseli (yleens„ n„in on automaattisesti).
* Merkkien j„rjestyksen tulee olla seuraava (alku on ASCII:n mukainen,
ja alkaa merkist„ 33 (ei spacea luonnollisestikaan)):
! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
<20> Ž ™ † „ ”
Jos viel„ t„m„n j„lkeen tulee merkkej„, ne asettuvat kreikkalaisten
kirjainten p„„lle (ASCII 224..239).
Koska Spacea ei voi m„„ritell„, olettaa konvertteri sen olevan tyhj„
merkki ja asettaa sen leveydeksi kaikkien merkkien leveyden keskiarvon
(toimii hyvin). T„t„ voi viritt„„ muuttamalla spacen leveytt„
fonttitiedostosta (offset 16+256*2+32*2=592=250h).
* Jokaisen kirjainrivin peruslinjan kohdalle (esim kirjainten
alareuna) on ruudun vasempaan reunaan laitettava piste (v„ri
joku muu kuin 0/15). T„m„ piste synkronisoi fontit samalle
riville, esim 1 (* kyseist„ v„ri„):
ESIM1....................... ...................ÛÛ............
...........Û......Û......... .....ÛÛ**..**ÛÛ....ÛÛ............
......ÛÛÛ..Û................ ........ÛÛÛÛ......ÛÛ.............
.....Û...Û.ÛÛÛ....Û......... .......Û....Û......*.............
.....ÛÛÛÛÛ.Û..Û...Û......... .......Û....Û......*.............
*....Û...Û.ÛÛÛ....Û......... .......Û....Û......*.............
................ÛÛ.......... ........ÛÛÛÛ.......*.............
............................ ............................ESIM2
* Jos kirjaimissa on irtaimia osia, tulee ne yhdist„„ samalla v„rill„
jolla ruudun vasemman reunan piste piirrettiin. Esim 2 yl„puolella.
* Kaikkien merkkien tulee my”s ulottua peruslinjalle asti. Jollei
n„in ole, voidaan merkki„ 'jatkaa' yhdistysv„rill„ (esim 2).
* Fonttia muunnettaessa yhdistysv„ri katoaa; se ei siis h„iritse
tulostusta.
* Kun kuva on talletettu, kopioidaan se t„h„n hakemistoon ja ajetaan
dofont: DOFONT <tiedostonnimi ilman .LBM:„„)
esim: DOFONT fontti3
Lopputulos on esimerkkitapauksessa FONTTI3.FNT, jota voi k„ytt„„
PRINT ohjelmassa.
PRINT ohjelma - EPSON/IBM Graphics etc. yht. sop.
K„ytt”: PRINT "teksti"
esim: PRINT "Testiteksti!"
Lis„parametrit: /F<fontinnimi>
/S<lis„tyhj„„ kirjainten v„liin n„in monta pixeli„>
Oletukset: fontinnimi=DEFAULT.FNT
lis„tyhj„=0
Maksimit: fonttitiedoston koko 30000 tavua
.FNT tiedoston formaatti:
8 bytes: "BIGFONT",1ah
1 word: fontin korkeus merkeiss„ (1 merkki=8 pikseli„)
1 word: lis„v„lityhj„n oletusarvo (nyky„„n aina 0lla)
1 word: 0
1 word: 0
Seuraavissa taulukoissa indeksin„ k„ytet„„n fontin (ASCII) numeroa:
256 words: merkin osoite tiedostossa (tavuja alusta)
256 words: merkin leveys (pikseli„)
bytes: merkkidata
C-sorsien k„„nt„minen (%=sorsan nimi):
cl /W3 /AL /qc %.c tai qcl /AL %.c

BIN
GRAB/FONT/ST3LOGO.BIN Normal file

Binary file not shown.

BIN
GRAB/FONT/TIMES.LBM Normal file

Binary file not shown.

BIN
GRAB/FONT/TMP Normal file

Binary file not shown.

433
GRAB/FONT/TOBM.C Normal file
View file

@ -0,0 +1,433 @@
#include <stdio.h>
#include <graph.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>
int scan(void);
int doblock(FILE *f1);
int readlbm(FILE *f1);
int showline(int y);
int bluecol=1;
int backcol=15;
char tablex[256];
char tabley[256];
int tablep=0;
FILE *out;
long f_off[256];
char f_wid[256];
char f_hig[256];
char f_base[256];
long averwid;
int avercnt;
main(int argc,char *argv[])
{
int a;
FILE *f1;
if(argc==1)
{
printf("usage: FONT <srclbm> <desttmpfont>");
return(0);
}
_setvideomode(_VRES16COLOR);
for(a=0;a<256;a++)
{
f_off[a]=0;
f_wid[a]=0;
f_hig[a]=0;
}
avercnt=0; averwid=0;
out=fopen(argv[2],"wb");
putw(0x1a1a,out);
putw(tablep,out);
fwrite(tablex,1,256,out);
fwrite(tabley,1,256,out);
f1=fopen(argv[1],"rb");
readlbm(f1);
{
char buf[64];
int x0,y0,x,y,a;
for(y0=2;y0<7*8-2;y0+=8)
for(x0=0;x0<56*8;x0+=8)
{
for(a=x=0;x<8;x++) for(y=0;y<8;y++)
{
if((buf[x+y*8]=_getpixel(x0+x,y0+y))==0) a=1;
}
if(a)
{
tablex[tablep]=x0/8;
tabley[tablep++]=(y0-2)/8;
for(y=0;y<8;y++)
{
for(a=x=0;x<8;x++)
{
if(!buf[x+y*8]) a+=128>>x;
}
putc(a,out);
}
_setcolor(15);
}
else _setcolor(8);
_setpixel(x0,y0);
}
}
getch();
fclose(f1);
fseek(out,0L,SEEK_SET);
putw(0x1a1a,out);
putw(tablep,out);
fwrite(tablex,1,256,out);
fwrite(tabley,1,256,out);
fclose(out);
_setvideomode(_DEFAULTMODE);
printf("tablecount:%i",tablep);
}
unsigned char linebuf[1024];
unsigned char pal[768];
int showline(int y)
{
int x;
for(x=0;x<640;x++)
{
_setcolor(linebuf[x]);
_setpixel(x,y);
}
return(0);
}
int cbits[8]={1,2,4,8,16,32,64,128};
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt;
char lasttype[5];
char type[5]={"----"};
long len;
int xsz,ysz,planes,stencil,colors,mode;
char lbmtype[4];
int checktype=0;
int eschit(void)
{
if(kbhit())
{
if(getch()==27) return(1);
}
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int readlbm(FILE *f1)
{
int x,y,a,b,c;
long l;
unsigned u;
int firstone=1;
errtxt=NULL;
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=doblock(f1);
if(errtxt!=NULL)
{
printf("%s\n",errtxt);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
return(1);
}
else if(a==1) break;
}
while(!feof(f1));
return(0);
}
int doblock(FILE *f1)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<colors*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
/* load colors */
for(a=0;a<16;a++) /* vga */
{
inp(0x3da);
outp(0x3c0,a);
outp(0x3c0,a);
outp(0x3c8,a);
outp(0x3c9,pal[a*3+0]);
outp(0x3c9,pal[a*3+1]);
outp(0x3c9,pal[a*3+2]);
}
inp(0x3da);
outp(0x3c0,32);
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
"Size: %i x %i (Colors:%i)\nPlanes:%i Stencil:%i\n",
xsz,ysz,colors,planes,stencil);
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
showline(y);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
showline(y);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}
int letter(int chr,int x,int y)
{
int basey;
int x1,y1,x2,y2,a,c=1;
x1=x2=x; y1=y2=y;
/* expand box */
while(c)
{
c=0;
for(a=x1;a<=x2;a++)
{
if(y1>=0 && _getpixel(a,y1)!=backcol) { y1--; c=1; }
if(y2<=479 && _getpixel(a,y2)!=backcol) { y2++; c=1; }
}
for(a=y1;a<=y2;a++)
{
if(x1>=0 && _getpixel(x1,a)!=backcol) { x1--; c=1; }
if(x2<=639 && _getpixel(x2,a)!=backcol) { x2++; c=1; }
}
if(x1<=0 || y1<=0 || x2>=639 || y2>=479) exit(1);
}
basey=y-y1;
/* erase blue */
for(y=y1;y<=y2;y++)
for(x=x1;x<=x2;x++)
{
if(_getpixel(x,y)==bluecol)
{
_setcolor(backcol);
_setpixel(x,y);
}
}
/* save font */
{
avercnt++;
averwid+=x2-x1+1;
f_wid[chr]=x2-x1+1;
f_hig[chr]=y2-y1+1;
f_base[chr]=basey;
f_off[chr]=ftell(out);
for(y=y1;y<=y2;y++)
for(x=x1;x<=x2;x++)
{
if(_getpixel(x,y)!=backcol) putc(1,out);
else putc(0,out);
}
}
/* erase box */
_setcolor(backcol);
_rectangle(_GFILLINTERIOR,x1,y1,x2,y2);
return(0);
}
unsigned char order[256]={
"!\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~"
"<EFBFBD>Ž™†„”"
"àáâãäåæçèéêëìíîï"};
int scan(void)
{
int y,x,a=0;
for(y=0;y<480;y++) if((bluecol=_getpixel(0,y))!=backcol)
{
for(x=1;x<640;x++) if(_getpixel(x,y)!=backcol)
{
if(letter(order[a++],x,y)) return(1);
}
}
return(0);
}

174
GRAB/GFX.C Normal file
View file

@ -0,0 +1,174 @@
#include <stdio.h>
#include <string.h>
char *filename="";
int cmd=1,firstsrc=0;
unsigned segs[256];
int segp;
main(int argc,char *argv[])
{
int a,b,c;
int d1,d2,d3,d4;
FILE *f1;
for(a=1;a<argc;a++)
{
if(*argv[a]=='/' || *argv[a]=='-') switch(*(argv[a]+1))
{
case 'h' :
case 'H' :
case '?' : *filename=0; a=argc; break;
case 'v' : cmd=1; break;
case 'j' : cmd=2; break;
default :
printf("Unknown option: %s\n",argv[a]);
exit(1);
}
else if(!*filename) strcpy(filename,argv[a]);
else if(!firstsrc) firstsrc=a;
}
if(!*filename)
{
printf("GFX file utility V1.0 Copyright (C) 1991 Sami Tammilehto\n"
"usage: GFX [switch(es)] [destination] <source(s)> Switches:\n"
"-h Help\n"
"-v View contents (in text form) (default)\n"
"-j Join files\n"
); return(0);
}
else printf("GFX file utility V1.0\n");
if(cmd==2)
{
FILE *out;
int total=0;
int fl;
char fname[64];
unsigned base;
if(strchr(filename,'.')==NULL) strcat(filename,".GFX");
out=fopen(filename,"wb");
if(out==NULL)
{
printf("Error opening file '%s'.\n",filename);
return(1);
}
putc('G',out);
putc('F',out);
putc('X',out);
putc('1',out);
putc('0',out);
putc(0x1a,out);
a=0;
for(fl=firstsrc;fl<argc;fl++)
{
strcpy(fname,argv[fl]);
if(strchr(fname,'.')==NULL) strcat(fname,".GFX");
f1=fopen(fname,"rb");
if(f1==NULL)
{
printf("File '%s' not found.\n",fname);
return(1);
}
a=0;
if(getc(f1)!='G') a=1;
if(getc(f1)!='F') a=1;
if(getc(f1)!='X') a=1;
if(getc(f1)!='1') a=1;
if(getc(f1)!='0') a=1;
if(getc(f1)!=0x1a) a=1;
if(a)
{
printf("File '%s' is not a GFX file.\n",fname);
return(1);
}
total+=getw(f1);
}
printf("Total number of pictures: %i\n",total);
putw(total,out);
fwrite(segs,2,total,out);
for(fl=firstsrc;fl<argc;fl++)
{
b=16-((ftell(out))&15); if(b!=16) for(c=0;c<b;c++) putc(0,out);
base=ftell(out)>>4;
strcpy(fname,argv[fl]);
if(strchr(fname,'.')==NULL) strcat(fname,".GFX");
f1=fopen(fname,"rb");
fseek(f1,6L,SEEK_SET);
c=getw(f1);
segs[segp++]=base;
b=getw(f1);
for(a=0;a<c-1;a++)
{
segs[segp++]=getw(f1)+base-b;
}
fseek(f1,(long)b<<4,SEEK_SET);
while(!feof(f1))
{
putc(getc(f1),out);
}
}
fseek(out,8L,SEEK_SET);
fwrite(segs,2,segp,out);
return(0);
}
if(strchr(filename,'.')==NULL) strcat(filename,".GFX");
f1=fopen(filename,"rb");
if(f1==NULL)
{
printf("File '%s' not found.\n",filename);
return(1);
}
a=0;
if(getc(f1)!='G') a=1;
if(getc(f1)!='F') a=1;
if(getc(f1)!='X') a=1;
if(getc(f1)!='1') a=1;
if(getc(f1)!='0') a=1;
if(getc(f1)!=0x1a) a=1;
if(a)
{
printf("File '%s' is not a GFX file.\n",filename);
return(1);
}
switch(cmd)
{
case 1 :
c=getw(f1);
printf("\nFile '%s' contains %i subfile(s):\n",filename,c);
for(a=0;a<c;a++)
{
printf("subfile%3i: ",a);
fseek(f1,8L+(long)a*2L,SEEK_SET);
b=getw(f1);
fseek(f1,(long)b<<4L,SEEK_SET);
b=getc(f1);
switch(b)
{
case 0xff : printf("Unknown data.\n"); break;
case 0xfe : printf("256 color palette.\n"); break;
case 0x03 :
printf("packed vertical bitmap; ");
case 0x02 :
if(b==2) printf("1-bitplane packed bitmap; ");
case 0x01 :
if(b==1) printf("4-bitplane packed bitmap; ");
getc(f1);
d1=getw(f1);
d2=getw(f1);
d3=getw(f1);
d4=getw(f1);
printf("%ix%i (origo:%i,%i).\n",d4,d3,-d2,-d1);
break;
default : printf("UNKNOWN BLOCK TYPE!\n"); break;
}
}
break;
default :
printf("UNKNOWN COMMAND!");
}
fclose(f1);
return(0);
}

97
GRAB/GFX.DOC Normal file
View file

@ -0,0 +1,97 @@
GFX file format specification (quickly written, errors inevitable :-)
**MAIN HEADER**
6bytes "GFX10",1ah
word number of subfiles
word(s) paragraph offset to subfile 0,1,2,... (true offset=paraoff*16)
**SUBFILE HEADER**
byte file type
0ffh = unknown data
0feh = palette
004h = Optimized X sprite
003h = vertical bitmap
002h = 1-bitplane packed bitmap
001h = 4-bitplane packed bitmap
**PALETTE**
768 bytes of palette data (I think...)
**VERTICAL BITMAPS**
byte reserved
word add to Y to center bitmap
word add to X to center bitmap
word heigth (pixels)
word width (pixels)
repeat width times
{
a=byte
b=byte
if(b==0) end of column
skip (b>>1) pixels
copy a bytes
}
**UNPACKED BITMAP FORMAT**
byte reserved
word add to Y to center bitmap
word add to X to center bitmap
word heigth (pixels)
word width (pixels)
byte(s) data from top to bottom, rows from left to right
**1-BITPLANE PACKED BITMAP FORMAT**
byte reserved
word add to Y to center bitmap
word add to X to center bitmap
word heigth (pixels)
word width (pixels)
bytes(s) packed data, composed of subblocks, read like this:
for(;;)
{
a=byte
if(a==0) end of picture (or bitplane in 4-bitplane mode)
else if(a>0) skip a bytes
else if(a&1) copy ((a&127)>>1) bytes to screen
else b=byte, write b ((a&127)>>1) times to screen
}
**4-BITPLANE PACKED BITMAP FORMAT**
byte reserved
word add to Y to center bitmap
word add to X to center bitmap
word heigth (pixels)
word width (pixels)
byte(s) data, like in 1-BITPLANE except that data is saved in
four passes, one for every tweaked mode bitplane.
**X SPRITE**
byte reserved (0)
word add to Y to center bitmap
word add to X to center bitmap
word heigth (pixels)
word width (pixels)
repeat 4 times (bitplane)
{
repeat heigth times
{
repeat until end of row
{
b=byte
if(!b)
{
b=byte;
if(b) skip b 8 byte blocks
else end of row
}
else
{
for bits 0..7 in b:
if bit=0, skip pixel
else read byte, write it
}
}
}
next bitplane
}

BIN
GRAB/GFX.EXE Normal file

Binary file not shown.

336
GRAB/GFXSAVE.H Normal file
View file

@ -0,0 +1,336 @@
/*****************************************************************
Saves gfxdata to file
variables required from outside:
unsigned char pic[]; ;array to 320x200 1BM
int backcol; ;transparent color
int fcporigo; ;1 if origo in the center of area
int fcporigox,fcporigoy ;if ^=2 then origoxy
*****************************************************************/
int writefcporigo(FILE *f1,int x1,int y1,int x2,int y2)
{
int xl=x2-x1+1,yl=y2-y1+1;
int x,y,a,b,c;
if(fcporigo==3)
{
for(x=x1;x<=x2;x++) for(y=y1;y<=y2;y++)
{
if(vram[x+y*320]==1)
{
putw(-y,f1);
putw(-x,f1);
pic[x+y*320]=vram[x+y*320]=vram[1+x+y*320];
}
}
}
else if(fcporigo==2)
{
putw(-fcporigoy,f1);
putw(-fcporigox,f1);
}
else if(fcporigo)
{
putw(-(yl+1)/2,f1);
putw(-(xl+1)/2,f1);
}
else
{
putw(0,f1);
putw(0,f1);
}
}
int savegfxdata(FILE *f1,int x1,int y1,int x2,int y2)
{
int xl=x2-x1+1,yl=y2-y1+1;
int a,x,y,z,c;
unsigned int u,u2,lastp;
putc(0x01,f1);
putc(0,f1);
if(fcporigo==3)
{
for(x=x1;x<=x2;x++) for(y=y1;y<=y2;y++)
{
if(vram[x+y*320]==1)
{
putw(-y,f1);
putw(-x,f1);
pic[x+y*320]=vram[x+y*320]=vram[1+x+y*320];
}
}
}
else if(fcporigo==2)
{
putw(-fcporigoy,f1);
putw(-fcporigox,f1);
}
else if(fcporigo)
{
putw(-yl/2,f1);
putw(-xl/2,f1);
}
else
{
putw(0,f1);
putw(0,f1);
}
putw(yl,f1);
putw(xl,f1);
for(z=0;z<4;z++)
{
for(y=y1;y<=y2;y++)
{
u =(unsigned)y*320+(unsigned)x1+(unsigned)z;
u2=(unsigned)y*320+(unsigned)x2;
lastp=u;
while(u<=u2)
{
if(pic[u]==backcol)
{
while(pic[u]==backcol && u<=u2)
{
for(c=0;u<=u2 && c<127 && pic[u]==backcol;u+=4,c++);
if(u<=u2) putc(c,f1);
}
}
if(u>u2) break;
lastp=u;
for(c=1;u<=u2 && c<63 && pic[u]==pic[u+4] && pic[u]!=backcol;u+=4,c++);
if(c>2)
{
putc((c<<1)|0x80,f1);
putc(pic[lastp],f1);
u+=4;
}
else
{
u=lastp;
if((u2-u)+1>2)
{
for(c=0;u<=u2 && c<63 &&
(pic[u]!=pic[u+4] || pic[u]!=pic[u+8])
&& pic[u]!=backcol;u+=4,c++);
}
else for(c=0;u<=u2 && c<63 && pic[u]!=backcol;u+=4,c++);
if(c!=0)
{
putc((c<<1)|0x81,f1);
for(a=0;a<c;a++)
{
putc(pic[lastp+a*4],f1);
}
}
}
}
putc(0,f1);
#ifdef VPSOFT
pxor(x1,y);
pxor(x2,y);
#endif
}
}
}
int savegfxdata1(FILE *f1,int x1,int y1,int x2,int y2)
{
int xl=x2-x1+1,yl=y2-y1+1;
int a,x,y,c;
unsigned int u,u2,lastp;
putc(0x02,f1);
putc(0,f1);
if(fcporigo==3)
{
for(x=x1;x<=x2;x++) for(y=y1;y<=y2;y++)
{
if(vram[x+y*320]==1)
{
putw(-(y-y1),f1);
putw(-(x-x1),f1);
pic[x+y*320]=vram[x+y*320]=vram[1+x+y*320];
break;
}
}
}
else if(fcporigo==2)
{
putw(-fcporigoy,f1);
putw(-fcporigox,f1);
}
else if(fcporigo)
{
putw(-yl/2,f1);
putw(-xl/2,f1);
}
else
{
putw(0,f1);
putw(0,f1);
}
putw(yl,f1);
putw(xl,f1);
{
for(y=y1;y<=y2;y++)
{
u =(unsigned)y*320+(unsigned)x1;
u2=(unsigned)y*320+(unsigned)x2;
while(u<=u2)
{
if(pic[u]==backcol)
{
while(pic[u]==backcol && u<=u2)
{
for(c=0;u<=u2 && c<127 && pic[u]==backcol;u++,c++);
if(u<=u2) putc(c,f1);
}
}
if(u>u2) break;
lastp=u;
for(c=1;u<u2 && c<63 && pic[u]==pic[u+1] && pic[u]!=backcol;u++,c++);
if(c>2)
{
putc((c<<1)|0x80,f1);
putc(pic[lastp],f1);
u++;
}
else
{
u=lastp;
if((u2-u)+1>2)
{
for(c=0;u<=u2 && c<63 &&
(pic[u]!=pic[u+1] || pic[u]!=pic[u+2])
&& pic[u]!=backcol;u++,c++);
}
else for(c=0;u<=u2 && c<63 && pic[u]!=backcol;u++,c++);
if(c!=0)
{
putc((c<<1)|0x81,f1);
for(a=0;a<c;a++)
{
putc(pic[lastp+a*1],f1);
}
}
}
}
putc(0,f1);
#ifdef VPSOFT
pxor(x1,y);
pxor(x2,y);
#endif
}
}
}
int savegfxdata3(FILE *f1,int x1,int y1,int x2,int y2)
{
int xl=x2-x1+1,yl=y2-y1+1;
int a,x,y,c;
int skip;
unsigned int u,u2,lastp;
y1--;
putw(0x0003,f1);
writefcporigo(f1,x1,y1,x2,y2);
putw(yl+1,f1);
putw(xl,f1);
{
for(x=x1;x<=x2;x++)
{
skip=1;
for(y=y1+1;y<=y2;y++)
{
u=x+y*320;
if(pic[u]==backcol)
{
skip++;
continue;
}
for(c=y;y<=y2+1;y++)
{
u=x+y*320;
if(pic[u]==backcol) break;
}
putc(y-c,f1);
putc(skip,f1); skip=0;
for(a=c;a<y;a++) putc(pic[x+a*320],f1);
y--;
}
putw(0,f1);
#ifdef VPSOFT
pxor(x1,y);
pxor(x2,y);
#endif
}
}
}
int savegfxdatax(FILE *f1,int x1,int y1,int x2,int y2)
{ /* codewise optimized sprite */
int xl=x2-x1+1,yl=y2-y1+1;
int a,x,y,z,c,be,b;
int skip;
unsigned char buf[400],wbuf[16];
unsigned int u,u2,lastp;
putw(0x0004,f1);
writefcporigo(f1,x1,y1,x2,y2);
putw(yl,f1);
putw(xl,f1);
for(z=0;z<4;z++)
{
for(y=y1;y<=y2;y++)
{
memset(buf,backcol,400);
for(be=0,x=x1+z;x<=x2;x+=4)
{
buf[be++]=pic[x+y*320];
}
for(c=b=0;b<be;b+=8)
{
wbuf[0]=0;
for(a=0;a<8;a++)
{
if(buf[a+b]!=backcol)
{
wbuf[a+1]=buf[a+b];
wbuf[0]|=(1<<a);
}
}
if(wbuf[0])
{ // some data!
if(c>0)
{
a=c*8;
while(a>240)
{
putc(0,f1);
putc(240,f1);
a-=240;
}
if(a)
{
putc(0,f1);
putc(a,f1);
}
c=0;
}
putc(wbuf[0],f1);
for(a=0;a<8;a++)
{
if(wbuf[0]&(1<<a))
{
putc(wbuf[a+1],f1);
}
}
}
else c++;
}
putc(0,f1);
putc(0,f1);
#ifdef VPSOFT
pxor(x1,y);
pxor(x2,y);
#endif
}
}
}

1243
GRAB/GLVP.C Normal file

File diff suppressed because it is too large Load diff

BIN
GRAB/GLVP.EXE Normal file

Binary file not shown.

BIN
GRAB/GLVP.OLD Normal file

Binary file not shown.

BIN
GRAB/KABOOM.FCP Normal file

Binary file not shown.

2
GRAB/KOE.BAT Normal file
View file

@ -0,0 +1,2 @@
vp2 d:xdeath1.cps /f3 -pxdie.pal /tw104 /th88 /x2F! -op -o9 -bxdie1
vp2 d:xdeath2.cps /f3 -pxdie.pal /tw112 /th88 /x2F! -op -o9 -bxdie2

2
GRAB/KOE2.BAT Normal file
View file

@ -0,0 +1,2 @@
ao xdie xdie1.fcp xdie2.fcp

361
GRAB/LBM16.C Normal file
View file

@ -0,0 +1,361 @@
#include <bios.h>
#include <stdlib.h>
/*
.ux format:
word 0xfcfc
word xsize
word ysize
word colors
word para-add for picture
word -
word -
word -
palette
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
#include <memory.h>
#include <malloc.h>
char inname[60]="mount.lbm";
char outname[60]="mount.ux";
FILE *out;
char buf[16384];
unsigned char pal[768]; /* loads pal to pal[] */
unsigned char linebuf[2560];
int xsz,ysz,planes,stencil,colors,mode;
int bpls=4;
main(int argc,char *argv[])
{
if(argc==1)
{
printf("usage: LBM16 <inlbm> <outfile> [bpls]\n");
return(0);
}
strcpy(inname,argv[1]);
strcpy(outname,argv[2]);
if(argc==4) bpls=atoi(argv[3]);
printf("[saving %i bitplanes]\n",bpls);
printf("Converting %s (lbm) => %s\n",inname,outname);
out=fopen(outname,"wb");
setvbuf(out,buf,_IOFBF,16384);
loadlbm(inname);
fclose(out);
printf("Done!\n");
}
int savelinebuf(int xl)
{
int a,b,c,x;
static int y=0;
unsigned char *p;
if(!xl)
{
colors=16;
a=(16+colors*3+15)/16;
putw(0xfcfc,out);
putw(xsz,out);
putw(ysz,out);
putw(colors,out);
putw(a,out);
putw(0,out);
putw(0,out);
putw(0,out);
fwrite(pal,3,colors,out);
while(ftell(out)<a*16) putc('X',out);
}
else
{
for(b=1;b<(1<<bpls);b<<=1)
{
for(x=0;x<xsz;x+=8)
{
p=linebuf+x;
a=0;
if(p[0]&b) a|=128;
if(p[1]&b) a|=64;
if(p[2]&b) a|=32;
if(p[3]&b) a|=16;
if(p[4]&b) a|=8;
if(p[5]&b) a|=4;
if(p[6]&b) a|=2;
if(p[7]&b) a|=1;
putc(a,out);
}
}
}
}
int eschit(void)
{
return(0);
}
/****************************************************/
/***** Deluxepaint LBM loader V1.0 **************/
/****************************************************/
FILE *f1;
int cbits[8]={1,2,4,8,16,32,64,128};
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt=NULL;
char lasttype[5];
char type[5]={"----"};
long len;
int filetype;
char lbmtype[4];
int checktype=0;
int loadlbm(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
printf("\nLoading and uncompressing picture (LBM): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=loadlbm2();
if(errtxt!=NULL)
{
printf("ERR:%s\n",errtxt);
hfree(filebuf);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
hfree(filebuf);
return(1);
}
else if(a==1) break;
}
while(!feof(f1) && !eschit());
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int loadlbm2(void)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<256*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
savelinebuf(0);
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
printf("Picture size %ix%ix%i\n",xsz,ysz,colors);
printf("Loading and converting: ");
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
filetype=1; /* LBM */
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",(int)(100L*(long)y/(long)ysz));
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",(int)(100L*(long)y/(long)ysz));
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}

BIN
GRAB/LBM16.EXE Normal file

Binary file not shown.

362
GRAB/LBM2P.C Normal file
View file

@ -0,0 +1,362 @@
#include <bios.h>
#include <stdlib.h>
/*
.ux format:
word 0xfcfc
word xsize
word ysize
word colors
word para-add for picture
word -
word -
word -
palette
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
#include <memory.h>
#include <malloc.h>
char inname[60]="mount.lbm";
char outname[60]="mount.ux";
FILE *out;
char buf[16384];
unsigned char pal[768]; /* loads pal to pal[] */
unsigned char linebuf[2560];
int xsz,ysz,planes,stencil,colors,mode;
main(int argc,char *argv[])
{
if(argc==1)
{
printf("usage: LBM2P <inlbm> <outfile>\n");
return(0);
}
strcpy(inname,argv[1]);
strcpy(outname,argv[2]);
printf("Converting %s (lbm) => %s (128 color packed)\n",inname,outname);
out=fopen(outname,"wb");
setvbuf(out,buf,_IOFBF,16384);
loadlbm(inname);
fclose(out);
printf("Done!\n");
}
char savebuf[8192];
char *sb;
int savelinebuf(int xl)
{
int a,b,c;
static int y=0;
if(!xl)
{
a=(16+colors*3+15)/16;
putw(0xfcfd,out);
putw(xsz,out);
putw(ysz,out);
putw(colors,out);
putw(a,out);
putw(0,out);
putw(0,out);
putw(0,out);
fwrite(pal,3,colors,out);
while(ftell(out)<a*16) putc('X',out);
}
else
{
int x,xs,s;
sb=savebuf;
for(xs=x=0;x<xl;x++)
{
if(linebuf[x]==linebuf[x+1] && linebuf[x]==linebuf[x+2])
{
for(s=3;s<127;s++) if(linebuf[x]!=linebuf[x+s]) break;
if(x+s>xl) s=xl-x;
*sb++=s|128;
*sb++=linebuf[x];
x+=s-1;
}
else
{
*sb++=linebuf[x]&127;
}
}
x=sb-savebuf;
putw(x,out);
fwrite(savebuf,1,x,out);
}
}
int eschit(void)
{
return(0);
}
/****************************************************/
/***** Deluxepaint LBM loader V1.0 **************/
/****************************************************/
FILE *f1;
int cbits[8]={1,2,4,8,16,32,64,128};
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt=NULL;
char lasttype[5];
char type[5]={"----"};
long len;
int filetype;
char lbmtype[16];
int checktype=0;
int loadlbm(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
printf("\nLoading and uncompressing picture (LBM): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=loadlbm2();
if(errtxt!=NULL)
{
printf("ERR:%s\n",errtxt);
hfree(filebuf);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
hfree(filebuf);
return(1);
}
else if(a==1) break;
}
while(!feof(f1) && !eschit());
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int loadlbm2(void)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<256*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
savelinebuf(0);
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
printf("Picture size %ix%ix%i\n",xsz,ysz,colors);
printf("Loading and converting: ");
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
filetype=1; /* LBM */
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",(int)(100L*(long)y/(long)ysz));
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",(int)(100L*(long)y/(long)ysz));
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}

BIN
GRAB/LBM2P.EXE Normal file

Binary file not shown.

BIN
GRAB/LBM2P.OBJ Normal file

Binary file not shown.

337
GRAB/LBM2U.C Normal file
View file

@ -0,0 +1,337 @@
#include <bios.h>
#include <stdlib.h>
/*
.ux format:
word 0xfcfc
word xsize
word ysize
word colors
word para-add for picture
word -
word -
word -
palette
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
#include <memory.h>
#include <malloc.h>
char inname[60]="mount.lbm";
char outname[60]="mount.ux";
FILE *out;
char buf[16384];
unsigned char pal[768]; /* loads pal to pal[] */
unsigned char linebuf[2560];
int xsz,ysz,planes,stencil,colors,mode;
main(int argc,char *argv[])
{
if(argc==1)
{
printf("usage: LBM2U <inlbm> <outfile>\n");
return(0);
}
strcpy(inname,argv[1]);
strcpy(outname,argv[2]);
printf("Converting %s (lbm) => %s\n",inname,outname);
out=fopen(outname,"wb");
setvbuf(out,buf,_IOFBF,16384);
loadlbm(inname);
fclose(out);
printf("Done!\n");
}
int savelinebuf(int xl)
{
int a,b,c;
static int y=0;
if(!xl)
{
a=(16+colors*3+15)/16;
putw(0xfcfc,out);
putw(xsz,out);
putw(ysz,out);
putw(colors,out);
putw(a,out);
putw(0,out);
putw(0,out);
putw(0,out);
fwrite(pal,3,colors,out);
while(ftell(out)<a*16) putc('X',out);
}
else fwrite(linebuf,1,xl,out);
}
int eschit(void)
{
return(0);
}
/****************************************************/
/***** Deluxepaint LBM loader V1.0 **************/
/****************************************************/
FILE *f1;
int cbits[8]={1,2,4,8,16,32,64,128};
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt=NULL;
char lasttype[5];
char type[5]={"----"};
long len;
int filetype;
char lbmtype[16];
int checktype=0;
int loadlbm(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
printf("\nLoading and uncompressing picture (LBM): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=loadlbm2();
if(errtxt!=NULL)
{
printf("ERR:%s\n",errtxt);
hfree(filebuf);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
hfree(filebuf);
return(1);
}
else if(a==1) break;
}
while(!feof(f1) && !eschit());
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int loadlbm2(void)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<256*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
savelinebuf(0);
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
printf("Picture size %ix%ix%i\n",xsz,ysz,colors);
printf("Loading and converting: ");
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
filetype=1; /* LBM */
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",(int)(100L*(long)y/(long)ysz));
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",(int)(100L*(long)y/(long)ysz));
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}

BIN
GRAB/LBM2U.EXE Normal file

Binary file not shown.

147
GRAB/LFCP.C Normal file
View file

@ -0,0 +1,147 @@
/****************************************************/
/***** FuturePicture loader (FCP) V1.0 ************/
/****************************************************/
int loadfcp(char *fname)
{
int multiple=0;
int pz;
int format;
int x,y,a,b,c,d;
int cnt,cntm;
int minx,miny,maxx,maxy,xo,yo,cols;
int infocnt=0;
int style;
int z,zm=1;
int plane4;
long l;
char far *filebuf;
unsigned u;
filebuf=halloc(32768L,1L);
#ifndef AOLOAD
printf("\nLoading and uncompressing picture (FCP): ");
#endif
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
if(setback255) memset(pic2,255,64000);
{
/* header */
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
a=getc(f1);
if(a!='F') return(2);
a=getc(f1);
if(a!='C') return(2);
a=getc(f1);
if(a!='P') return(2);
a=getc(f1);
if(a!=0x1a) return(2);
a=getc(f1);
if(a!=0x10) return(2);
b=getc(f1);
pics=getw(f1);
fread(picpos,4,pics,f1);
if(b&1)
{
fread(pal,256*3,1,f1);
}
if(pics>1)
{
multiple=1;
#ifndef AOLOAD
printf("\n\nFCP file contains multiple pictures.\n"
"Press Space to view next with animation\n"
" Enter to view next with flipping\n"
" 'S' to select picture\n\n"
"Press any key to start.");
getch();
reg.x.ax=0x13;
int86(0x10,&reg,&reg);
#endif
viewpal(0);
}
/* pic */
for(pz=0;pz<pics;pz++)
{
fseek(f1,(long)picpos[pz],SEEK_SET);
a=getc(f1);
if(a!=0x10) return(2);
format=getc(f1); style=format&15;
minx=getw(f1);
miny=getw(f1);
maxx=getw(f1);
maxy=getw(f1);
xo=-minx;
yo=-miny;
#ifdef AOLOAD
bx1=by1=0;
if(maxx-minx>bx2) bx2=maxx-minx;
if(maxy-miny>by2) by2=maxy-miny;
#endif
if(format&16)
{
plane4=4;
zm=4;
}
else plane4=1;
for(z=0;z<zm;z++)
{
if(style==15)
{ /* fastwing */
while(!eschit())
{
infocnt++; infocnt&=63;
if(infocnt==0 && pics==1 && !multiple) printf(".");
y=getw(f1);
if(y==0x8000) break;
y+=yo;
x=getw(f1)+xo;
cntm=getw(f1);
if(cntm<0)
{
a=(int)((char)cntm);
cntm=1;
d=0;
}
else d=1;
for(cnt=0;cnt<cntm;cnt++)
{
if(d) a=getw(f1);
else d=1;
if(a<0)
{
b=getc(f1);
a=-a;
for(c=0;c<a;c++,x++) pic[x*plane4+z+y*320]=b;
}
else
{
for(c=0;c<a;c++,x++) pic[x*plane4+z+y*320]=getc(f1);
}
}
}
}
}
if(pics!=1)
{
#ifndef AOLOAD
viewpic(0);
{
a=getch();
if(a==27 || a=='s' || a=='S') break;
if(a==13 && pz!=pics-1) memset(pic,setback255?255:0,64000);
}
#else
onepicdone();
#endif
}
}
fclose(f1);
}
return(0);
}

264
GRAB/LOADLBM.C Normal file
View file

@ -0,0 +1,264 @@
unsigned char pal[768]; /* loads pal to pal[] */
unsigned char far pic[64000]; /* loads pic to pic[] */
unsigned char far pic2[64000];
/****************************************************/
/***** Deluxepaint LBM loader V1.0 **************/
/****************************************************/
FILE *f1;
int cbits[8]={1,2,4,8,16,32,64,128};
unsigned char linebuf[320];
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt=NULL;
char lasttype[5];
char type[5]={"----"};
long len;
int xsz,ysz,planes,stencil,colors,mode;
char lbmtype[10];
int checktype=0;
int loadlbm(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
printf("\nLoading and uncompressing picture (LBM): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=loadlbm2();
if(errtxt!=NULL)
{
printf("%s\n",errtxt);
hfree(filebuf);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
hfree(filebuf);
return(1);
}
else if(a==1) break;
}
while(!feof(f1) && !eschit());
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int loadlbm2(void)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<256*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
filetype=1; /* LBM */
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",100*y/ysz);
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
memcpy(pic+y*320,linebuf,xsz);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",100*y/ysz);
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
memcpy(pic+y*320,linebuf,xsz);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}

1
GRAB/MAKE2.BAT Normal file
View file

@ -0,0 +1 @@
c:\dos\prg\make vp2

BIN
GRAB/MB.GFX Normal file

Binary file not shown.

BIN
GRAB/MB3.GFX Normal file

Binary file not shown.

1
GRAB/NMAKE.BAT Normal file
View file

@ -0,0 +1 @@
c:\dos\prg\make vp

BIN
GRAB/PALETTE.WC1 Normal file

Binary file not shown.

BIN
GRAB/PALETTE.WC2 Normal file

Binary file not shown.

64
GRAB/PALVIEW.C Normal file
View file

@ -0,0 +1,64 @@
#include <stdio.h>
#include <bios.h>
#include <stdlib.h>
#define pset(xx,yy,cc) *(vram+(xx)+(yy)*320)=(cc);
union REGS reg;
main(int argc,char *argv[])
{
int minr=999,ming=999,minb=999;
int maxr=0,maxg=0,maxb=0;
int a,b,c;
int xr,xg,xb;
int div=1;
int x,y;
long start=0;
char far *vram=(char far *)0xa0000000;
FILE *f1;
if(argc==1)
{
printf("usage: VIEWPAL <filename> [byte to start] [4 to divide]\n");
return(0);
}
f1=fopen(argv[1],"rb");
if(f1==NULL) return(0);
if(argc>=3) start=atol(argv[2]);
if(argc>=4) { div=4; }
fseek(f1,start,SEEK_SET);
reg.x.ax=0x13;
int86(0x10,&reg,&reg);
for(y=0;y<16;y++) for(x=0;x<16;x++)
{
a=x*16+y;
for(b=0;b<4;b++) for(c=0;c<4;c++)
{
pset(x*4+b,y*4+c,a);
}
}
outp(0x3c8,0);
for(a=0;a<256;a++)
{
xr=getc(f1)/div;
xg=getc(f1)/div;
xb=getc(f1)/div;
outp(0x3c9,xr);
outp(0x3c9,xg);
outp(0x3c9,xb);
if(xr<minr) minr=xr;
if(xg<ming) ming=xg;
if(xb<minb) minb=xb;
if(xr>maxr) maxr=xr;
if(xg>maxg) maxg=xg;
if(xb>maxb) maxb=xb;
}
fclose(f1);
getch();
reg.x.ax=0x3;
int86(0x10,&reg,&reg);
printf("Min: R:%-3i G:%-3i B:%-3i\n",minr,ming,minb);
printf("Max: R:%-3i G:%-3i B:%-3i\n",maxr,maxg,maxb);
}

BIN
GRAB/PALVIEW.EXE Normal file

Binary file not shown.

5
GRAB/PIC001.BIN Normal file
View file

@ -0,0 +1,5 @@
                                _ _ Ф Ф Ф Ф Ф _ _                                                           _       /   _Ф_ \    _                            / л \     /  _/ Г
\_  \      / л \                         S<>h<EFBFBD>u<EFBFBD>t<EFBFBD>t<EFBFBD>l<EFBFBD>e<EFBFBD> T h e S o f t / В л В \ / / к
Х
П
\ \ / В л В \   о Б В л В Б н   Г  /л л л л л л л л л \ Г   о Б В л В Б н                         A<>w<EFBFBD>a<EFBFBD>i<EFBFBD>t<EFBFBD>s<EFBFBD>.<2E>.<2E>.<2E>      Г Б В В Б Г  / л Гл кТГГГГГТПл Г л \  Г Б В В Б Г                                        Г Б В л В Б Г Г л л ГкФФФФТФФФФПГ л л Г Г Б В л В Б Г                                Г Б В л В Б Г Г л л ГГАБВллГллВБАГГл л Г Г Б В л В Б Г                      Г Б В л В Б Г Г л л ГГАБВллГллВБАГГл л Г Г Б В л В Б Г                   Г Б В л В Б Г Г л /лГАБВллГллВБАГл\л Г Г Б В л В Б Г               Г Б В л В Б Г Г /ВлГАБВллГллВБАГлВ\Г Г Б В л В Б Г                  Г Б В л В Б Г /ВВлГАБВллГллВБАГлВВ\ Г Б В л В Б Г                   Г Б В л В Б Г /БВВлГАБВллГллВБАГлВВБ\Г Б В л В Б Г                 Г Б В л В Б /ББВВлГАБВллГллВБАГлВВББ\Б В л В Б Г                     Г Б __ФйБББВВлГАБВллГллВБАГлВВБББРФ__Б Г                          __ФйБББББББВВлГАБВллГллВБАГлВВБББББББРФ__                                    _ФйБББББББББББВВлУФФФФФСФФФФФДлВВБББББББББББРФ_                               /ББББББББББББББВВл/АБВллллВБА\лВВББББББББББББББ\                              /БББББББББББББББВВ_N_.АБВлГГлВБА_._NВВБББББББББББББББ\                            ГББББББББББББББББВ/  \БВлГГлВБ/  \ВББББББББББББББББГ                           ГББББББББББББББББГ    ГВлГГлВГ    ГББББББББББББББББГ                           ГББББББББББББББББГ    ГВлГГлВГ    ГББББББББББББББББГ                           РФФФФФФФФФФФФФФФФСФФФФСФФД УФФСФФФФСФФФФФФФФФФФФФФФФй                                  Г Б В л В Б Г Г  РФФФФйРФйРФФФФй  Г Г Б В л В Б Г                        E:\S\P\GRAB>       Р Ф Ф Ф Ф Ф й Р Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф Ф й Р Ф Ф Ф Ф Ф й                        

BIN
GRAB/PIC001.LBM Normal file

Binary file not shown.

2
GRAB/REMA.BAT Normal file
View file

@ -0,0 +1,2 @@
release
mark

164
GRAB/SFCP.C Normal file
View file

@ -0,0 +1,164 @@
char packbuf[16384];
int packbufpnt,packbufcnt;
#define stosw(xx) { packbuf[packbufpnt++]=xx&255; packbuf[packbufpnt++]=xx>>8; }
#define stosb(xx) packbuf[packbufpnt++]=xx
int savepack(FILE *f1)
{
int a,b,c;
if(f1!=NULL)
{
b=packbuf[2];
a=packbuf[3];
if((a==0 && b<128) || (a==-1 && b>-128)) c=1; else c=0;
packbuf[0]=packbufcnt&255; packbuf[1]=packbufcnt>>8;
if(packbufcnt==1 && c==1)
{
packbuf[3]=128;
fwrite(packbuf+2,1,packbufpnt-2,f1);
}
else fwrite(packbuf,1,packbufpnt,f1);
}
packbufpnt=2;
packbufcnt=0;
}
int savefcpdata(FILE *f1,int x1,int y1,int x2,int y2)
{ /* single */
int style;
int tx1=x1,ty1=y1,tx2=x2,ty2=y2;
int xl=x2-x1+1,yl=y2-y1+1;
int xo,yo;
int x,y,z,zm=1;
int a,b,c,d,w,wc;
unsigned u;
long tell4,telltbl;
long pic1pos;
unsigned planepos[4];
savepack(NULL);
pic1pos=ftell(f1);
planepos[0]=planepos[1]=planepos[2]=planepos[3]=0x1234;
putc(0x10,f1); /* pic ver */
switch(fcpstyle)
{
case 15 : a=15; /* fastwing */
break;
}
style=a;
if(fcp4plane) a|=16;
if(fcptransp) a|=32;
if(fcpsavepal) a|=64;
putc(a,f1);
if(fcporigo && fcpstyle==15)
{
xo=xl/2;
yo=yl/2;
}
else xo=yo=0;
putw(xo,f1); /* minx */
putw(yo,f1); /* miny */
putw(xl-xo-1,f1); /* maxx */
putw(yl-yo-1,f1); /* maxy */
if(fcp4plane)
{
memcpy(pic2,pic,64000);
x1=x1/4;
x2=(x2+3)/4;
xl=x2-x1+1;
a|=16;
tell4=ftell(f1);
zm=4;
}
else xo+=x1; yo+=y1;
for(z=0;z<zm;z++)
{
if(fcp4plane)
{
x1=0;
x2=xl-1;
memset(pic,backcol,64000);
b=xl; if(xl*4+z>(tx2-tx1+1)) b--;
for(y=y1;y<=y2;y++) for(a=0,x=tx1+z;a<b;x+=4,a++)
{
pic[a+y*320]=pic2[x+y*320];
}
planepos[z]=ftell(f1);
}
switch(style)
{
case 15 : /* fastwing */
for(y=y1;y<=y2;y++)
{
for(x=x1;x<=x2;x++)
{
u=x+y*320;
if(pic[u]!=backcol || !fcptransp)
{
putw(y-yo,f1);
putw(x-xo,f1);
b=x2-x+1;
d=pic[u];
w=0; wc=0;
for(a=0;a<b;)
{
for(c=0;a<b;a++)
{
if(pic[u+a]==d) c++;
else break;
}
if(c>4)
{
if(wc>0)
{
int a;
packbufcnt++;
stosw(wc);
for(a=0;a<wc;a++)
{
stosb(pic[u+w+a]);
}
w+=wc;
}
packbufcnt++;
stosw(-c);
stosb(d);
w=a; wc=0;
if(pic[u+a]==backcol && fcptransp) break;
d=pic[u+a];
}
else
{
wc=a-w;
d=pic[u+a];
if(pic[u+a]==backcol && fcptransp) break;
}
}
if(wc>0)
{
int a;
packbufcnt++;
stosw(wc);
for(a=0;a<wc;a++)
{
stosb(pic[u+w+a]);
}
}
x+=a-1;
savepack(f1);
}
}
pxor(tx1,ty1+y-y1);
pxor(tx2,ty1+y-y1);
}
putw(0x8000,f1);
break;
}
}
if(fcp4plane)
{
memcpy(pic,pic2,64000);
}
fseek(f1,0L,SEEK_END);
}

418
GRAB/SP.C Normal file
View file

@ -0,0 +1,418 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
/* conversion palette to DEFPAL */
int wc2conv[]={0,42,120,57,186,90,152,21,26,37,116,52,181,196,130,16
,24,208,225,210,211,212,213,214,215,216,217,218,220,221,222,223
,32,33,34,35,36,37,38,40,40,41,43,44,45,46,47,0
,32,33,67,68,70,71,72,73,74,75,75,76,77,78,47,47
,128,241,242,243,244,245,167,183,184,185,186,187,188,189,190,191
,48,177,178,179,180,181,182,183,242,254,253,117,120,122,124,127
,16,161,145,212,148,149,150,151,152,152,153,154,155,156,141,158
,16,161,162,227,228,229,230,231,232,233,234,235,236,237,238,0
,16,176,162,163,164,165,166,167,168,169,170,234,235,236,238,0
,16,32,49,50,51,52,53,55,55,56,57,59,60,61,63,0
,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,0
,208,162,179,181,181,199,200,201,202,203,204,204,205,206,207,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,112,97,98,99,100,101,102,103,104,105,106,106,108,108,109,110
,208,210,212,255,217,219,220,157,151,231,232,170,171,234,188,239
,249,250,251,252,122,123,124,125,47,0,0,0,0,0,0,255};
unsigned char far pic[64000];
int fcporigo=2,fcporigox,fcporigoy;
int backcol=255;
int savegfx=0;
int savegfx1=0;
FILE *gfx;
#include "gfxsave.h"
char palette[768];
int origox,origoy;
unsigned int maxp;
unsigned int pp=0;
int getcol(void);
unsigned char far buf[64010];
long table[1024];
char *fname=NULL;
int picnum=1;
int showpal=0;
int origox=0,origoy=0,origoreset=0;
char *palfile="palette.wc2";
int longanim=0;
int savelbm=0;
char far *vram=(char far *)0xa0000000;
unsigned picposu[256],pn=0;
main(int argc,char *argv[])
{
int filenum;
int o;
char fstr[80];
FILE *f1;
int sz1,sz2,sz3,sz4,num,mx,my;
int x,y,a,tx,ty,b,c,pix;
long l,l1,l2,eob;
int beg,end;
unsigned u;
printf("Origin PIC viewer V3.0\n");
if(argc==1)
{
printf("usage: SP <options> <fname> [pic number,none=all]"
"available options:\n"
"-l long animation (.1,.2,.3...)\n"
"-s show palette\n"
"-1 use wing commmander 1 palette\n"
"-o set origox to 160,100 (default: 0,0)\n"
"-ox# set origox\n"
"-oy# set origoy\n"
"-or reset origo for long anims pics >1\n"
"-f save with FutureGrabber to LBM:s\n"
"-h save as 1-bitplane-packed\n"
"-g save as GFX\n"
"-G save as GFX with DEFAULT palette\n"
);
return(0);
}
for(a=1;a<=argc;a++)
{
if(*argv[a]=='-' || *argv[a]=='/') switch(*(argv[a]+1))
{
case 'l' : longanim=1; break;
case 'o' : switch(*(argv[a]+2))
{
case 'x' :
origox=atoi(argv[a]+3);
break;
case 'y' :
origoy=atoi(argv[a]+3);
break;
case 'r' :
origoreset=1;
break;
default :
origox=160; origoy=100;
break;
} break;
case 's' : showpal=1; break;
case '1' : palfile="palette.wc1"; break;
case 'f' : savelbm=1; break;
case 'g' : savegfx=1; break;
case 'G' : savegfx=2; break;
case 'h' : savegfx1=1; break;
}
else
{
if(fname==NULL)
{
fname=argv[a];
if(strchr(fname,'.')==NULL) longanim=1;
}
else picnum=atoi(argv[a]);
}
}
if(!longanim)
{
printf("Scanning... ");
f1=fopen(fname,"rb");
if(f1==NULL) { printf("File '%s' not found!\n",fname); return(1); }
fread(table,4,1024,f1);
fclose(f1);
num=table[1]/4-1;
table[num+1]=table[0];
printf("File contains %i pictures.\n",num);
}
else num=9999;
a=picnum;
if(a<0 || a>num) { printf("Number must be between 0 and %i!\n",num); return(3); }
_setvideomode(_MRES256COLOR);
f1=fopen(palfile,"rb");
for(b=0;b<768;b++) palette[b]=getc(f1);
fclose(f1);
palette[765]=2;
palette[766]=3;
palette[767]=4;
outp(0x3c8,0); for(b=0;b<256*3;b++)
{
outp(0x3c9,palette[b]);
}
if(showpal)
{
for(y=0;y<256;y++)
{
_setcolor(y);
_setpixel(y/16*2+320-33 ,(y&15)*2);
_setpixel(y/16*2+320-33+1,(y&15)*2);
_setpixel(y/16*2+320-33 ,(y&15)*2+1);
_setpixel(y/16*2+320-33+1,(y&15)*2+1);
}
getch();
}
if(a==0) { beg=1; end=num; } /* animate */
else beg=end=a;
_setcolor(255);
for(b=0;b<200;b++)
{
_moveto(0,b);
_lineto(319,b);
}
if(savegfx && longanim)
{
printf("Can't save a long animation in one part!\n");
return(1);
}
if(savegfx)
{
gfx=fopen("gfx.gfx","wb");
putc('G',gfx);
putc('F',gfx);
putc('X',gfx);
putc('1',gfx);
putc('0',gfx);
putc(0x1a,gfx);
putw(end-beg+1,gfx);
fwrite(picposu,2,end-beg+1,f1);
}
for(filenum=1;;filenum++)
{
if(longanim)
{
sprintf(fstr,"%s.%i",fname,filenum);
f1=fopen(fstr,"rb");
if(f1==NULL) break;
fread(table,4,1024,f1);
fclose(f1);
num=table[1]/4-1;
table[num+1]=table[0];
end=num;
beg=1;
}
else strcpy(fstr,fname);
for(a=beg;a<=end;a++)
{
if(savegfx)
{
b=16-((ftell(gfx))&15); if(b!=16) for(c=0;c<b;c++) putc(0,gfx);
picposu[pn++]=ftell(gfx)>>4;
}
f1=fopen(fstr,"rb");
fseek(f1,table[a],SEEK_SET);
eob=table[a+1];
sz3=getw(f1);
sz1=-getw(f1);
sz2=-getw(f1);
sz4=getw(f1);
mx=origox; my=origoy;
if(savegfx)
{
fcporigoy=-sz2;
fcporigox=-sz1;
}
for(;;)
{
int mode;
pix=getc(f1); pix+=getc(f1)*256;
if(feof(f1) || ftell(f1)>eob) break;
tx=getc(f1); tx+=getc(f1)*256; tx+=mx;
ty=getc(f1); ty+=getc(f1)*256; ty+=my;
mode=pix&1; pix>>=1;
u=pix;
if(mode==0) for(b=0;b<u;b++)
{
_setcolor(getc(f1));
_setpixel(tx++,ty);
}
else while(pix>0)
{
u=getc(f1);
mode=u&1;
u>>=1;
if(u==0) break;
switch(mode)
{
case 0 :
o=tx+ty*320;
pix-=u;
tx+=u;
for(b=0;b<u;b++)
{
*(vram+o++)=getc(f1);
}
break;
case 1 :
memset(vram+tx+ty*320,getc(f1),u);
pix-=u;
tx+=u;
break;
}
}
}
fclose(f1);
if(savegfx)
{
int x1,y1,x2,y2,a;
x1=origox+sz1;
x2=origox+sz3;
y1=origoy+sz2;
y2=origoy+sz4;
if(savegfx==2)
{
unsigned int u;
for(u=0;u<64000;u++) pic[u]=wc2conv[(unsigned char)vram[u]];
}
else memcpy(pic,vram,64000);
x1--; y1--; x2++; y2++;
for(a=x1;a<=x2;a++) vram[y1*320+a]=15;
for(a=x1;a<=x2;a++) vram[y2*320+a]=15;
for(a=y1;a<=y2;a++) vram[a*320+x1]=15;
for(a=y1;a<=y2;a++) vram[a*320+x2]=15;
x1++; y1++; x2--; y2--;
if(savegfx1) savegfxdata1(gfx,x1,y1,x2,y2);
else savegfxdata(gfx,x1,y1,x2,y2);
}
if(savelbm) _asm
{
mov ax,0fcfch
mov bx,01h
int 33h
}
else
{
do
{
b=getch();
}
while(b!=32 && b!=27 && b!=13 && b!='c');
if(b=='c')
{
origox=160; origoy=100;
savefc();
}
if(b==32)
{
_setcolor(255);
for(b=0;b<200;b++)
{
_moveto(0,b);
_lineto(319,b);
}
}
if(b==27) break;
}
}
if(!longanim) break;
if(origoreset) origox=origoy=0;
if(b==27) break;
}
if(savegfx)
{
fseek(gfx,8L,SEEK_SET);
fwrite(picposu,2,pn,gfx);
fclose(gfx);
}
_setvideomode(_DEFAULTMODE);
printf("File contained %i pictures.\n",num);
}
unsigned char sbuf[330];
int savefc(void)
{ /* color 255 considered transparent */
int x,y,a,b,c,d,e,f;
int leftx=origox,rightx=origox,upy=origoy,downy=origoy;
FILE *f1;
long sizepos;
f1=fopen("pic.fcp","wb");
fprintf(f1,"FCP1.000");
putw(0,f1); /* file type: 0=single pictures, 1=differential animation */
putw(1,f1); /* number of pictures */
putw(-1,f1); /* unused */
putw(-1,f1); /* unused */
putw(16+4,f1); putw(0,f1); /* far pointer(s) to picture(s) */
/* picture header, 16 bytes */
putc(1,f1); /* screen mode, 1=320x200x256 */
putc(1,f1); /* flags, incl. palette */
sizepos=ftell(f1);
putw(-1,f1); /* leftmost x */
putw(-1,f1); /* uppermost y */
putw(-1,f1); /* rightmost x */
putw(-1,f1); /* bottommost y */
putw(-1,f1); /* unused */
putw(-1,f1); /* unused */
putw(-1,f1); /* unused */
for(a=0;a<768;a++) putc(palette[a],f1);
for(y=0;y<200;y++)
{
for(x=0;x<320;)
{
if((a=_getpixel(x,y))!=255)
{
if(y<upy) upy=y;
if(y>downy) downy=y;
if(x<leftx) leftx=x;
putw(x-origox,f1); /* x */
putw(y-origoy,f1); /* y */
b=0;
do sbuf[b++]=a; while((a=_getpixel(++x,y))!=255 && x<320);
if(x>rightx) rightx=x;
sbuf[b]=255;
/* entire continuos part read */
for(d=a=0;a<b;)
{
if(sbuf[a]==sbuf[a+1] && sbuf[a]==sbuf[a+2]
&& sbuf[a]==sbuf[a+3] && sbuf[a]==sbuf[a+4])
{ /* at least 5 continuos */
if(a>d)
{
putw(a-d,f1);
for(e=d;e<a;e++) putc(sbuf[e],f1);
}
c=1; a++; f=sbuf[a];
while(f==sbuf[a])
{
c++;
a++;
}
putw(-c,f1);
putc(f,f1);
d=a;
}
else
{
a++;
}
}
if(a>d)
{
putw(a-d,f1);
for(e=d;e<a;e++) putc(sbuf[e],f1);
}
putw(0,f1); /* e-o-c-part*/
}
else x++;
}
}
putw(32767,f1); /* pic terminator */
fseek(f1,sizepos,SEEK_SET);
putw(leftx-origox,f1);
putw(upy-origoy,f1);
putw(rightx-origox,f1);
putw(downy-origoy,f1);
fclose(f1);
}

BIN
GRAB/SP.EXE Normal file

Binary file not shown.

31
GRAB/SYSFONT/F.C Normal file
View file

@ -0,0 +1,31 @@
#include <stdio.h>
char far *vram=(char far *)0xa0000000L;
main()
{
FILE *f1;
int a,b,y;
f1=fopen("font8x14.inc","wt");
_asm mov ax,16
_asm int 10h
for(a=0;a<256;a++)
{
printf(" %i\r",a);
_asm mov ah,09h
_asm mov al,byte ptr a
_asm mov bx,7
_asm mov cx,1
_asm int 10h
fprintf(f1,"db ");
for(y=0;y<14;y++)
{
b=vram[y*80];
fprintf(f1,"%i,",b);
}
fprintf(f1,"0,0 ;%i\n",a);
}
_asm mov ax,3
_asm int 10h
fclose(f1);
}

BIN
GRAB/SYSFONT/F.EXE Normal file

Binary file not shown.

256
GRAB/SYSFONT/FONT8X14.INC Normal file
View file

@ -0,0 +1,256 @@
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;0
db 0,0,126,-127,-91,-127,-127,-67,-103,-127,126,0,0,0,0,0 ;1
db 0,0,126,-1,-37,-1,-1,-61,-25,-1,126,0,0,0,0,0 ;2
db 0,0,0,108,-2,-2,-2,-2,124,56,16,0,0,0,0,0 ;3
db 0,0,0,16,56,124,-2,124,56,16,0,0,0,0,0,0 ;4
db 0,0,24,60,60,-25,-25,-25,24,24,60,0,0,0,0,0 ;5
db 0,0,24,60,126,-1,-1,126,24,24,60,0,0,0,0,0 ;6
db 0,0,0,0,0,24,60,60,24,0,0,0,0,0,0,0 ;7
db -1,-1,-1,-1,-1,-25,-61,-61,-25,-1,-1,-1,-1,-1,0,0 ;8
db 0,0,0,0,60,102,66,66,102,60,0,0,0,0,0,0 ;9
db -1,-1,-1,-1,-61,-103,-67,-67,-103,-61,-1,-1,-1,-1,0,0 ;10
db 0,0,30,14,26,50,120,-52,-52,-52,120,0,0,0,0,0 ;11
db 0,0,60,102,102,102,60,24,126,24,24,0,0,0,0,0 ;12
db 0,0,63,51,63,48,48,48,112,-16,-32,0,0,0,0,0 ;13
db 0,0,127,99,127,99,99,99,103,-25,-26,-64,0,0,0,0 ;14
db 0,0,24,24,-37,60,-25,60,-37,24,24,0,0,0,0,0 ;15
db 0,0,-128,-64,-32,-8,-2,-8,-32,-64,-128,0,0,0,0,0 ;16
db 0,0,2,6,14,62,-2,62,14,6,2,0,0,0,0,0 ;17
db 0,0,24,60,126,24,24,24,126,60,24,0,0,0,0,0 ;18
db 0,0,102,102,102,102,102,102,0,102,102,0,0,0,0,0 ;19
db 0,0,127,-37,-37,-37,123,27,27,27,27,0,0,0,0,0 ;20
db 0,124,-58,96,56,108,-58,-58,108,56,12,-58,124,0,0,0 ;21
db 0,0,0,0,0,0,0,0,-2,-2,-2,0,0,0,0,0 ;22
db 0,0,24,60,126,24,24,24,126,60,24,126,0,0,0,0 ;23
db 0,0,24,60,126,24,24,24,24,24,24,0,0,0,0,0 ;24
db 0,0,24,24,24,24,24,24,126,60,24,0,0,0,0,0 ;25
db 0,0,0,0,24,12,-2,12,24,0,0,0,0,0,0,0 ;26
db 0,0,0,0,48,96,-2,96,48,0,0,0,0,0,0,0 ;27
db 0,0,0,0,0,-64,-64,-64,-2,0,0,0,0,0,0,0 ;28
db 0,0,0,0,40,108,-2,108,40,0,0,0,0,0,0,0 ;29
db 0,0,0,16,56,56,124,124,-2,-2,0,0,0,0,0,0 ;30
db 0,0,0,-2,-2,124,124,56,56,16,0,0,0,0,0,0 ;31
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;32
db 0,0,24,60,60,60,24,24,0,24,24,0,0,0,0,0 ;33
db 0,102,102,102,36,0,0,0,0,0,0,0,0,0,0,0 ;34
db 0,0,108,108,-2,108,108,108,-2,108,108,0,0,0,0,0 ;35
db 24,24,124,-58,-62,-64,124,6,-122,-58,124,24,24,0,0,0 ;36
db 0,0,0,0,-62,-58,12,24,48,102,-58,0,0,0,0,0 ;37
db 0,0,56,108,108,56,118,-36,-52,-52,118,0,0,0,0,0 ;38
db 0,48,48,48,96,0,0,0,0,0,0,0,0,0,0,0 ;39
db 0,0,12,24,48,48,48,48,48,24,12,0,0,0,0,0 ;40
db 0,0,48,24,12,12,12,12,12,24,48,0,0,0,0,0 ;41
db 0,0,0,0,102,60,-1,60,102,0,0,0,0,0,0,0 ;42
db 0,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0 ;43
db 0,0,0,0,0,0,0,0,24,24,24,48,0,0,0,0 ;44
db 0,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0 ;45
db 0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0 ;46
db 0,0,2,6,12,24,48,96,-64,-128,0,0,0,0,0,0 ;47
db 0,0,124,-58,-50,-34,-10,-26,-58,-58,124,0,0,0,0,0 ;48
db 0,0,24,56,120,24,24,24,24,24,126,0,0,0,0,0 ;49
db 0,0,124,-58,6,12,24,48,96,-58,-2,0,0,0,0,0 ;50
db 0,0,124,-58,6,6,60,6,6,-58,124,0,0,0,0,0 ;51
db 0,0,12,28,60,108,-52,-2,12,12,30,0,0,0,0,0 ;52
db 0,0,-2,-64,-64,-64,-4,6,6,-58,124,0,0,0,0,0 ;53
db 0,0,56,96,-64,-64,-4,-58,-58,-58,124,0,0,0,0,0 ;54
db 0,0,-2,-58,6,12,24,48,48,48,48,0,0,0,0,0 ;55
db 0,0,124,-58,-58,-58,124,-58,-58,-58,124,0,0,0,0,0 ;56
db 0,0,124,-58,-58,-58,126,6,6,12,120,0,0,0,0,0 ;57
db 0,0,0,24,24,0,0,0,24,24,0,0,0,0,0,0 ;58
db 0,0,0,24,24,0,0,0,24,24,48,0,0,0,0,0 ;59
db 0,0,6,12,24,48,96,48,24,12,6,0,0,0,0,0 ;60
db 0,0,0,0,0,126,0,0,126,0,0,0,0,0,0,0 ;61
db 0,0,96,48,24,12,6,12,24,48,96,0,0,0,0,0 ;62
db 0,0,124,-58,-58,12,24,24,0,24,24,0,0,0,0,0 ;63
db 0,0,124,-58,-58,-34,-34,-34,-36,-64,124,0,0,0,0,0 ;64
db 0,0,16,56,108,-58,-58,-2,-58,-58,-58,0,0,0,0,0 ;65
db 0,0,-4,102,102,102,124,102,102,102,-4,0,0,0,0,0 ;66
db 0,0,60,102,-62,-64,-64,-64,-62,102,60,0,0,0,0,0 ;67
db 0,0,-8,108,102,102,102,102,102,108,-8,0,0,0,0,0 ;68
db 0,0,-2,102,98,104,120,104,98,102,-2,0,0,0,0,0 ;69
db 0,0,-2,102,98,104,120,104,96,96,-16,0,0,0,0,0 ;70
db 0,0,60,102,-62,-64,-64,-34,-58,102,58,0,0,0,0,0 ;71
db 0,0,-58,-58,-58,-58,-2,-58,-58,-58,-58,0,0,0,0,0 ;72
db 0,0,60,24,24,24,24,24,24,24,60,0,0,0,0,0 ;73
db 0,0,30,12,12,12,12,12,-52,-52,120,0,0,0,0,0 ;74
db 0,0,-26,102,108,108,120,108,108,102,-26,0,0,0,0,0 ;75
db 0,0,-16,96,96,96,96,96,98,102,-2,0,0,0,0,0 ;76
db 0,0,-58,-18,-2,-2,-42,-58,-58,-58,-58,0,0,0,0,0 ;77
db 0,0,-58,-26,-10,-2,-34,-50,-58,-58,-58,0,0,0,0,0 ;78
db 0,0,56,108,-58,-58,-58,-58,-58,108,56,0,0,0,0,0 ;79
db 0,0,-4,102,102,102,124,96,96,96,-16,0,0,0,0,0 ;80
db 0,0,124,-58,-58,-58,-58,-42,-34,124,12,14,0,0,0,0 ;81
db 0,0,-4,102,102,102,124,108,102,102,-26,0,0,0,0,0 ;82
db 0,0,124,-58,-58,96,56,12,-58,-58,124,0,0,0,0,0 ;83
db 0,0,126,126,90,24,24,24,24,24,60,0,0,0,0,0 ;84
db 0,0,-58,-58,-58,-58,-58,-58,-58,-58,124,0,0,0,0,0 ;85
db 0,0,-58,-58,-58,-58,-58,-58,108,56,16,0,0,0,0,0 ;86
db 0,0,-58,-58,-58,-58,-42,-42,-2,124,108,0,0,0,0,0 ;87
db 0,0,-58,-58,108,56,56,56,108,-58,-58,0,0,0,0,0 ;88
db 0,0,102,102,102,102,60,24,24,24,60,0,0,0,0,0 ;89
db 0,0,-2,-58,-116,24,48,96,-62,-58,-2,0,0,0,0,0 ;90
db 0,0,60,48,48,48,48,48,48,48,60,0,0,0,0,0 ;91
db 0,0,-128,-64,-32,112,56,28,14,6,2,0,0,0,0,0 ;92
db 0,0,60,12,12,12,12,12,12,12,60,0,0,0,0,0 ;93
db 16,56,108,-58,0,0,0,0,0,0,0,0,0,0,0,0 ;94
db 0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0 ;95
db 48,48,24,0,0,0,0,0,0,0,0,0,0,0,0,0 ;96
db 0,0,0,0,0,120,12,124,-52,-52,118,0,0,0,0,0 ;97
db 0,0,-32,96,96,120,108,102,102,102,124,0,0,0,0,0 ;98
db 0,0,0,0,0,124,-58,-64,-64,-58,124,0,0,0,0,0 ;99
db 0,0,28,12,12,60,108,-52,-52,-52,118,0,0,0,0,0 ;100
db 0,0,0,0,0,124,-58,-2,-64,-58,124,0,0,0,0,0 ;101
db 0,0,56,108,100,96,-16,96,96,96,-16,0,0,0,0,0 ;102
db 0,0,0,0,0,118,-52,-52,-52,124,12,-52,120,0,0,0 ;103
db 0,0,-32,96,96,108,118,102,102,102,-26,0,0,0,0,0 ;104
db 0,0,24,24,0,56,24,24,24,24,60,0,0,0,0,0 ;105
db 0,0,6,6,0,14,6,6,6,6,102,102,60,0,0,0 ;106
db 0,0,-32,96,96,102,108,120,108,102,-26,0,0,0,0,0 ;107
db 0,0,56,24,24,24,24,24,24,24,60,0,0,0,0,0 ;108
db 0,0,0,0,0,-20,-2,-42,-42,-42,-58,0,0,0,0,0 ;109
db 0,0,0,0,0,-36,102,102,102,102,102,0,0,0,0,0 ;110
db 0,0,0,0,0,124,-58,-58,-58,-58,124,0,0,0,0,0 ;111
db 0,0,0,0,0,-36,102,102,102,124,96,96,-16,0,0,0 ;112
db 0,0,0,0,0,118,-52,-52,-52,124,12,12,30,0,0,0 ;113
db 0,0,0,0,0,-36,118,102,96,96,-16,0,0,0,0,0 ;114
db 0,0,0,0,0,124,-58,112,28,-58,124,0,0,0,0,0 ;115
db 0,0,16,48,48,-4,48,48,48,54,28,0,0,0,0,0 ;116
db 0,0,0,0,0,-52,-52,-52,-52,-52,118,0,0,0,0,0 ;117
db 0,0,0,0,0,102,102,102,102,60,24,0,0,0,0,0 ;118
db 0,0,0,0,0,-58,-58,-42,-42,-2,108,0,0,0,0,0 ;119
db 0,0,0,0,0,-58,108,56,56,108,-58,0,0,0,0,0 ;120
db 0,0,0,0,0,-58,-58,-58,-58,126,6,12,-8,0,0,0 ;121
db 0,0,0,0,0,-2,-52,24,48,102,-2,0,0,0,0,0 ;122
db 0,0,14,24,24,24,112,24,24,24,14,0,0,0,0,0 ;123
db 0,0,24,24,24,24,0,24,24,24,24,0,0,0,0,0 ;124
db 0,0,112,24,24,24,14,24,24,24,112,0,0,0,0,0 ;125
db 0,0,118,-36,0,0,0,0,0,0,0,0,0,0,0,0 ;126
db 0,0,0,0,16,56,108,-58,-58,-2,0,0,0,0,0,0 ;127
db 0,0,60,102,-62,-64,-64,-62,102,60,12,6,124,0,0,0 ;128
db 0,0,-52,-52,0,-52,-52,-52,-52,-52,118,0,0,0,0,0 ;129
db 0,12,24,48,0,124,-58,-2,-64,-58,124,0,0,0,0,0 ;130
db 0,16,56,108,0,120,12,124,-52,-52,118,0,0,0,0,0 ;131
db 0,0,-52,-52,0,120,12,124,-52,-52,118,0,0,0,0,0 ;132
db 0,96,48,24,0,120,12,124,-52,-52,118,0,0,0,0,0 ;133
db 0,56,108,56,0,120,12,124,-52,-52,118,0,0,0,0,0 ;134
db 0,0,0,0,60,102,96,102,60,12,6,60,0,0,0,0 ;135
db 0,16,56,108,0,124,-58,-2,-64,-58,124,0,0,0,0,0 ;136
db 0,0,-52,-52,0,124,-58,-2,-64,-58,124,0,0,0,0,0 ;137
db 0,96,48,24,0,124,-58,-2,-64,-58,124,0,0,0,0,0 ;138
db 0,0,102,102,0,56,24,24,24,24,60,0,0,0,0,0 ;139
db 0,24,60,102,0,56,24,24,24,24,60,0,0,0,0,0 ;140
db 0,96,48,24,0,56,24,24,24,24,60,0,0,0,0,0 ;141
db 0,-58,-58,16,56,108,-58,-58,-2,-58,-58,0,0,0,0,0 ;142
db 56,108,56,0,56,108,-58,-58,-2,-58,-58,0,0,0,0,0 ;143
db 24,48,96,0,-2,102,96,124,96,102,-2,0,0,0,0,0 ;144
db 0,0,0,0,-52,118,54,126,-40,-40,110,0,0,0,0,0 ;145
db 0,0,62,108,-52,-52,-2,-52,-52,-52,-50,0,0,0,0,0 ;146
db 0,16,56,108,0,124,-58,-58,-58,-58,124,0,0,0,0,0 ;147
db 0,0,-58,-58,0,124,-58,-58,-58,-58,124,0,0,0,0,0 ;148
db 0,96,48,24,0,124,-58,-58,-58,-58,124,0,0,0,0,0 ;149
db 0,48,120,-52,0,-52,-52,-52,-52,-52,118,0,0,0,0,0 ;150
db 0,96,48,24,0,-52,-52,-52,-52,-52,118,0,0,0,0,0 ;151
db 0,0,-58,-58,0,-58,-58,-58,-58,126,6,12,120,0,0,0 ;152
db 0,-58,-58,56,108,-58,-58,-58,-58,108,56,0,0,0,0,0 ;153
db 0,-58,-58,0,-58,-58,-58,-58,-58,-58,124,0,0,0,0,0 ;154
db 0,24,24,60,102,96,96,102,60,24,24,0,0,0,0,0 ;155
db 0,56,108,100,96,-16,96,96,96,-26,-4,0,0,0,0,0 ;156
db 0,0,102,102,60,24,126,24,126,24,24,0,0,0,0,0 ;157
db 0,-8,-52,-52,-8,-60,-52,-34,-52,-52,-58,0,0,0,0,0 ;158
db 0,14,27,24,24,24,126,24,24,24,24,-40,112,0,0,0 ;159
db 0,24,48,96,0,120,12,124,-52,-52,118,0,0,0,0,0 ;160
db 0,12,24,48,0,56,24,24,24,24,60,0,0,0,0,0 ;161
db 0,24,48,96,0,124,-58,-58,-58,-58,124,0,0,0,0,0 ;162
db 0,24,48,96,0,-52,-52,-52,-52,-52,118,0,0,0,0,0 ;163
db 0,0,118,-36,0,-36,102,102,102,102,102,0,0,0,0,0 ;164
db 118,-36,0,-58,-26,-10,-2,-34,-50,-58,-58,0,0,0,0,0 ;165
db 0,60,108,108,62,0,126,0,0,0,0,0,0,0,0,0 ;166
db 0,56,108,108,56,0,124,0,0,0,0,0,0,0,0,0 ;167
db 0,0,48,48,0,48,48,96,-58,-58,124,0,0,0,0,0 ;168
db 0,0,0,0,0,0,-2,-64,-64,-64,0,0,0,0,0,0 ;169
db 0,0,0,0,0,0,-2,6,6,6,0,0,0,0,0,0 ;170
db 0,-64,-64,-58,-52,-40,48,96,-36,-122,12,24,62,0,0,0 ;171
db 0,-64,-64,-58,-52,-40,48,102,-50,-98,62,6,6,0,0,0 ;172
db 0,0,24,24,0,24,24,60,60,60,24,0,0,0,0,0 ;173
db 0,0,0,0,54,108,-40,108,54,0,0,0,0,0,0,0 ;174
db 0,0,0,0,-40,108,54,108,-40,0,0,0,0,0,0,0 ;175
db 17,68,17,68,17,68,17,68,17,68,17,68,17,68,0,0 ;176
db 85,-86,85,-86,85,-86,85,-86,85,-86,85,-86,85,-86,0,0 ;177
db -35,119,-35,119,-35,119,-35,119,-35,119,-35,119,-35,119,0,0 ;178
db 24,24,24,24,24,24,24,24,24,24,24,24,24,24,0,0 ;179
db 24,24,24,24,24,24,24,-8,24,24,24,24,24,24,0,0 ;180
db 24,24,24,24,24,-8,24,-8,24,24,24,24,24,24,0,0 ;181
db 54,54,54,54,54,54,54,-10,54,54,54,54,54,54,0,0 ;182
db 0,0,0,0,0,0,0,-2,54,54,54,54,54,54,0,0 ;183
db 0,0,0,0,0,-8,24,-8,24,24,24,24,24,24,0,0 ;184
db 54,54,54,54,54,-10,6,-10,54,54,54,54,54,54,0,0 ;185
db 54,54,54,54,54,54,54,54,54,54,54,54,54,54,0,0 ;186
db 0,0,0,0,0,-2,6,-10,54,54,54,54,54,54,0,0 ;187
db 54,54,54,54,54,-10,6,-2,0,0,0,0,0,0,0,0 ;188
db 54,54,54,54,54,54,54,-2,0,0,0,0,0,0,0,0 ;189
db 24,24,24,24,24,-8,24,-8,0,0,0,0,0,0,0,0 ;190
db 0,0,0,0,0,0,0,-8,24,24,24,24,24,24,0,0 ;191
db 24,24,24,24,24,24,24,31,0,0,0,0,0,0,0,0 ;192
db 24,24,24,24,24,24,24,-1,0,0,0,0,0,0,0,0 ;193
db 0,0,0,0,0,0,0,-1,24,24,24,24,24,24,0,0 ;194
db 24,24,24,24,24,24,24,31,24,24,24,24,24,24,0,0 ;195
db 0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0 ;196
db 24,24,24,24,24,24,24,-1,24,24,24,24,24,24,0,0 ;197
db 24,24,24,24,24,31,24,31,24,24,24,24,24,24,0,0 ;198
db 54,54,54,54,54,54,54,55,54,54,54,54,54,54,0,0 ;199
db 54,54,54,54,54,55,48,63,0,0,0,0,0,0,0,0 ;200
db 0,0,0,0,0,63,48,55,54,54,54,54,54,54,0,0 ;201
db 54,54,54,54,54,-9,0,-1,0,0,0,0,0,0,0,0 ;202
db 0,0,0,0,0,-1,0,-9,54,54,54,54,54,54,0,0 ;203
db 54,54,54,54,54,55,48,55,54,54,54,54,54,54,0,0 ;204
db 0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0,0 ;205
db 54,54,54,54,54,-9,0,-9,54,54,54,54,54,54,0,0 ;206
db 24,24,24,24,24,-1,0,-1,0,0,0,0,0,0,0,0 ;207
db 54,54,54,54,54,54,54,-1,0,0,0,0,0,0,0,0 ;208
db 0,0,0,0,0,-1,0,-1,24,24,24,24,24,24,0,0 ;209
db 0,0,0,0,0,0,0,-1,54,54,54,54,54,54,0,0 ;210
db 54,54,54,54,54,54,54,63,0,0,0,0,0,0,0,0 ;211
db 24,24,24,24,24,31,24,31,0,0,0,0,0,0,0,0 ;212
db 0,0,0,0,0,31,24,31,24,24,24,24,24,24,0,0 ;213
db 0,0,0,0,0,0,0,63,54,54,54,54,54,54,0,0 ;214
db 54,54,54,54,54,54,54,-1,54,54,54,54,54,54,0,0 ;215
db 24,24,24,24,24,-1,24,-1,24,24,24,24,24,24,0,0 ;216
db 24,24,24,24,24,24,24,-8,0,0,0,0,0,0,0,0 ;217
db 0,0,0,0,0,0,0,31,24,24,24,24,24,24,0,0 ;218
db -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0 ;219
db 0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,0,0 ;220
db -16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,0,0 ;221
db 15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0 ;222
db -1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0 ;223
db 0,0,0,0,0,118,-36,-40,-40,-36,118,0,0,0,0,0 ;224
db 0,0,0,0,124,-58,-4,-58,-58,-4,-64,-64,64,0,0,0 ;225
db 0,0,-2,-58,-58,-64,-64,-64,-64,-64,-64,0,0,0,0,0 ;226
db 0,0,0,0,-2,108,108,108,108,108,108,0,0,0,0,0 ;227
db 0,0,-2,-58,96,48,24,48,96,-58,-2,0,0,0,0,0 ;228
db 0,0,0,0,0,126,-40,-40,-40,-40,112,0,0,0,0,0 ;229
db 0,0,0,0,102,102,102,102,124,96,96,-64,0,0,0,0 ;230
db 0,0,0,0,118,-36,24,24,24,24,24,0,0,0,0,0 ;231
db 0,0,126,24,60,102,102,102,60,24,126,0,0,0,0,0 ;232
db 0,0,56,108,-58,-58,-2,-58,-58,108,56,0,0,0,0,0 ;233
db 0,0,56,108,-58,-58,-58,108,108,108,-18,0,0,0,0,0 ;234
db 0,0,30,48,24,12,62,102,102,102,60,0,0,0,0,0 ;235
db 0,0,0,0,0,126,-37,-37,126,0,0,0,0,0,0,0 ;236
db 0,0,3,6,126,-37,-37,-13,126,96,-64,0,0,0,0,0 ;237
db 0,0,28,48,96,96,124,96,96,48,28,0,0,0,0,0 ;238
db 0,0,0,124,-58,-58,-58,-58,-58,-58,-58,0,0,0,0,0 ;239
db 0,0,0,-2,0,0,-2,0,0,-2,0,0,0,0,0,0 ;240
db 0,0,0,24,24,126,24,24,0,0,-1,0,0,0,0,0 ;241
db 0,0,48,24,12,6,12,24,48,0,126,0,0,0,0,0 ;242
db 0,0,12,24,48,96,48,24,12,0,126,0,0,0,0,0 ;243
db 0,0,14,27,27,24,24,24,24,24,24,24,24,24,0,0 ;244
db 24,24,24,24,24,24,24,24,-40,-40,112,0,0,0,0,0 ;245
db 0,0,0,24,24,0,126,0,24,24,0,0,0,0,0,0 ;246
db 0,0,0,0,118,-36,0,118,-36,0,0,0,0,0,0,0 ;247
db 0,56,108,108,56,0,0,0,0,0,0,0,0,0,0,0 ;248
db 0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0 ;249
db 0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0 ;250
db 0,15,12,12,12,12,12,-20,108,60,28,0,0,0,0,0 ;251
db 0,-40,108,108,108,108,108,0,0,0,0,0,0,0,0,0 ;252
db 0,112,-40,48,96,-56,-8,0,0,0,0,0,0,0,0,0 ;253
db 0,0,0,0,124,124,124,124,124,124,0,0,0,0,0,0 ;254
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;255

1
GRAB/T.BAT Normal file
View file

@ -0,0 +1 @@
sp d:\wc2gfx\objects.4 -o %1 %2 %3 %4 %5

324
GRAB/VIEWLBM.C Normal file
View file

@ -0,0 +1,324 @@
#include <bios.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <graph.h>
#include <memory.h>
#include <malloc.h>
char far *vram=(char far *)0xa0000000L;
char inname[60];
char outname[60];
unsigned char pal[768];
unsigned char linebuf[2560];
int xsz,ysz,planes,stencil,colors,mode;
main(int argc,char *argv[])
{
if(argc==1)
{
printf("usage: VIEWLBM <lbmfile>\n");
return(0);
}
strcpy(inname,argv[1]);
if(strchr(inname,'.')==NULL)
{
strcat(inname,".lbm");
}
strcpy(outname,argv[2]);
if(loadlbm(inname))
{
printf("Error loading file: %s\n",inname);
exit(1);
}
getch();
_asm mov ax,3h
_asm int 10h
}
int savelinebuf(int xl)
{
int a,b,c;
static int y=0;
if(!xl)
{
_asm mov ax,13h
_asm int 10h
outp(0x3c8,0);
for(a=0;a<768;a++) outp(0x3c9,pal[a]);
}
else
{
memcpy(vram+y*320,linebuf,320);
y++;
}
}
int eschit(void)
{
return(0);
}
/****************************************************/
/***** Deluxepaint LBM loader V1.0 **************/
/****************************************************/
FILE *f1;
int cbits[8]={1,2,4,8,16,32,64,128};
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt=NULL;
char lasttype[5];
char type[5]={"----"};
long len;
int filetype;
char lbmtype[10];
int checktype=0;
int loadlbm(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=loadlbm2();
if(errtxt!=NULL)
{
printf("%s\n",errtxt);
hfree(filebuf);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
hfree(filebuf);
return(1);
}
else if(a==1) break;
}
while(!feof(f1) && !eschit());
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int loadlbm2(void)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<256*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
savelinebuf(0);
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
//printf("Picture size %ix%ix%i\n",xsz,ysz,colors);
//printf("Loading and converting: ");
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
filetype=1; /* LBM */
while(!eschit() && y<ysz)
{
//printf("%2i%%\b\b\b",100*y/ysz);
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
//printf("%2i%%\b\b\b",100*y/ysz);
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
savelinebuf(xsz);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}

BIN
GRAB/VIEWLBM.EXE Normal file

Binary file not shown.

21
GRAB/VP Normal file
View file

@ -0,0 +1,21 @@
ao.exe : ao.c lfcp.c sfcp.c
cl /qc /AL ao.c /link /e
vp.exe : vp.c
cl /qc /AL vp.c /link /e
copy vp.exe c:\dos\prg
col.exe : col.c
cl /qc /AL col.c /link /e
glvp.exe : glvp.c vpl.c lfcp.c sfcp.c gfxsave.h
cl /qc /AL glvp.c /link /e
copy glvp.exe c:\dos\prg
gfx.exe : gfx.c
cl /qc /AL gfx.c
copy gfx.exe c:\dos\prg
# sp.exe : sp.c gfxsave.h
# cl /qc /AL sp.c /link /E

1187
GRAB/VP.C Normal file

File diff suppressed because it is too large Load diff

BIN
GRAB/VP.EXE Normal file

Binary file not shown.

515
GRAB/VPL.C Normal file
View file

@ -0,0 +1,515 @@
/****************************************************/
/***** Deluxepaint LBM loader V1.0 **************/
/****************************************************/
FILE *f1;
int cbits[8]={1,2,4,8,16,32,64,128};
unsigned char linebuf[320];
int lbmmode; /* 1=DPII, 2=DPIIe */
char *errtxt=NULL;
char lasttype[5];
char type[5]={"----"};
long len;
int xsz,ysz,planes,stencil,colors,mode;
char lbmtype[16];
int checktype=0;
#include "lfcp.c"
int loadlbm(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
printf("\nLoading and uncompressing picture (LBM): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
do
{
memcpy(lasttype,type,5);
/* get header */
do
{
type[0]=getc(f1);
}
while(type[0]==0 && !feof(f1));
type[1]=getc(f1); type[2]=getc(f1); type[4]=0;
type[3]=getc(f1); len=getc(f1)*256L*65536L;
if(firstone && memcmp(type,"FORM",4)) return(2);
firstone=0;
len+=getc(f1)*65536L; len+=getc(f1)*256L; len+=getc(f1);
/* process it */
a=loadlbm2();
if(errtxt!=NULL)
{
printf("%s\n",errtxt);
hfree(filebuf);
return(1);
}
if(a==-1)
{
printf("Not a Deluxepaint file!");
return(2);
}
if(a==2)
{
printf("OLD:<%s> NEW<%s>\n",lasttype,type);
hfree(filebuf);
return(1);
}
else if(a==1) break;
}
while(!feof(f1) && !eschit());
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int getaw(FILE *f1)
{
unsigned int a;
a=getc(f1)*256;
a+=getc(f1);
return(a);
}
int loadlbm2(void)
{ /* processes one block */
long lastpos=ftell(f1);
int a,b,c,d,e,f;
if(!strcmp(type,"CMAP"))
{
/* color map */
for(b=0;b<256*3;b++)
{
a=getc(f1)/4;
pal[b]=a;
}
}
else if(!strcmp(type,"FORM"))
{ /* skip size of file, NO pointer movement */
for(a=0;a<8;a++) lbmtype[a]=getc(f1);
lbmtype[a]=0;
/* LMDSBMHD - pakkaamaton formaatti */
if(!memcmp(lbmtype,"ILBMBMHD",8))
{
lbmmode=1;
}
else if(!memcmp(lbmtype,"PBM BMHD",8))
{
lbmmode=2;
}
else
{
errtxt="Unknown fileformat!";
return(-1);
}
getaw(f1); /* headerin lopun pituus */
getaw(f1); /* - */
xsz=getaw(f1);
ysz=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
planes=getc(f1);
stencil=getc(f1);
colors=getaw(f1);
getaw(f1); /* ? */
getaw(f1); /* ? */
getaw(f1); /* screen-size-x */
getaw(f1); /* screen-size-y */
return(0);
}
else if(!strcmp(type,"CRNG"))
{
}
else if(!strcmp(type,"DPPS"))
{
}
else if(!strcmp(type,"DPPV"))
{
}
else if(!strcmp(type,"TINY"))
{ /* pikkukuva */
}
else if(!strcmp(type,"BODY") && lbmmode==2)
{
int lp,cbit,y=0;
filetype=1; /* LBM */
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",100*y/ysz);
memset(linebuf,0,xsz);
{
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++) linebuf[lp++]=c;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]=c;
}
}
}
}
memcpy(pic+y*320,linebuf,xsz);
y++;
}
return(1);
}
else if(!strcmp(type,"BODY") && lbmmode==1)
{
int lp,cbit,y=0;
while(!eschit() && y<ysz)
{
printf("%2i%%\b\b\b",100*y/ysz);
memset(linebuf,0,xsz);
for(d=0;d<planes;d++)
{
cbit=cbits[d];
lp=0;
while(lp<xsz)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
if(a==0) c=0;
for(b=0;b<=a;b++)
{
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
linebuf[lp++]|=c&128?cbit:0;
linebuf[lp++]|=c&64?cbit:0;
linebuf[lp++]|=c&32?cbit:0;
linebuf[lp++]|=c&16?cbit:0;
linebuf[lp++]|=c&8?cbit:0;
linebuf[lp++]|=c&4?cbit:0;
linebuf[lp++]|=c&2?cbit:0;
linebuf[lp++]|=c&1?cbit:0;
}
}
}
}
if(stencil) for(lp=0;lp<xsz;)
{
a=getc(f1);
if(a>127)
{
c=getc(f1);
a=256-a;
lp+=a*8+8;
}
else
{
for(b=0;b<=a;b++)
{
c=getc(f1);
}
lp+=a*8+8;
}
}
memcpy(pic+y*320,linebuf,xsz);
y++;
}
return(1);
}
else if(checktype)
{
return(2);
}
fseek(f1,lastpos+len,SEEK_SET);
return(0);
}
/***************************************************************/
/***** Eye of the Beholder 256 color loader (CMP) V1.0 *******/
/***************************************************************/
int loadcmp(char *fname)
{
int x,y,a,b,c;
long l;
char far *filebuf;
unsigned u;
int firstone=1;
filebuf=halloc(32768L,1L);
printf("\nLoading and uncompressing picture (CMP): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
getw(f1);
getw(f1);
a=getw(f1); /* unpacked len */
getw(f1);
getw(f1);
cmpunpack(a);
fclose(f1);
}
hfree(filebuf);
if(kbhit()) return(1);
return(0);
}
int cmpunpack(unsigned int unplen)
{
int a,b,c,x=0;
unsigned int u,col,cnt;
int bufpnt=0;
while(bufpnt<unplen && !kbhit())
{
x++; if(x>64)
{
printf(".");
x=0;
}
a=getc(f1);
if(a==0xfe)
{
cnt=getw(f1);
col=getc(f1);
memset(pic+bufpnt,col,cnt);
bufpnt+=cnt;
}
else if(a==0xff)
{
cnt=getw(f1);
u=getw(f1);
for(b=0;b<cnt;b++)
{
pic[bufpnt++]=pic[u++];
}
}
else if(a>=0xc0)
{
cnt=a-0xc0+3;
u=getw(f1);
for(b=0;b<cnt;b++)
{
pic[bufpnt++]=pic[u++];
}
}
else if(a>0x80)
{
cnt=a-0x80;
fread(pic+bufpnt,cnt,1,f1);
bufpnt+=cnt;
}
else
{
cnt=(a/16)+3;
u=bufpnt-((a&15)*256+getc(f1));
for(b=0;b<cnt;b++)
{
pic[bufpnt++]=pic[u++];
}
}
}
}
/***************************************************************/
/***** Unpacked file loader (header included) *******/
/***************************************************************/
int loaduh(char *fname)
{
int x,y,hig,wid;
char far *filebuf;
filebuf=halloc(32768L,1L);
printf("\nLoading picture (UH): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
if(getw(f1)!=('U'+'H'*256)) return(2);
if(getw(f1)!=1) printf("Multiple pictures in file, ONLY FIRST LOADED!\n");
wid=getw(f1);
hig=getw(f1);
getw(f1);
getw(f1);
getw(f1);
getw(f1);
for(y=0;y<hig;y++) for(x=0;x<wid;x++)
{
pic[x+y*320]=getc(f1);
}
fclose(f1);
}
hfree(filebuf);
return(0);
}
/***************************************************************/
/***** Unpacked file loader (no header) *******/
/***************************************************************/
int loadu(char *fname)
{
int x,y,hig,wid;
char far *filebuf;
filebuf=halloc(32768L,1L);
printf("\nLoading picture (U): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
wid=320;
hig=200;
for(y=0;y<hig;y++) for(x=0;x<wid;x++)
{
pic[x+y*320]=getc(f1);
}
fclose(f1);
}
hfree(filebuf);
return(0);
}
/***************************************************************/
/***** Unpacked 4plane loader (no header) *******/
/***************************************************************/
int loadu4(char *fname)
{
int x,y,hig,wid,z;
char far *filebuf;
filebuf=halloc(32768L,1L);
printf("\nLoading picture (U4): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
wid=320;
hig=200;
for(z=0;z<4;z++) for(y=0;y<hig;y++) for(x=z;x<wid;x+=4)
{
pic[x+y*320]=getc(f1);
}
fclose(f1);
}
hfree(filebuf);
return(0);
}
/***************************************************************/
/***** GFX file loader for pic 1 (header included) *******/
/***************************************************************/
int loadgfx(char *fname)
{
int a,b,c,x,y,z,hig,wid;
char far *filebuf;
filebuf=halloc(32768L,1L);
printf("\nLoading picture (GFX): ");
if(filebuf==NULL)
{
printf("Out of memory.\n");
return(1);
}
memset(pic,255,64000);
{
f1=fopen(fname,"rb");
if(f1==NULL) return(3);
setvbuf(f1,filebuf,_IOFBF,32768);
if(getw(f1)!=('G'+'F'*256)) return(2);
if(getw(f1)!=('X'+'1'*256)) return(2);
if(getw(f1)!=('0'+0x1a*256)) return(2);
fseek(f1,8L+2*gfxsubfile,SEEK_SET);
a=getw(f1);
fseek(f1,(long)a<<4L,SEEK_SET);
if(getc(f1)!=1)
{
fseek(f1,8L+2*gfxsubfile+2,SEEK_SET);
a=getw(f1);
fseek(f1,(long)a<<4L,SEEK_SET);
if(getc(f1)!=1) return(1);
}
getc(f1);
getw(f1);
getw(f1);
hig=getw(f1);
getw(f1);
for(z=0;z<4;z++) for(y=0,x=z;y<hig;y++,x=z) while(!feof(f1))
{
a=(char)getc(f1);
if(a==0) break;
else if(a>0) x+=a*4;
else if(a&1)
{
a=(a&127)>>1;
for(c=0;c<a;c++,x+=4) pic[x+y*320]=getc(f1);
}
else
{
a=(a&127)>>1;
b=getc(f1);
for(c=0;c<a;c++,x+=4) pic[x+y*320]=b;
}
}
fclose(f1);
}
hfree(filebuf);
return(0);
}
/************************************/
/********* END OF LOADERS ***********/
/************************************/

BIN
GRAB/WC2.DEF Normal file

Binary file not shown.

16
GRAB/WC2CONV.INC Normal file
View file

@ -0,0 +1,16 @@
unsigned char wc2conv[]={0,42,119,57,186,90,152,21,26,37,118,52,181,196,130,16
,24,208,225,210,211,212,213,214,215,216,217,218,220,221,222,223
,32,33,34,35,36,37,38,40,40,41,43,44,45,46,47,0
,32,33,67,68,70,71,72,73,74,75,75,76,77,78,47,47
,128,241,242,243,244,245,167,183,184,185,186,187,188,189,190,191
,48,177,178,179,180,181,182,183,242,132,117,118,118,121,123,110
,16,161,145,212,148,149,150,151,152,152,153,154,155,156,141,158
,16,161,162,227,228,229,230,231,232,233,234,235,236,237,238,0
,0,16,176,162,163,164,165,166,167,168,169,170,234,235,236,238
,0,16,32,49,50,51,52,53,55,55,56,57,59,60,61,63
,0,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31
,0,208,162,179,181,181,199,200,201,202,203,204,204,205,206,207
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,17,97,98,99,100,101,102,103,104,105,106,106,108,108,109
,126,208,210,212,102,217,219,220,157,151,231,232,170,171,234,188
,239,132,133,117,117,120,122,123,109,47,0,0,0,0,0,24};