	SECTION _TEXT CLASS=CODE USE32
	SECTION _DATA CLASS=DATA USE32
	SECTION _BSS  CLASS=BSS USE32
	SECTION _CONST  CLASS=CONST USE32
	SECTION _STRING  CLASS=STRING USE32
	SECTION cstartup CLASS=INITDATA USE32
	SECTION crundown CLASS=EXITDATA USE32
	SECTION cppinit  CLASS=CPPINIT USE32
	SECTION cppexit  CLASS=CPPEXIT USE32
	GROUP DGROUP _DATA _BSS _CONST _STRING

SECTION _TEXT
[GLOBAL	___clearxcept]
;
; Line 23:	{
;
___clearxcept:
;
; Line 24:		  asm push eax
;
	PUSH	EAX
;
; Line 25:			asm push ebx
;
	PUSH	EBX
;
; Line 26:			asm mov	ax,cs:[pmodess]
;
	MOV	AX,WORD [CS:_pmodess]
;
; Line 27:	    asm mov	bx,ss
;
	MOV	BX,SS
;
; Line 28:	 		asm cmp	ax,bx
;
	CMP	AX,BX
;
; Line 29:			asm jnz	windowsxcept
;
	JNZ	NEAR	L_1
;
; Line 30:			asm pop ebx
;
	POP	EBX
;
; Line 31:			asm pop eax
;
	POP	EAX
;
; Line 32:			return;
;
	JMP	L_2
L_1:
;
; Line 34:			asm push ds
;
	PUSH	DS
;
; Line 35:			asm mov ds,cs:[pmodeds]
;
	MOV	DS,WORD [CS:_pmodeds]
;
; Line 36:			asm mov [winxcept],1
;
	MOV	DWORD [_winxcept],01H
;
; Line 37:			asm mov ebx,[esp + 16 + 12 + 12]
;
	MOV	EBX,DWORD [ESP+028H]
;
; Line 38:			asm sub ebx,12;
;
	SUB	EBX,DWORD 0CH
;
; Line 39:			asm mov eax,[esp + 16 + 12+8]
;
	MOV	EAX,DWORD [ESP+024H]
;
; Line 40:			asm mov [ebx + 8],eax
;
	MOV	DWORD [EBX+08H],EAX
;
; Line 41:			asm mov eax,[esp + 16 + 12+4]
;
	MOV	EAX,DWORD [ESP+020H]
;
; Line 42:			asm mov [ebx +4],eax
;
	MOV	DWORD [EBX+04H],EAX
;
; Line 43:			asm mov eax,[esp + 12]
;
	MOV	EAX,DWORD [ESP+0CH]
;
; Line 44:			asm xchg eax,[esp + 16 + 12]
;
	XCHG	EAX,DWORD [ESP+01CH]
;
; Line 45:			asm mov [ebx],eax
;
	MOV	DWORD [EBX],EAX
;
; Line 46:			asm sub ebx,4
;
	SUB	EBX,DWORD 04H
;
; Line 47:			asm mov eax,[esp + 16 + 8]
;
	MOV	EAX,DWORD [ESP+018H]
;
; Line 48:			asm mov [ebx],eax
;
	MOV	DWORD [EBX],EAX
;
; Line 49:			asm mov [esp + 16 + 12 + 12],ebx
;
	MOV	DWORD [ESP+028H],EBX
;
; Line 50:			asm and word ptr [esp + 16 + 12 + 8],0xfeff
;
	AND	WORD [ESP+024H],WORD 0FEFFH
;
; Line 51:			asm pop ds
;
	POP	DS
;
; Line 52:			asm pop ebx
;
	POP	EBX
;
; Line 53:			asm pop eax
;
	POP	EAX
;
; Line 54:			asm add esp,4
;
	ADD	ESP,DWORD 04H
;
; Line 55:			asm retf
;
	RETF
;
; Line 56:	}
;
L_2:
	RET
