Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ncar!tank!shamash!com50!pwcs!stag!daemon From: to_stdnet@stag.UUCP Newsgroups: comp.sys.atari.st Subject: Writing a desk accessory with Sozobon C Message-ID: <698@stag.UUCP> Date: 18 Jan 89 17:16:33 GMT Sender: daemon@stag.UUCP Lines: 92 From: thelake!steve@stag.UUCP (Steve Yelvington) Here is the (working!) desk accessory startup module for the free Sozobon C compiler. This version is written to go with Don Farmer's GEMQ library of GEM bindings (the files AESQ and VDIQ) and version 2.0 of dLibs. Assemble this as dastart.o. Link the files like so: ld -o yourfile.acc dastart.o yourfile.o aesq vdiq dlibs.a I've tested this with a couple of DA skeleton programs and it seems to work just peachy. Incidentally, if you want to write a non-ACC GEM program using the GEMQ library, you'll need to extract the _crystal: function from this module, assemble it separately (call it crys.o or something) and link it before AESQ. ________cut o/__________________________________________ here o\ ************************************************************************** * dastart.s: GEM desk accessory startup code * * for Sozobon C and dlibs v.2.0 * * Public domain 1989 -- Steve Yelvington (steve@thelake.UUCP) * * thanks to kbad, ian, cjp, dal & jls * * Assemble this as dastart.o and use instead of dstart.o * ************************************************************************** .bss * first, we set up a stack .even stackbottom: .ds.l 1024 initstack: .ds.l 1 saveret: * for gemdos etc. bindings; delete if not needed .ds.l 1 .text begin_acc: * first code executed is here move.l #initstack,sp jsr _main * jump to main() of desk accessory clr.w (sp) trap #1 * Pterm0. I don't think you actually get this far. .end ************************************ * Bindings for gemdos, bios, xbios * * These may be moved into dlibs in * * a later version * ************************************ .globl _gemdos _gemdos: move.l (sp)+,saveret trap #1 move.l saveret,-(sp) rts .globl _bios _bios: move.l (sp)+,saveret trap #13 move.l saveret,-(sp) rts .globl _xbios _xbios: move.l (sp)+,saveret trap #14 move.l saveret,-(sp) rts ********************************************* * crystal() function not in dlibs 2.0 * * but needed for Don Farmer's GEMQ bindings * * You don't need this for Ian's GEMFAST * ********************************************* .globl _crystal _crystal: move.l 4(a7), d1 move.w #200,d0 trap #2 rts * Watch that return address! Reply to: * stag!thelake!steve@bungia.mn.org (UUCP) * crash!pnet51!steve@trout.nosc.mil (ARPA) * A member of STdNET/The ST Developers' Network