Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!actrix!templar!jbickers From: jbickers@templar.actrix.gen.nz (John Bickers) Newsgroups: comp.sys.amiga.programmer Subject: Re: How are some programs SO DAMN SMALL! Message-ID: <10645.tnews@templar.actrix.gen.nz> Date: 23 Jan 91 02:07:47 GMT References: <1991Jan20.210328.18087@hoss.unl.edu> <10571.tnews@templar.actrix.gen.nz> <1991Jan22.095620.10209@csc.canterbury.ac.nz> Organization: TAP, NZAmigaUG. Lines: 36 Quoted from <1991Jan22.095620.10209@csc.canterbury.ac.nz> by cctr120@csc.canterbury.ac.nz (Brendon Wyber, C.S.C.): > In article <10571.tnews@templar.actrix.gen.nz>, jbickers@templar.actrix.gen.nz (John Bickers) writes: > > open whatever libraries you want (don't need Exec, but you may need > > AmigaDOS), etc, and link without c.o. > Unfortunately OpenLibrary is an Exec Function thus you do need it. It must be > in initialised to the value of ExecLibrary Pointer (which I believe is kept in > memory location 4). Does any one have a working example of this? Lattice is smart enough to know that it can get ExecBase straight out of $00000004. No explicit ExecBase variable is required. The following is the OMDed result of one of these small Hello World programs... _foo 0000-00 _DOSBase 0000-01 SECTION 00 "small.c" 00000054 BYTES | 0000 48E7 3000 MOVEM.L D2-D3,-(A7) | 0004 43FA 0034 LEA 0034(PC),A1 | 0008 7000 MOVEQ #00,D0 | 000A 2C78 0004 MOVEA.L 0004,A6 | 000E 4EAE FDD8 JSR FDD8(A6) ... The line at 000A is loading ExecBase into A6, and the next line is calling the OpenLibrary routine. Presumably the #pragma syscall (as opposed to #pragma libcall) in the file is what does this trick. > Brendon Wyber Computer Services Centre, -- *** John Bickers, TAP, NZAmigaUG. jbickers@templar.actrix.gen.nz *** *** "Patterns multiplying, re-direct our view" - Devo. ***