;
; Line 60:	{
;
_raise12:
;
; Line 61:	  asm mov ax,ss
;
	MOV	AX,SS
;
; Line 62:		asm mov bx,ds
;
	MOV	BX,DS
;
; Line 63:		asm cmp ax,bx
;
	CMP	AX,BX
;
; Line 64:		asm jz  restack
;
	JZ	NEAR	L_3
;
; Line 65:		asm mov ebx,[_stacktop]
;
	MOV	EBX,DWORD [__stacktop]
;
; Line 66:		asm mov dword ptr [esp + 12 + 12],ebx
;
	MOV	DWORD [ESP+018H],EBX
;
; Line 67:			__clearxcept();
;
	CALL	___clearxcept
;
; Line 68:		asm jmp join
;
	JMP	L_4
L_3:
;
; Line 70:		asm mov esp,[_stacktop]
;
	MOV	ESP,DWORD [__stacktop]
;
; Line 71:		asm sti
;
	STI
L_4:
;
; Line 73:		printf("Stack overflow, use larger stack");
;
	PUSH	DWORD L_5
	CALL	_printf
	POP	ECX
;
; Line 74:		exit(1);
;
	PUSH	BYTE 01H
	CALL	_exit
	POP	ECX
;
; Line 75:	}
;
	RET
;
; Line 78:	{
;
_raise3:
;
; Line 79:			__clearxcept();
;
	CALL	___clearxcept
;
; Line 80:			if (winxcept)
;
	CMP	DWORD [_winxcept],BYTE 00H
	JE	SHORT	L_6
;
; Line 81:				asm pop eax;
;
	POP	EAX
L_6:
;
; Line 82:			asm iretd;
;
	IRETD
;
; Line 83:	}
;
	RET
