Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!cornell!batcomputer!hsgj From: hsgj@batcomputer.tn.cornell.edu (Dan Green) Newsgroups: comp.sys.amiga Subject: Re: Amiga good for hacking?? Message-ID: <370@batcomputer.tn.cornell.edu> Date: Mon, 9-Mar-87 00:29:05 EST Article-I.D.: batcompu.370 Posted: Mon Mar 9 00:29:05 1987 Date-Received: Tue, 10-Mar-87 19:14:23 EST References: <2719@well.UUCP> <2705@jade.BERKELEY.EDU> Reply-To: hsgj@batcomputer.UUCP (Dan Green) Distribution: world Organization: Theory Center, Cornell University, Ithaca NY Lines: 47 Summary: Getting LATTICE exe's smaller NOTE: This note is *not* meant to start compiler arguments. Lattice is always flamed for producing large code. For instance, a file compiled with Manx might be 10Kbytes, whereas the executable from Lattice might be 25K. Those of us who have Lattice can get around this shortcoming by simply not including the Lattice lc.lib "library", and linking with AStartup.obj instead of Lstartup.obj. What you lose is stdio. In Intuition or Graphics/Sound oriented applications this is no loss at all. If you need to read files, you can use AmigaDos directly instead of fopen(), etc. Losing the string routines (strcpy,strlen, etc) is a shame, but these are easy to write. What I did was spend an hour writing those stdio routines that I needed, and just linked that file along with my application. The real bugger is mult and divides. Lattice *stupidly* handles these by function calls, (eg CXM33) which are in lc.lib. The amiga.lib has IMulU() and IDivU() to multiply and divide 16-bit USHORTS, but this means you have to explicity convert. For example: x = a * b; ==> x = IMulU( (USHORT)a, (USHORT)b ); BENEFITS: Doing this extra work results in much smaller code. A heavily Intuitioned application of mine went from 26K to 14K when these techniques were applied. If you think about it, aside from the string ops not much of the stdio lib is frequently used, so there is not really that much work to do (Again remember that all the file i/o stuff is replicated in AmigaDOS calls, such as Open, Seek, etc). MAJOR DRAWBACKS: Bye, bye portability and maintainence!! It is very difficult to keep translating the stupid mults/divs, and if AmigaDOS is ever replaced, your application is dead, whereas if you relied on stdio all you'd have to do is recompile. *** FLAME ***: Why does so much of lc.lib get included, even if it is not used? If this was fixed (by BLINK (the official linker, these days) or Lattice) all would be well. CONCLUSION: If you are stuck with Lattice (it is, after all, blessed by CBM) then if you take some time you can shrink code size down a lot for applications that are very Amiga specific by getting rid of lc.lib. -- Dan Green -- ARPA: hsgj%vax2.ccs.cornell.edu@cu-arpa.cs.cornell.edu UUCP: ihnp4!cornell!batcomputer!hsgj BITNET: hsgj@cornella