[comp.sys.atari.st] Writing a desk accessory with Sozobon C

to_stdnet@stag.UUCP (01/19/89)

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 <other modules?> 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 

Fiacha of Glencar@hjuxa.UUCP (Fiacha of Glencar) (01/21/89)

From article <698@stag.UUCP>, by to_stdnet@stag.UUCP:
> 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.
>
I'm not trying to run you down but why is this necessary? I thought that
the difference between a .PRG and a .ACC was that the .ACC should not
exit. Besides, this is wonderful, if you happen to have AESQ and VDIQ.
This is the first that I have heard of either of them and I would like to
know more.

Are they readily available and if so, where do I find them?

Do they come with source?

Do they implement all of the VDI and AES functions or only some arbitrary
subset like the gem.c that went out with MJC?

> 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.
What is this function for? Who or what needs it?
-- 
Nigel R Haslock		     | If you have to be warped to weave, __-------___
Manalapan NJ 07726	     | what do you have to be to forge?   |___ __ ___/
nrh%hjuxa.uucp@decuac.dec.com|					      |  |
or ...!rutgers!hjuxa!nrh     | Hotter! Make the sparks fly.	     /____\