Path: utzoo!utgpu!cs.utexas.edu!sdd.hp.com!decwrl!pa.dec.com!bacchus!mwm From: mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) Newsgroups: alt.sources.amiga Subject: Re: OS friendly assembly source examples Message-ID: Date: 6 May 91 21:31:12 GMT References: <1991Apr30.213936.22878@ux1.cso.uiuc.edu> Sender: news@pa.dec.com (News) Organization: Missionaria Phonibalonica Lines: 38 In-Reply-To: mykes@amiga0.SF-Bay.ORG's message of 2 May 91 22:54:02 GMT In article mykes@amiga0.SF-Bay.ORG (Mike Schwartz) writes: The size argument is based upon using printf() and not Write(). The program Loren posted is a good example of how to make a small 'C' program! To be fair, you should use printf() in your asm program, as well. But that's not the point. Please note that I made zero attempts at optimizing for size or speed while Loren made every attempt. Actually, Loren didn't make very much of an attempt to optimize his code. What he did was learn how to run a C program without benefit of the standard C startup routines. This isn't optimization, it's education. SAS C's startup code does a lot of things for you - deals with WB and CLI startups correctly, provides an ANSI environment, and other such things that make your program more correct and robust. You can also get backgrounded startups, resident code, guru trapping and stack size guarantees through that code. I've looked into producing stripped-down vesions of this code, and it just isn't worth it. By choosing the correct link library, the "deadwood" code usually winds up at less than 1% of the application. For most programs, it's not worth doing away with. For a few programs, it is. And those are few and far enough between that most people haven't learned how to do so. The bottom line is that you didn't show how to get small code without trying; you showed how to get small code without using any of the C support code. That's no harder in C than in assembler, just not the usual mode.