Metropoli BBS
VIEWER: emuinit.s MODE: TEXT (ASCII)
/*
** If this is a standalone build, the starting EIP must point to _emu387
** and go32 will install the interrupt vector itself.
*/
	.data

	.comm	_eax,4
	.comm	_ebx,4
	.comm	_ecx,4
	.comm	_edx,4
	.comm	_esi,4
	.comm	_edi,4
	.comm	_ebp,4
	.comm	_esp,4
	.comm	_eip,4

	.text

	.globl	_emu387
_emu387:
	movl	%eax,_eax
	movl	%ebx,_ebx
	movl	%ecx,_ecx
	movl	%edx,_edx
	movl	%esi,_esi
	movl	%edi,_edi
	movl	%ebp,_ebp

	movl	%esp,_esp
	add	$12,_esp
	pushl	%ebp
	movl	%esp,%ebp

	movl	4(%ebp),%eax
	movl	%eax,_eip
	call	_emu_entry__Fv
	movl	_eip,%eax
	movl	%eax,4(%ebp)
	movl	_eax,%eax
	movl	_ebx,%ebx
	movl	_ecx,%ecx
	movl	_edx,%edx
	movl	_esi,%esi
	movl	_edi,%edi
	popl	%ebp
	iret

	.globl	_emu_install__Fv
_emu_install__Fv:
	movw	$16,%ax
	movw	%ax,%gs
	movl	$_emu387,%ecx
	movl	$56,%eax	/* vector 7 * 8 bpv */
	movw	%cx,%gs:(%eax)
	movw	$64,%gs:2(%eax)	/* selector 8 == 32-bit code */
	movw	$0x8f00,%gs:4(%eax)
	rorl	$16,%ecx
	movw	%cx,%gs:6(%eax)
	movw	%ds,%ax
	movw	%ax,%gs
	ret
[ RETURN TO DIRECTORY ]