Path: utzoo!attcan!uunet!wuarchive!rice!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!hslrswi!pogo!jean From: jean@pogo.hasler Newsgroups: comp.sys.amiga Subject: Re: DumpToIff Insight Keywords: DKBTrace Message-ID: <1548@hslrswi.UUCP> Date: 18 Sep 90 09:12:45 GMT References: <1990Sep16.175637.16978@clmqt.marquette.Mi.US> Sender: news@hslrswi.UUCP Reply-To: jean@pogo.UUCP () Organization: Ascom Hasler AG, CH-3000 Berne 14, Switzerland Lines: 91 In article <1990Sep16.175637.16978@clmqt.marquette.Mi.US> kenb@clmqt.marquette.Mi.US (Ken Baynard) writes: > >DumpToIff finally crashed after on me after several successful >.................. >............ It crashed with stacks of >300K and 500K and after that I figured it was'nt a stack problem. >........... I looked myself in the source code of DumpToIFF and there many printf("{error type}") followed by exit(). They often cause crashes probably because the Amiga functionalities are not cleaned properly before exiting (sometimes we are in display mode). The use of stderr could be a better idea. Another improvement (for 500 users especially) would be to have a mode without display. DumpToIFF seems now to work on my A500 1Mb but without workbench loaded and a stack of 20K. About DKBtrace I could now compiled it on a SUN. However it is still slow. Currently I am using an AT03 overnight. I will also try it on an IBM RT which is currently less loaded than our SUNs. I could manage to write a program to create a 'dis' file which is the output of DKB and the input of DumpToIFF. By reading the attached code you can understand the format of the file. Another way is to dump (od -b) the output file. I have started to play a little bit with the RGB colors. /* program to create a *.dis file */ #include #include int w, l; /* horizontal and vertical size */ char *mp; /* memory address of file */ main(argc,argv) int argc; char *argv[]; { long size, index; FILE *str; if (argc != 3) { printf("2 parameters required\n"); exit(-1); } w = atoi(argv[1]); l = atoi(argv[2]); if ( (w<1) || (l<1) ) { printf("'w' or 'l' alpha or smaller than 1 \n"); exit(-1); } size = 4 + 3*(w * l) + 2*l; printf("Size is %ld\n",size); if ((mp = malloc(size)) == NULL) { printf("Memory allocation problems\n"); exit(-1); } if ( (str = fopen("try.dis","w+")) == NULL) { printf("Open error\n"); exit(-1); } setgen(); /* set basic values in the file */ fwrite(mp, size, 1, str); } /* write colors at pixel x,y */ writec(x,y,colr,colg,colb) int x; /* horiz */ int y; /* verti */ unsigned colr; /* RGB Red */ unsigned colg; /* RGB Green */ unsigned colb; /* RGB Blue */ { char *addr; addr = mp + 4 + 2*y + 3*(w*(y-1) + x) - 3; *addr++ = colr; *addr++ = colg; *addr = colb; } setgen() /* set basic various para in dis file */ { char *addr; /* address */ unsigned char byt0; int byt1, i, j; addr = mp; /* set 4 fisrt bytes */ byt0 = w >> 8; /* 2nd byte w/256 */ *addr++ = w - (byt0 << 8); /* rest: w - (w/256)*256 */ *addr++ = byt0; byt0 = l >> 8; /* 2nd byte h/256 */ *addr++ = l - (byt0 << 8); /* rest: l - (h/256)*256 */ *addr++ = byt0; i = 3*w; /* 3 RGB bytes */ byt1 = 0; byt0 = 0; for (j=0; j