*-----------------------------------------------------------------------+
*	.begin.a	Startup module for Sozobon-C.			|
*			Created 13May89 by Jeff Lydiatt.		|
*-----------------------------------------------------------------------+
*
	SECTION CODE,CODE
	XDEF	__exit
	XDEF	_SysBase
	XDEF	_DOSBase
	XDEF	_errno
	XDEF	__argc
	XDEF	__argv
	XREF	__main


start:
	move.l	a7,stackPtr		; so I can restore the environment on exit.
	movem.l a0,-(a7)		; push CLI command address on stack.
	movem.l d0,-(a7)		; push CLI command Length on stack.
	jsr	__main			; call the main procedure.
*
* void _exit(code)
*   long code;
*
* Terminate process with a return value of <code>
*
__exit:
	movem.l 4(a7),d0		; get the return code.
	move.l stackPtr,a7		; restore the stack pointer.
	rts				; and return to caller
*
* initialized data space
*
	DATA DATA
	EVEN 0,4
stackPtr:			;* Stack ptr contents at entry.
	DC.l	0
_SysBase:			;* Amiga specific stuff. 
	DC.l	4
_DOSBase:			;* (ditto)
	DC.l	0
_errno:				;* system error number - (short int model
	DC.l	0		;*                        only uses 2 bytes)
__argc:				;* number of command line args.
	DC.l	0
__argv:				;* pointer to command line arg list.
	DC.l	0
	END
