/* --- Copyright University of Sussex 1994. All rights reserved. ----------
 * File:		S.pcwnt/src/amain.s
 * Purpose:		Poplog entry point for 80x86 (Microsoft assembler)
 * Author:		Robert John Duncan, Apr 15 1994
 * Related Files:	S.pcunix/src/amain.s
 */

/*************************************************************************
		THIS FILE WAS GENERATED AUTOMATICALLY FROM
		  /rsuna/pop/master/S.pcunix/src/amain.s
		     ON Fri Apr 15 10:37:34 BST 1994
	  AND SUBSEQUENTLY EDITED ON Fri Apr 15 11:55:22 BST 1994
*************************************************************************/

#_<

#_INCLUDE 'declare.ph'

lconstant macro (
	USP		= "ebx",
	SAVED_USP	= [I_LAB(Sys$-Extern$- _saved_usp)],
);

>_#

	.erre	@Version ge 611
	option	casemap:none
	.386
	.model	flat


/************************* wrapping structures ************************/

	.code
	dword	L$text_end-L$text_start, C_LAB(Sys$-objmod_pad_key)
L$text_start:
	.data
	assume	cs:nothing
	dword	L$data_end-L$data_start, C_LAB(Sys$-objmod_pad_key)
L$data_start:

/**********************************************************************/


	.code

;;; pop_main:
;;;     Entry point to Poplog, called from main or WinMain depending on
;;;     the application type

;;; Prototype:
;;;	int pop_main(void)

DEF_C_LAB(Sys$- _entry_point)

pop_main proc 	c public uses esi edi

	;;; Clear __pop_in_user_extern

	mov	dword ptr EXTERN_NAME(__pop_in_user_extern), 0

	;;; Initialise the floating-point unit

	call	fpu_init

	;;; Set up a temporary user stack pointer

	mov	USP, dword ptr SAVED_USP

	;;; Start the system

	call	XC_LAB(setpop)

	;;; Return 0

	mov	eax, 0
	ret

pop_main endp


/***************** end labels for wrapping structures *****************/

	.code
L$text_end:
	.data
	assume	cs:nothing
L$data_end:

/**********************************************************************/

@CurSeg	ends
	extern	C_LAB(Sys$-objmod_pad_key):near
	extern	EXTERN_NAME(__pop_in_user_extern):near
	extern	SAVED_USP:near
	extern	XC_LAB(setpop):near
	extern	fpu_init:near
	end