;
; Line 87:	{
;
_raise13:
;
; Line 88:			__clearxcept();
;
	CALL	___clearxcept
;
; Line 89:			asm mov ss:[dssave],ds
;
	MOV	WORD [SS:_dssave],DS
;
; Line 90:			asm mov ss:[essave],es
;
	MOV	WORD [SS:_essave],ES
;
; Line 91:			asm mov	ds,cs:[pmodeds]
;
	MOV	DS,WORD [CS:_pmodeds]
;
; Line 92:			asm mov	es,cs:[pmodeds]
;
	MOV	ES,WORD [CS:_pmodeds]
;
; Line 93:			asm mov [axsave],eax
;
	MOV	DWORD [_axsave],EAX
;
; Line 94:			asm mov [bxsave],ebx
;
	MOV	DWORD [_bxsave],EBX
;
; Line 95:			asm mov [cxsave],ecx
;
	MOV	DWORD [_cxsave],ECX
;
; Line 96:			asm mov [dxsave],edx
;
	MOV	DWORD [_dxsave],EDX
;
; Line 97:			asm mov [sisave],esi
;
	MOV	DWORD [_sisave],ESI
;
; Line 98:			asm mov [disave],edi
;
	MOV	DWORD [_disave],EDI
;
; Line 99:			asm mov [bpsave],ebp
;
	MOV	DWORD [_bpsave],EBP
;
; Line 100:			asm mov [spsave],esp
;
	MOV	DWORD [_spsave],ESP
;
; Line 101:			asm mov [sssave],ss
;
	MOV	WORD [_sssave],SS
;
; Line 102:			asm mov [fssave],fs
;
	MOV	WORD [_fssave],FS
;
; Line 103:			asm mov [gssave],gs
;
	MOV	WORD [_gssave],GS
;
; Line 104:			asm pop eax
;
	POP	EAX
;
; Line 105:			asm pop eax
;
	POP	EAX
;
; Line 106:			asm mov [ipsave],eax
;
	MOV	DWORD [_ipsave],EAX
;
; Line 107:			asm pop eax
;
	POP	EAX
;
; Line 108:			asm mov [cssave],ax
;
	MOV	WORD [_cssave],AX
;
; Line 109:			asm pop eax
;
	POP	EAX
;
; Line 110:			asm mov [flagssave],eax
;
	MOV	DWORD [_flagssave],EAX
;
; Line 111:			asm mov esp,[_stacktop]
;
	MOV	ESP,DWORD [__stacktop]
;
; Line 112:			asm sti;
;
	STI
;
; Line 113:			raise(11               );
;
	PUSH	BYTE 0BH
	CALL	_raise
	POP	ECX
;
; Line 114:			fprintf((_pstreams[2]),"\nGeneral protection fault\n\n");
;
	PUSH	DWORD L_8
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 08H
;
; Line 115:			fprintf((_pstreams[2]),"CS:EIP %04X:%08X\n",cssave,ipsave);
;
	PUSH	DWORD [_ipsave]
	MOVSX	EAX,WORD [_cssave]
	PUSH	EAX
	PUSH	DWORD L_9
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 010H
;
; Line 116:			fprintf((_pstreams[2]),"SS:ESP %04X:%08X\n",sssave,spsave+12);
;
	MOV	EAX,DWORD [_spsave]
	ADD	EAX,BYTE 0CH
	PUSH	EAX
	MOVSX	EAX,WORD [_sssave]
	PUSH	EAX
	PUSH	DWORD L_10
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 010H
;
; Line 117:			fprintf((_pstreams[2]),"EAX: %08X  EBX: %08X  ECX: %08X  EDX: %08X  flags: %08X\n",
;
	PUSH	DWORD [_flagssave]
	PUSH	DWORD [_dxsave]
	PUSH	DWORD [_cxsave]
	PUSH	DWORD [_bxsave]
	PUSH	DWORD [_axsave]
	PUSH	DWORD L_11
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 01CH
;
; Line 119:			fprintf((_pstreams[2]),"EBP: %08X  ESI: %08X  EDI: %08X\n",bpsave,sisave,disave);
;
	PUSH	DWORD [_disave]
	PUSH	DWORD [_sisave]
	PUSH	DWORD [_bpsave]
	PUSH	DWORD L_12
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 014H
;
; Line 120:			fprintf((_pstreams[2])," DS:     %04X   ES:     %04X   FS:     %04X   GS:     %04X\n",
;
	MOVSX	EAX,WORD [_gssave]
	PUSH	EAX
	MOVSX	EAX,WORD [_fssave]
	PUSH	EAX
	MOVSX	EAX,WORD [_essave]
	PUSH	EAX
	MOVSX	EAX,WORD [_dssave]
	PUSH	EAX
	PUSH	DWORD L_13
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 018H
;
; Line 122:			exit(1);
;
	PUSH	BYTE 01H
	CALL	_exit
	POP	ECX
;
; Line 123:	}
;
	RET
;
; Line 126:	{
;
_div0:
;
; Line 127:			__clearxcept();
;
	CALL	___clearxcept
;
; Line 128:			asm mov	ds,cs:[pmodeds]
;
	MOV	DS,WORD [CS:_pmodeds]
;
; Line 129:			asm mov	es,cs:[pmodeds]
;
	MOV	ES,WORD [CS:_pmodeds]
;
; Line 130:			asm mov esp,[_stacktop]
;
	MOV	ESP,DWORD [__stacktop]
;
; Line 131:			asm sti;
;
	STI
;
; Line 132:			fprintf((_pstreams[2]),"\nDivide by 0");
;
	PUSH	DWORD L_14
	PUSH	DWORD [08H+__pstreams]
	CALL	_fprintf
	ADD	ESP,BYTE 08H
;
; Line 133:			exit(1);
;
	PUSH	BYTE 01H
	CALL	_exit
	POP	ECX
;
; Line 134:	}
;
	RET
[GLOBAL	_raisecb]
;
; Line 143:	{
;
_raisecb:
;
; Line 144:		_breakflag = 0;
;
	MOV	DWORD [__breakflag],00H
;
; Line 145:		if (raise(21               ))
;
	PUSH	BYTE 015H
	CALL	_raise
	POP	ECX
	TEST	EAX,EAX
	JE	SHORT	L_15
;
; Line 146:			exit(1);
;
	PUSH	BYTE 01H
	CALL	_exit
	POP	ECX
L_15:
;
; Line 147:	}
;
	RET
;
; Line 149:	{
;
_intcb:
;
; Line 150:		asm push ds
;
	PUSH	DS
;
; Line 151:	  asm mov ds,cs:[pmodeds]
;
	MOV	DS,WORD [CS:_pmodeds]
;
; Line 152:		asm mov [_breakflag],1
;
	MOV	DWORD [__breakflag],01H
;
; Line 153:	  asm pop ds
;
	POP	DS
;
; Line 154:	  asm iretd
;
	IRETD
;
; Line 155:	}
;
	RET
[GLOBAL	___setxcept]
;
; Line 158:	{
;
___setxcept:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
	PUSH	EBX
	PUSH	ESI
	MOV	EBX,DWORD [EBP+08H]
	MOV	ESI,DWORD [EBP+0CH]
;
; Line 160:		asm mov [sel],cs
;
	MOV	WORD [EBP+0FFFFFFFEH],CS
;
; Line 162:		if (dpmi_set_protected_except(num,sel,(ULONG) address))
;
	PUSH	ESI
	MOVZX	EAX,WORD [EBP+0FFFFFFFEH]
	PUSH	EAX
	PUSH	EBX
	CALL	_dpmi_set_protected_except
	ADD	ESP,BYTE 0CH
	TEST	EAX,EAX
	JE	SHORT	L_17
;
; Line 163:			dpmi_set_protected_interrupt(num,sel,(ULONG) address);
;
	PUSH	ESI
	MOVZX	EAX,WORD [EBP+0FFFFFFFEH]
	PUSH	EAX
	PUSH	EBX
	CALL	_dpmi_set_protected_interrupt
	ADD	ESP,BYTE 0CH
L_17:
;
; Line 164:	}
;
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
;
; Line 166:	{
;
_llsignal:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
;
; Line 168:			asm mov	[pmodeds],ds
;
	MOV	WORD [_pmodeds],DS
;
; Line 169:			asm mov [pmodecs],cs
;
	MOV	WORD [EBP+0FFFFFFFEH],CS
;
; Line 170:			asm mov [pmodess],ss
;
	MOV	WORD [_pmodess],SS
;
; Line 172:			__setxcept(3,raise3);
;
	PUSH	DWORD _raise3
	PUSH	BYTE 03H
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 173:			__setxcept(12,raise12);
;
	PUSH	DWORD _raise12
	PUSH	BYTE 0CH
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 174:			__setxcept(13,raise13);
;
	PUSH	DWORD _raise13
	PUSH	BYTE 0DH
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 175:			__setxcept(14,raise13);
;
	PUSH	DWORD _raise13
	PUSH	BYTE 0EH
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 176:			__setxcept(6,raise13);
;
	PUSH	DWORD _raise13
	PUSH	BYTE 06H
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 178:			__setxcept(0,div0);
;
	PUSH	DWORD _div0
	PUSH	BYTE 00H
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 179:			__setxcept(4,div0);
;
	PUSH	DWORD _div0
	PUSH	BYTE 04H
	CALL	___setxcept
	ADD	ESP,BYTE 08H
;
; Line 181:			dpmi_set_protected_interrupt(0x23,pmodecs,(ULONG)intcb);
;
	PUSH	DWORD _intcb
	MOVZX	EAX,WORD [EBP+0FFFFFFFEH]
	PUSH	EAX
	PUSH	BYTE 023H
	CALL	_dpmi_set_protected_interrupt
	ADD	ESP,BYTE 0CH
;
; Line 182:	}
;
	MOV	ESP,EBP
	POP	EBP
	RET

SECTION _STRING
L_14:
	DB	0AH,044H,069H,076H,069H,064H,065H,020H,062H,079H,020H,030H
	DB	00H
L_13:
	DB	020H,044H,053H,03AH,020H,020H,020H,020H,020H,025H,030H,034H
	DB	058H,020H,020H,020H,045H,053H,03AH,020H,020H,020H,020H,020H
	DB	025H,030H,034H,058H,020H,020H,020H,046H,053H,03AH,020H,020H
	DB	020H,020H,020H,025H,030H,034H,058H,020H,020H,020H,047H,053H
	DB	03AH,020H,020H,020H,020H,020H,025H,030H,034H,058H,0AH,00H
L_12:
	DB	045H,042H,050H,03AH,020H,025H,030H,038H,058H,020H,020H,045H
	DB	053H,049H,03AH,020H,025H,030H,038H,058H,020H,020H,045H,044H
	DB	049H,03AH,020H,025H,030H,038H,058H,0AH,00H
L_11:
	DB	045H,041H,058H,03AH,020H,025H,030H,038H,058H,020H,020H,045H
	DB	042H,058H,03AH,020H,025H,030H,038H,058H,020H,020H,045H,043H
	DB	058H,03AH,020H,025H,030H,038H,058H,020H,020H,045H,044H,058H
	DB	03AH,020H,025H,030H,038H,058H,020H,020H,066H,06CH,061H,067H
	DB	073H,03AH,020H,025H,030H,038H,058H,0AH,00H
L_10:
	DB	053H,053H,03AH,045H,053H,050H,020H,025H,030H,034H,058H,03AH
	DB	025H,030H,038H,058H,0AH,00H
L_9:
	DB	043H,053H,03AH,045H,049H,050H,020H,025H,030H,034H,058H,03AH
	DB	025H,030H,038H,058H,0AH,00H
L_8:
	DB	0AH,047H,065H,06EH,065H,072H,061H,06CH,020H,070H,072H,06FH
	DB	074H,065H,063H,074H,069H,06FH,06EH,020H,066H,061H,075H,06CH
	DB	074H,0AH,0AH,00H
L_5:
	DB	053H,074H,061H,063H,06BH,020H,06FH,076H,065H,072H,066H,06CH
	DB	06FH,077H,02CH,020H,075H,073H,065H,020H,06CH,061H,072H,067H
	DB	065H,072H,020H,073H,074H,061H,063H,06BH,00H
SECTION _DATA
[GLOBAL	_winxcept]

_winxcept	DD	00H
SECTION _BSS

_pmodeds	RESB	02H

_pmodess	RESB	02H

_oldcbrseg	RESB	02H

_cbseg	RESB	02H

_oldcbrofs	RESB	02H

_cbofs	RESB	02H

_axsave	RESB	04H

_bxsave	RESB	04H

_cxsave	RESB	04H

_dxsave	RESB	04H

_sisave	RESB	04H

_disave	RESB	04H

_spsave	RESB	04H

_bpsave	RESB	04H

_ipsave	RESB	04H

_flagssave	RESB	04H

_essave	RESB	02H

_dssave	RESB	02H

_sssave	RESB	02H

_cssave	RESB	02H

_fssave	RESB	02H

_gssave	RESB	02H
[GLOBAL	__breakflag]

__breakflag	RESB	04H
SECTION cstartup
	DD	_llsignal,149

SECTION _TEXT
[EXTERN	_fprintf]
[EXTERN	_raise]
[EXTERN	_exit]
[EXTERN	_dpmi_set_protected_except]
[EXTERN	_printf]
[EXTERN	_dpmi_set_protected_interrupt]

SECTION _DATA
[EXTERN	__stacktop]
[EXTERN	__pstreams]
