UH2@PSUVM.BITNET (Lee Sailer) (11/26/88)
I will cede to Leo that the recently distributed iff.library is not the ultimate word on iff, but it would do exacly what I need IF I used Manx and not Lattice 4.01. So, I am gonna try to Lattice-ify it. However, this attempt will take me into new territory. Assembler. Could someone please let me know if I am approaching it the right way? I am going to pull the assembler out of the iff.h file and then try to assemble it. That should produce a xxx.o file that I can link with the other modules in my program --- right? Will the lattice supplied asm handle that simple piece of asm source, or do I have to change some of the mnemonics, or add some magic at the beginning or end, or ??? thanks
lel@wuphys.UUCP (Lyle E. Levine) (12/05/88)
In article <62827UH2@PSUVM> UH2@PSUVM.BITNET (Lee Sailer) writes: >I will cede to Leo that the recently distributed iff.library is not >the ultimate word on iff, but it would do exacly what I need IF I used >Manx and not Lattice 4.01. So, I am gonna try to Lattice-ify it. > > Will the lattice supplied asm handle that simple piece of asm source, >or do I have to change some of the mnemonics, or add some magic at the >beginning or end, or ??? > Sorry I took so long on this one. A two week vacation can do wonders for generating a huge backlog of USENET articles! The easiest way to Lattice-ify this stuff is to replace the #asm code with some Lattice #pragma statements. The correct statements are: #pragma libcall IFFBase OpenIFF 1e 801 #pragma libcall IFFBase CloseIFF 24 901 #pragma libcall IFFBase FindChunk 2a 0902 #pragma libcall IFFBase GetBMHD 30 901 #pragma libcall IFFBase GetColorTab 36 8902 #pragma libcall IFFBase DecodePic 3c 8902 #pragma libcall IFFBase SaveBitMap 42 0A9804 #pragma libcall IFFBase SaveClip 48 43210A9808 #pragma libcall IFFBase IffError 4e 00 #pragma libcall IFFBase GetViewModes 54 901 > thanks You're very welcome. :^) P.S. Has anyone gotten FindChunk() to work? If so, how about a witto hint? P.P.S. The IFF loader is FAST!!! ========== IBM is a Division of Sirius Cybernetics Corporation "their fundamental design flaws are completely hidden by their superficial design flaws." - "So Long And Thanks For All The Fish" Lyle Levine: Paths -> ihnp4!wuphys!lel Best way: (314)889-6379 uunet!wucs!wuphys!lel
lel@wuphys.UUCP (Lyle E. Levine) (12/05/88)
In article <587@wuphys.UUCP> lel@wuphys.UUCP (Lyle E. Levine) writes: > >P.S. Has anyone gotten FindChunk() to work? If so, how about a >witto hint? > Nevermind! I just got it to work. To clear up any future confusion, the arguments are FindChunk(ifffile,chunkname). chunkname is a packed ASCII (ULONG). Thus, 'CRNG' is 0x43524e47. This is because 'C' = 0x43, 'R' = 0x52, etc... Hope this helps someone! ========== IBM is a Division of Sirius Cybernetics Corporation "their fundamental design flaws are completely hidden by their superficial design flaws." - "So Long And Thanks For All The Fish" Lyle Levine: Paths -> ihnp4!wuphys!lel Best way: (314)889-6379 uunet!wucs!wuphys!lel
mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) (12/06/88)
I'd add a "#ifndef" around those pragmas. I also turned the function declarations into prototypes: /************** F U N C T I O N D E C L A R A T I O N S ***************/ APTR OpenIFF(char *); void CloseIFF(APTR); struct Chunk *FindChunk(APTR, char *); struct BitMapHeader *GetBMHD(APTR); LONG GetColorTab(APTR, UWORD *); BOOL DecodePic(APTR, struct BitMap *); BOOL SaveBitMap(char *, struct BitMap *, UWORD *, long); BOOL SaveClip(char *, struct BitMap *, UWORD *, int, int, int, int, int); LONG IffError(void); /************** F U N C T I O N P R A G M A S ***************/ #ifndef NOPRAGMA #pragma libcall IFFBase OpenIFF 1e 801 #pragma libcall IFFBase CloseIFF 24 901 #pragma libcall IFFBase FindChunk 2a 0902 #pragma libcall IFFBase GetBMHD 30 901 #pragma libcall IFFBase GetColorTab 36 8902 #pragma libcall IFFBase DecodePic 3c 8902 #pragma libcall IFFBase SaveBitMap 42 0A9804 #pragma libcall IFFBase SaveClip 48 43210A9808 #pragma libcall IFFBase IffError 4e 00 #pragma libcall IFFBase GetViewModes 54 901 #endif Finally, for those who want it, here's the assembler interface for Lattice. Just asm it, copy the library into lib: as lib.o, and then link it with programs that need the iff.library (assuming you compiled with NOPRAGMA defined). <mike ; asm interface to iff.library csect text ; Pointer to the library, supplied by the caller xref _IFFBase xdef _OpenIFF _OpenIFF: move.l 4(sp),a0 move.l _IFFBase,a6 jmp -30(a6) xdef _CloseIFF _CloseIFF: move.l 4(sp),a1 move.l _IFFBase,a6 jmp -36(a6) xdef _FindChunk _FindChunk: move.l 4(sp),a1 move.l 8(sp),d0 move.l _IFFBase,a6 jmp -42(a6) xdef _GetBMHD _GetBMHD: move.l 4(sp),a1 move.l _IFFBase,a6 jmp -48(a6) xdef _GetColorTab _GetColorTab: move.l 4(sp),a1 move.l 8(sp),a0 move.l _IFFBase,a6 jmp -54(a6) xdef _DecodePic _DecodePic: move.l 4(sp),a1 move.l 8(sp),a0 move.l _IFFBase,a6 jmp -60(a6) xdef _SaveBitMap _SaveBitMap: move.l a2,-(sp) movem.l 8(sp),a0/a1/a2 move.l 20(sp),d0 move.l _IFFBase,a6 jsr -66(a6) move.l (sp)+,a2 rts xdef _SaveClip _SaveClip: movem.l d4/a2,-(sp) movem.l 24(sp),d0-d4 movem.l 12(sp),a0-a2 move.l _IFFBase,a6 jsr -72(a6) movem.l (sp)+,d4/a2 rts xdef _IffError _IffError: move.l _IFFBase,a6 jmp -78(a6) xdef _GetViewModes _GetViewModes: move.l 4(sp),a1 move.l _IFFBase,a6 jmp -84(a6) end -- I know the world is flat. Mike Meyer Don't try tell me that it's round. mwm@berkeley.edu I know the world stands still. ucbvax!mwm Don't try to make it turn around. mwm@ucbjade.BITNET
mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) (12/06/88)
Whoops - I made a major mistake. The prototype for SaveClipRect should be filled out with 'long', not 'int'. That way, if you compile with 16 bit ints, the compiler will still push longs for you - and not complain when you give it longs. <mike -- ICUROK2C, ICUROK2. Mike Meyer ICUROK2C, ICWR2. mwm@berkeley.edu URAQT, I WANT U2. ucbvax!mwm OO2EZ, I WANT U2. mwm@ucbjade.BITNET
lel@wuphys.UUCP (Lyle E. Levine) (12/08/88)
In article <17861@agate.BERKELEY.EDU> mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) writes: > >I'd add a "#ifndef" around those pragmas. I also turned the function >declarations into prototypes: > > >/************** F U N C T I O N D E C L A R A T I O N S ***************/ > >struct Chunk *FindChunk(APTR, char *); ^^^^^^ This is what is implied by the docs but it doesn't work this way. It should be a (APTR, ULONG). The format used is packed ASCII. Thus: cname = 0x43524e47; /* This is packed ASCII for 'CRNG' */ CRNGstart = FindChunk(ifffile,cname); /* 'C' = 0x43, 'R' = 0x52, 'N' = 0x4e, 'G' = 0x47 */ By the way, one gotcha: on the first calling, FindChunk returns a pointer to the first chunk of the requested type. On subsequent callings, it still returns a pointer to this SAME FIRST CHUNK!!! Thus, if the file has > 1 'CRNG' chunk (as a common example), FindChunk will NOT FIND ANY BUT THE FIRST!!!!!! Since OpenIFF() reads the file into memory and FindChunk() gives a pointer to the first chunk of the requested type, you can just change 'CRNG' into say 'CRNF' in memory and call FindChunk() again to get the next 'CRNG' chunk. It's dirty but it works. UGH!!!! Leo, I am eagerly awaiting your library. If it wasn't for the speed of the loader in this one, I'd go back to my own routines. At least they get the job done. > > >/************** F U N C T I O N P R A G M A S ***************/ > Glad you liked my PRAGMAS :^) *** PETS *** Programmers Extraordinaire, Technically Supportive! ========== IBM is a Division of Sirius Cybernetics Corporation "their fundamental design flaws are completely hidden by their superficial design flaws." - "So Long And Thanks For All The Fish" Lyle Levine: Paths -> ihnp4!wuphys!lel Best way: (314)889-6379 uunet!wucs!wuphys!lel
uzun@pnet01.cts.com (Roger Uzun) (03/28/90)
Does anyone know where I can find the latest version of the iff.library by Christian Weber of Zurich Switzerland? I have v 16.1 and it has a lot of bugs, I hear there is a version 18.1 out now. Please email me if you know where I can get it. Thanks -Roger UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!uzun ARPA: crash!pnet01!uzun@nosc.mil INET: uzun@pnet01.cts.com
duncant@mbunix.mitre.org (Thomson) (03/29/90)
In article <1989@crash.cts.com> uzun@pnet01.cts.com (Roger Uzun) writes: >Does anyone know where I can find the latest version of the iff.library >by Christian Weber of Zurich Switzerland? I have v 16.1 and it has a lot >of bugs, I hear there is a version 18.1 out now. >Please email me if you know where I can get it. I'd like to get a copy of this library too, and I'm sure there are a lot of net readers who would also like a latest version, so if anyone knows the answer to Roger's question, could they please post it to the newsgroup? Or, even better, post the library. Thanks, Duncan Thomson -- (Please excuse the typos and garbage caused by line noise.)