	SECTION _TEXT align=1 CLASS=CODE USE32
	SECTION _DATA align=16 CLASS=DATA USE32
	SECTION _BSS align=16 CLASS=BSS USE32
	SECTION _CONST align=16 CLASS=CONST USE32
	SECTION _STRING align=4 CLASS=STRING USE32
	SECTION _INIT_ align=1 CLASS=INITDATA USE32
	SECTION _EXIT_ align=1 CLASS=EXITDATA USE32
	SECTION cppinit  align=1 CLASS=CPPINIT USE32
	SECTION cppexit  align=1 CLASS=CPPEXIT USE32
	GROUP DGROUP _DATA _BSS _CONST _STRING

SECTION _TEXT
[GLOBAL	_getvideo]
;
; Line 18:	void getvideo(RECT rc, void *bf)
;
_getvideo:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EBX,DWORD [EBP+018H]
L_2:
;
; Line 19:	{
;
;
; Line 20:	int ht = RectBottom(rc)-RectTop(rc)+1;
;
	MOV	EAX,DWORD [EBP+014H]
	SUB	EAX,DWORD [EBP+0CH]
	INC	EAX
	MOV	DWORD [EBP-04H],EAX
;
; Line 21:	int bytes_row = (RectRight(rc)-RectLeft(rc)+1) * 2;
;
	MOV	EAX,DWORD [EBP+010H]
	SUB	EAX,DWORD [EBP+08H]
	INC	EAX
	SHL	EAX,01H
	MOV	EDI,EAX
;
; Line 22:	unsigned vadr = vad(RectLeft(rc), RectTop(rc));
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,DWORD [EBP+0CH]
	MOV	ECX,DWORD [EBP+08H]
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	SHL	ECX,04H
	ADD	EAX,ECX
	MOV	ESI,EAX
;
; Line 23:	hide_mousecursor();
;
	CALL	_hide_mousecursor
	JMP	SHORT	L_3
L_5:
;
; Line 25:	movefromscreen(bf, vadr, bytes_row);
;
	PUSH	EDI
	PUSH	ESI
	PUSH	EBX
	CALL	_movefromscreen
	ADD	ESP,BYTE 0CH
;
; Line 26:	vadr += SCREENWIDTH*2;
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	ADD	ESI,EAX
;
; Line 27:	bf = (char *)bf + bytes_row;
;
	MOV	EAX,EBX
	ADD	EAX,EDI
	MOV	EBX,EAX
L_3:
;
; Line 24:	while (ht--)    {
;
	MOV	EAX,DWORD [EBP-04H]
	DEC	DWORD [EBP-04H]
	TEST	EAX,EAX
	JNE	SHORT	L_5
L_4:
;
; Line 29:	show_mousecursor();
;
	CALL	_show_mousecursor
;
; Line 30:	}
;
L_1:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_storevideo]
;
; Line 33:	void storevideo(RECT rc, void *bf)
;
_storevideo:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EBX,DWORD [EBP+018H]
L_7:
;
; Line 34:	{
;
;
; Line 35:	int ht = RectBottom(rc)-RectTop(rc)+1;
;
	MOV	EAX,DWORD [EBP+014H]
	SUB	EAX,DWORD [EBP+0CH]
	INC	EAX
	MOV	DWORD [EBP-04H],EAX
;
; Line 36:	int bytes_row = (RectRight(rc)-RectLeft(rc)+1) * 2;
;
	MOV	EAX,DWORD [EBP+010H]
	SUB	EAX,DWORD [EBP+08H]
	INC	EAX
	SHL	EAX,01H
	MOV	EDI,EAX
;
; Line 37:	unsigned vadr = vad(RectLeft(rc), RectTop(rc));
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,DWORD [EBP+0CH]
	MOV	ECX,DWORD [EBP+08H]
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	SHL	ECX,04H
	ADD	EAX,ECX
	MOV	ESI,EAX
;
; Line 38:	hide_mousecursor();
;
	CALL	_hide_mousecursor
	JMP	SHORT	L_8
L_10:
;
; Line 40:	movetoscreen(bf, vadr, bytes_row);
;
	PUSH	EDI
	PUSH	ESI
	PUSH	EBX
	CALL	_movetoscreen
	ADD	ESP,BYTE 0CH
;
; Line 41:	vadr += SCREENWIDTH*2;
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	ADD	ESI,EAX
;
; Line 42:	bf = (char *)bf + bytes_row;
;
	MOV	EAX,EBX
	ADD	EAX,EDI
	MOV	EBX,EAX
L_8:
;
; Line 39:	while (ht--)    {
;
	MOV	EAX,DWORD [EBP-04H]
	DEC	DWORD [EBP-04H]
	TEST	EAX,EAX
	JNE	SHORT	L_10
L_9:
;
; Line 44:	show_mousecursor();
;
	CALL	_show_mousecursor
;
; Line 45:	}
;
L_6:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_GetVideoChar]
;
; Line 48:	unsigned int GetVideoChar(int x, int y)
;
_GetVideoChar:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+08H]
	MOV	EDI,DWORD [EBP+0CH]
L_12:
;
; Line 49:	{
;
;
; Line 51:	hide_mousecursor();
;
	CALL	_hide_mousecursor
;
; Line 52:	if (snowy)
;
	MOV	EAX,DWORD [_snowy]
	TEST	EAX,EAX
	JE	SHORT	L_13
;
; Line 53:	c = vpeek(MK_FP(video_address, vad(x,y)));
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,EDI
	MOV	ECX,ESI
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	IMUL	ECX,BYTE 010H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_address]
	MOV	FS,ECX
	PUSH	FS
	PUSH	EAX
	CALL	_vpeek
	ADD	ESP,BYTE 08H
	MOV	EBX,EAX
	JMP	SHORT	L_14
L_13:
;
; Line 55:	c = peek(video_address, vad(x,y));
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,EDI
	MOV	ECX,ESI
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	IMUL	ECX,BYTE 010H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_address]
	MOV	FS,ECX
	PUSH	GS
	MOVSX	EAX,WORD [FS:EAX+00H]
	MOV	EBX,EAX
	POP	GS
L_14:
;
; Line 56:	show_mousecursor();
;
	CALL	_show_mousecursor
;
; Line 57:	return c;
;
	MOV	EAX,EBX
L_11:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET
[GLOBAL	_PutVideoChar]
;
; Line 61:	void PutVideoChar(int x, int y, int c)
;
_PutVideoChar:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EBX,DWORD [EBP+0CH]
	MOV	ESI,DWORD [EBP+08H]
	MOV	EDI,DWORD [EBP+010H]
L_16:
;
; Line 62:	{
;
;
; Line 63:	if (x < SCREENWIDTH && y < SCREENHEIGHT)    {
;
	MOV	EAX,ESI
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	CMP	EAX,ECX
	JGE	NEAR	L_17
	MOV	EAX,EBX
	PUSH	EAX
	CALL	_isVGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JNE	SHORT	L_21
	PUSH	EAX
	CALL	_isEGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JE	SHORT	L_19
L_21:
	MOV	ECX,084H
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	INC	ECX
	JMP	SHORT	L_20
L_19:
	MOV	ECX,019H
L_20:
	CMP	EAX,ECX
	JGE	NEAR	L_17
;
; Line 64:	hide_mousecursor();
;
	CALL	_hide_mousecursor
;
; Line 65:	if (snowy)
;
	MOV	EAX,DWORD [_snowy]
	TEST	EAX,EAX
	JE	SHORT	L_22
;
; Line 66:	vpoke(MK_FP(video_address, vad(x,y)), c);
;
	PUSH	EDI
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,EBX
	MOV	ECX,ESI
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	IMUL	ECX,BYTE 010H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_address]
	MOV	FS,ECX
	PUSH	FS
	PUSH	EAX
	CALL	_vpoke
	ADD	ESP,BYTE 0CH
	JMP	SHORT	L_23
L_22:
;
; Line 68:	poke(video_address, vad(x,y), c);
;
	MOV	EAX,EDI
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	SHL	ECX,01H
	IMUL	ECX,EBX
	MOV	EDX,ESI
	SHL	EDX,01H
	ADD	ECX,EDX
	MOV	EDX,DWORD [_video_page]
	IMUL	EDX,BYTE 010H
	ADD	ECX,EDX
	MOV	EDX,DWORD [_video_address]
	MOV	FS,EDX
	PUSH	GS
	MOV	WORD [FS:ECX+00H],AX
L_23:
;
; Line 69:	show_mousecursor();
;
	CALL	_show_mousecursor
L_17:
;
; Line 71:	}
;
L_15:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET
[GLOBAL	_CharInView]
;
; Line 73:	BOOL CharInView(WINDOW wnd, int x, int y)
;
_CharInView:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 06CH
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
L_25:
;
; Line 74:	{
;
;
; Line 75:	WINDOW nwnd = NextWindow(wnd);
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	ESI,DWORD [EAX+048H]
;
; Line 78:	int x1 = GetLeft(wnd)+x;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+0CH]
	ADD	EAX,DWORD [EBP+0CH]
	MOV	DWORD [EBP-08H],EAX
;
; Line 79:	int y1 = GetTop(wnd)+y;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+010H]
	ADD	EAX,DWORD [EBP+010H]
	MOV	DWORD [EBP-04H],EAX
;
; Line 81:	if (!TestAttribute(wnd, VISIBLE))
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+054H]
	AND	EAX,BYTE 040H
	JNE	SHORT	L_26
;
; Line 82:	return FALSE;
;
	MOV	EAX,00H
	JMP	NEAR	L_24
L_26:
;
; Line 83:	if (!TestAttribute(wnd, NOCLIP))    {
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+054H]
	AND	EAX,0800H
	JNE	NEAR	L_28
;
; Line 84:	WINDOW wnd1 = GetParent(wnd);
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EBX,DWORD [EAX+03CH]
	JMP	NEAR	L_30
L_32:
;
; Line 87:	if (!TestAttribute(wnd1, VISIBLE))
;
	MOV	EAX,DWORD [EBX+054H]
	AND	EAX,BYTE 040H
	JNE	SHORT	L_33
;
; Line 88:	return FALSE;
;
	MOV	EAX,00H
	JMP	NEAR	L_24
L_33:
;
; Line 89:	if (!InsideRect(x1, y1, ClientRect(wnd1)))
;
	MOV	EAX,DWORD [EBP-08H]
	PUSH	EAX
	PUSH	EBX
	LEA	ECX,[EBP-05CH]
	PUSH	ECX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	MOV	ECX,EAX
	POP	EAX
	CMP	EAX,DWORD [ECX+00H]
	JL	SHORT	L_37
	MOV	EAX,DWORD [EBP-08H]
	PUSH	EAX
	PUSH	EBX
	LEA	ECX,[EBP-04CH]
	PUSH	ECX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	MOV	ECX,EAX
	POP	EAX
	CMP	EAX,DWORD [ECX+08H]
	JG	SHORT	L_37
	MOV	EAX,DWORD [EBP-04H]
	PUSH	EAX
	PUSH	EBX
	LEA	ECX,[EBP-03CH]
	PUSH	ECX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	MOV	ECX,EAX
	POP	EAX
	CMP	EAX,DWORD [ECX+04H]
	JL	SHORT	L_38
	MOV	EAX,DWORD [EBP-04H]
	PUSH	EAX
	PUSH	EBX
	LEA	ECX,[EBP-02CH]
	PUSH	ECX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	MOV	ECX,EAX
	POP	EAX
	CMP	EAX,DWORD [ECX+0CH]
	JLE	SHORT	L_35
L_38:
L_37:
;
; Line 90:	return FALSE;
;
	MOV	EAX,00H
	JMP	NEAR	L_24
L_35:
;
; Line 91:	wnd1 = GetParent(wnd1);
;
	MOV	EBX,DWORD [EBX+03CH]
L_30:
;
; Line 85:	while (wnd1 != NULL)    {
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JNE	NEAR	L_32
L_31:
L_28:
	JMP	NEAR	L_39
L_41:
;
; Line 95:	if (!isHidden(nwnd)   )	{
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,BYTE 040H
	JE	NEAR	L_42
;
; Line 96:	rc = WindowRect(nwnd);
;
	PUSH	ESI
	PUSH	EDI
	ADD	ESI,BYTE 0CH
	LEA	EDI,[EBP-018H]
	PUSH	ES
	PUSH	DS
	POP	ES
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	ES
	POP	EDI
	POP	ESI
;
; Line 97:	if (TestAttribute(nwnd, SHADOW))    {
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,BYTE 01H
	JE	SHORT	L_44
;
; Line 98:	RectBottom(rc)++;
;
	INC	DWORD [EBP-0CH]
;
; Line 99:	RectRight(rc)++;
;
	INC	DWORD [EBP-010H]
L_44:
;
; Line 101:	if (!TestAttribute(nwnd, NOCLIP))	{
;
	MOV	EAX,DWORD [ESI+054H]
	AND	EAX,0800H
	JNE	SHORT	L_46
;
; Line 102:	pwnd = nwnd;
;
	MOV	EDI,ESI
	JMP	SHORT	L_48
L_50:
;
; Line 104:	pwnd = GetParent(pwnd);
;
	MOV	EDI,DWORD [EDI+03CH]
;
; Line 105:	rc = subRectangle(rc, ClientRect(pwnd));
;
	PUSH	EDI
	LEA	EAX,[EBP-06CH]
	PUSH	EAX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	PUSH	DWORD [EAX+00H+0CH]
	PUSH	DWORD [EAX+00H+08H]
	PUSH	DWORD [EAX+00H+04H]
	PUSH	DWORD [EAX+00H+00H]
	PUSH	DWORD [EBP-018H+0CH]
	PUSH	DWORD [EBP-018H+08H]
	PUSH	DWORD [EBP-018H+04H]
	PUSH	DWORD [EBP-018H+00H]
	LEA	EAX,[EBP-018H]
	PUSH	EAX
	CALL	_subRectangle
	ADD	ESP,BYTE 024H
L_48:
;
; Line 103:	while (GetParent(pwnd))	{
;
	MOV	EAX,DWORD [EDI+03CH]
	TEST	EAX,EAX
	JNE	SHORT	L_50
L_49:
L_46:
;
; Line 108:	if (InsideRect(x1,y1,rc))
;
	MOV	EAX,DWORD [EBP-08H]
	CMP	EAX,DWORD [EBP-018H]
	JL	SHORT	L_51
	MOV	EAX,DWORD [EBP-08H]
	CMP	EAX,DWORD [EBP-010H]
	JG	SHORT	L_51
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-014H]
	JL	SHORT	L_51
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-0CH]
	JG	SHORT	L_51
;
; Line 109:	return FALSE;
;
	MOV	EAX,00H
	JMP	SHORT	L_24
L_51:
L_42:
;
; Line 111:	nwnd = NextWindow(nwnd);
;
	MOV	ESI,DWORD [ESI+048H]
L_39:
;
; Line 94:	while (nwnd != NULL)	{
;
	MOV	EAX,ESI
	TEST	EAX,EAX
	JNE	NEAR	L_41
L_40:
;
; Line 113:	return (x1 < SCREENWIDTH && y1 < SCREENHEIGHT);
;
	MOV	EAX,DWORD [EBP-08H]
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	CMP	EAX,ECX
	JGE	SHORT	L_54
	MOV	EAX,DWORD [EBP-04H]
	PUSH	EAX
	CALL	_isVGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JNE	SHORT	L_57
	PUSH	EAX
	CALL	_isEGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JE	SHORT	L_55
L_57:
	MOV	ECX,084H
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	INC	ECX
	JMP	SHORT	L_56
L_55:
	MOV	ECX,019H
L_56:
	CMP	EAX,ECX
	JL	SHORT	L_53
L_54:
	SUB	EAX,EAX
; TEST EAX,IMMED (branches around next four bytes of code)
	DB	0A9H
L_53:
	SUB	EAX,EAX
	INC	EAX
	NOP
; end TEST EAX,IMMED
L_24:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_wputch]
;
; Line 117:	void wputch(WINDOW wnd, int c, int x, int y)
;
_wputch:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
L_59:
;
; Line 118:	{
;
;
; Line 119:	if (CharInView(wnd, x, y))	{
;
	PUSH	DWORD [EBP+014H]
	PUSH	DWORD [EBP+010H]
	PUSH	DWORD [EBP+08H]
	CALL	_CharInView
	ADD	ESP,BYTE 0CH
	TEST	EAX,EAX
	JE	NEAR	L_60
;
; Line 120:	int ch = (c & 255) | (clr(foreground, background) << 8);
;
	MOV	EAX,DWORD [_background]
	SAL	EAX,04H
	OR	EAX,DWORD [_foreground]
	SAL	EAX,08H
	MOVZX	ECX,BYTE [EBP+0CH]
	OR	EAX,ECX
	MOV	EDI,EAX
;
; Line 121:	int xc = GetLeft(wnd)+x;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+0CH]
	ADD	EAX,DWORD [EBP+010H]
	MOV	ESI,EAX
;
; Line 122:	int yc = GetTop(wnd)+y;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+010H]
	ADD	EAX,DWORD [EBP+014H]
	MOV	EBX,EAX
;
; Line 123:	hide_mousecursor();
;
	CALL	_hide_mousecursor
;
; Line 124:	if (snowy)
;
	MOV	EAX,DWORD [_snowy]
	TEST	EAX,EAX
	JE	SHORT	L_62
;
; Line 125:	vpoke(MK_FP(video_address, vad(xc, yc)), ch);
;
	PUSH	EDI
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,EBX
	MOV	ECX,ESI
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	IMUL	ECX,BYTE 010H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_address]
	MOV	FS,ECX
	PUSH	FS
	PUSH	EAX
	CALL	_vpoke
	ADD	ESP,BYTE 0CH
	JMP	SHORT	L_63
L_62:
;
; Line 127:	poke(video_address, vad(xc, yc), ch);
;
	MOV	EAX,EDI
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	SHL	ECX,01H
	IMUL	ECX,EBX
	MOV	EDX,ESI
	SHL	EDX,01H
	ADD	ECX,EDX
	MOV	EDX,DWORD [_video_page]
	IMUL	EDX,BYTE 010H
	ADD	ECX,EDX
	MOV	EDX,DWORD [_video_address]
	MOV	FS,EDX
	PUSH	GS
	MOV	WORD [FS:ECX+00H],AX
L_63:
;
; Line 128:	show_mousecursor();
;
	CALL	_show_mousecursor
L_60:
;
; Line 130:	}
;
L_58:
	POP	EDI
	POP	ESI
	POP	EBX
	POP	EBP
	RET
[GLOBAL	_wputs]
;
; Line 133:	void wputs(WINDOW wnd, void *s, int x, int y)
;
_wputs:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,01D4H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
L_65:
;
; Line 134:	{
;
;
; Line 135:	BOOL changecolor = FALSE;
;
	MOV	DWORD [EBP-010H],00H
;
; Line 136:	int x1 = GetLeft(wnd)+x;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+0CH]
	ADD	EAX,DWORD [EBP+010H]
	MOV	DWORD [EBP-0CH],EAX
;
; Line 137:	int x2 = x1;
;
	MOV	EAX,DWORD [EBP-0CH]
	MOV	DWORD [EBP-08H],EAX
;
; Line 138:	int y1 = GetTop(wnd)+y;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+010H]
	ADD	EAX,DWORD [EBP+014H]
	MOV	DWORD [EBP-04H],EAX
;
; Line 139:	if (x1 < SCREENWIDTH && y1 < SCREENHEIGHT && isVisible(wnd))	{
;
	MOV	EAX,DWORD [EBP-0CH]
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	CMP	EAX,ECX
	JGE	NEAR	L_66
	MOV	EAX,DWORD [EBP-04H]
	PUSH	EAX
	CALL	_isVGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JNE	SHORT	L_70
	PUSH	EAX
	CALL	_isEGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JE	SHORT	L_68
L_70:
	MOV	ECX,084H
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	INC	ECX
	JMP	SHORT	L_69
L_68:
	MOV	ECX,019H
L_69:
	CMP	EAX,ECX
	JGE	NEAR	L_66
	PUSH	DWORD [EBP+08H]
	CALL	_isVisible
	POP	ECX
	TEST	EAX,EAX
	JE	NEAR	L_66
;
; Line 141:	short *cp1 = ln;
;
	LEA	EAX,[EBP-01B4H]
	MOV	DWORD [EBP-024H],EAX
;
; Line 142:	unsigned char *str = s;
;
	MOV	ESI,DWORD [EBP+0CH]
;
; Line 143:	int fg = foreground;
;
	MOV	EAX,DWORD [_foreground]
	MOV	DWORD [EBP-020H],EAX
;
; Line 144:	int bg = background;
;
	MOV	EAX,DWORD [_background]
	MOV	DWORD [EBP-01CH],EAX
;
; Line 146:	int off = 0;
;
	MOV	DWORD [EBP-018H],00H
	JMP	NEAR	L_71
L_73:
;
; Line 148:	if (*str == CHANGECOLOR)    {
;
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,0FCH
	JNE	SHORT	L_74
;
; Line 149:	if (changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JE	SHORT	L_76
;
; Line 151:	str += 3;
;
	ADD	ESI,BYTE 03H
	JMP	SHORT	L_77
L_76:
;
; Line 155:	str++;
;
	INC	ESI
;
; Line 156:	foreground = (*str++) & 0x7f;
;
	MOV	EAX,ESI
	INC	ESI
	MOVZX	EAX,BYTE [EAX+00H]
	AND	EAX,BYTE 07FH
	MOV	DWORD [_foreground],EAX
;
; Line 157:	background = (*str++) & 0x7f;
;
	MOV	EAX,ESI
	INC	ESI
	MOVZX	EAX,BYTE [EAX+00H]
	AND	EAX,BYTE 07FH
	MOV	DWORD [_background],EAX
L_77:
;
; Line 159:	changecolor++;
;
	INC	DWORD [EBP-010H]
;
; Line 160:	continue;
;
	JMP	NEAR	L_71
L_74:
;
; Line 162:	if (*str == RESETCOLOR)    {
;
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,0FDH
	JNE	SHORT	L_78
;
; Line 163:	if (changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JE	SHORT	L_80
;
; Line 164:	changecolor--;
;
	DEC	DWORD [EBP-010H]
L_80:
;
; Line 165:	if (!changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JNE	SHORT	L_82
;
; Line 167:	foreground = fg & 0x7f;
;
	MOV	EAX,DWORD [EBP-020H]
	AND	EAX,BYTE 07FH
	MOV	DWORD [_foreground],EAX
;
; Line 168:	background = bg & 0x7f;
;
	MOV	EAX,DWORD [EBP-01CH]
	AND	EAX,BYTE 07FH
	MOV	DWORD [_background],EAX
L_82:
;
; Line 170:	str++;
;
	INC	ESI
;
; Line 171:	continue;
;
	JMP	NEAR	L_71
L_78:
;
; Line 173:	if (*str == ('\t' | 0x80) || *str == ('\f' | 0x80))
;
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,089H
	JE	SHORT	L_86
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,08CH
	JNE	SHORT	L_84
L_86:
;
; Line 174:	*cp1 = ' ' | (clr(foreground, background) << 8);
;
	MOV	EAX,DWORD [_background]
	SAL	EAX,04H
	OR	EAX,DWORD [_foreground]
	SAL	EAX,08H
	OR	EAX,BYTE 020H
	MOV	ECX,DWORD [EBP-024H]
	MOV	WORD [ECX+00H],AX
	JMP	SHORT	L_85
L_84:
;
; Line 176:	*cp1 = (*str & 255) | (clr(foreground, background) << 8);
;
	MOVZX	EAX,BYTE [ESI+00H]
	MOVZX	EAX,AL
	MOV	ECX,DWORD [_background]
	SAL	ECX,04H
	OR	ECX,DWORD [_foreground]
	SAL	ECX,08H
	OR	EAX,ECX
	MOV	ECX,DWORD [EBP-024H]
	MOV	WORD [ECX+00H],AX
L_85:
;
; Line 177:	if (ClipString)
;
	MOV	EAX,DWORD [_ClipString]
	TEST	EAX,EAX
	JE	SHORT	L_87
;
; Line 178:	if (!CharInView(wnd, x, y))
;
	PUSH	DWORD [EBP+014H]
	PUSH	DWORD [EBP+010H]
	PUSH	DWORD [EBP+08H]
	CALL	_CharInView
	ADD	ESP,BYTE 0CH
	TEST	EAX,EAX
	JNE	SHORT	L_89
;
; Line 179:	*cp1 = peek(video_address, vad(x2,y1));
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,DWORD [EBP-04H]
	MOV	ECX,DWORD [EBP-08H]
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	IMUL	ECX,BYTE 010H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_address]
	MOV	FS,ECX
	PUSH	GS
	MOV	AX,WORD [FS:EAX+00H]
	MOV	ECX,DWORD [EBP-024H]
	MOV	WORD [ECX+00H],AX
	POP	GS
L_89:
L_87:
;
; Line 180:	cp1++;
;
	ADD	DWORD [EBP-024H],BYTE 02H
;
; Line 181:	str++;
;
	INC	ESI
;
; Line 182:	x++;
;
	INC	DWORD [EBP+010H]
;
; Line 183:	x2++;
;
	INC	DWORD [EBP-08H]
L_71:
;
; Line 147:	while (*str)    {
;
	MOV	AL,BYTE [ESI+00H]
	TEST	AL,AL
	JNE	NEAR	L_73
L_72:
;
; Line 185:	foreground = fg;
;
	MOV	EAX,DWORD [EBP-020H]
	MOV	DWORD [_foreground],EAX
;
; Line 186:	background = bg;
;
	MOV	EAX,DWORD [EBP-01CH]
	MOV	DWORD [_background],EAX
;
; Line 187:	len = (int)(cp1-ln);
;
	MOV	EAX,DWORD [EBP-024H]
	LEA	ECX,[EBP-01B4H]
	SUB	EAX,ECX
	SHR	EAX,01H
	MOV	EBX,EAX
;
; Line 188:	if (x1+len > SCREENWIDTH)
;
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,EBX
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	CMP	EAX,ECX
	JLE	SHORT	L_91
;
; Line 189:	len = SCREENWIDTH-x1;
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SUB	EAX,DWORD [EBP-0CH]
	MOV	EBX,EAX
L_91:
;
; Line 191:	if (!ClipString && !TestAttribute(wnd, NOCLIP))	{
;
	MOV	EAX,DWORD [_ClipString]
	TEST	EAX,EAX
	JNE	NEAR	L_93
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+054H]
	AND	EAX,0800H
	JNE	NEAR	L_93
;
; Line 193:	RECT rc = WindowRect(wnd);
;
	MOV	EAX,DWORD [EBP+08H]
	PUSH	ESI
	PUSH	EDI
	LEA	ESI,[EAX+0CH]
	LEA	EDI,[EBP-01C4H]
	PUSH	ES
	PUSH	DS
	POP	ES
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	ES
	POP	EDI
	POP	ESI
;
; Line 194:	WINDOW nwnd = GetParent(wnd);
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EDI,DWORD [EAX+03CH]
	JMP	SHORT	L_95
L_97:
;
; Line 196:	if (!isVisible(nwnd))	{
;
	PUSH	EDI
	CALL	_isVisible
	POP	ECX
	TEST	EAX,EAX
	JNE	SHORT	L_98
;
; Line 197:	len = 0;
;
	MOV	EBX,00H
;
; Line 198:	break;
;
	JMP	SHORT	L_96
L_98:
;
; Line 200:	rc = subRectangle(rc, ClientRect(nwnd));
;
	PUSH	EDI
	LEA	EAX,[EBP-01D4H]
	PUSH	EAX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	PUSH	DWORD [EAX+00H+0CH]
	PUSH	DWORD [EAX+00H+08H]
	PUSH	DWORD [EAX+00H+04H]
	PUSH	DWORD [EAX+00H+00H]
	PUSH	DWORD [EBP-01C4H+0CH]
	PUSH	DWORD [EBP-01C4H+08H]
	PUSH	DWORD [EBP-01C4H+04H]
	PUSH	DWORD [EBP-01C4H+00H]
	LEA	EAX,[EBP-01C4H]
	PUSH	EAX
	CALL	_subRectangle
	ADD	ESP,BYTE 024H
;
; Line 201:	nwnd = GetParent(nwnd);
;
	MOV	EDI,DWORD [EDI+03CH]
L_95:
;
; Line 195:	while (len > 0 && nwnd != NULL)	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_100
	MOV	EAX,EDI
	TEST	EAX,EAX
	JNE	SHORT	L_97
L_100:
L_96:
	JMP	SHORT	L_101
L_103:
;
; Line 204:	off++;
;
	INC	DWORD [EBP-018H]
;
; Line 205:	--len;
;
	DEC	EBX
L_101:
;
; Line 203:	while (len > 0 && !InsideRect(x1+off,y1,rc))	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_104
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,DWORD [EBP-018H]
	CMP	EAX,DWORD [EBP-01C4H]
	JL	SHORT	L_103
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,DWORD [EBP-018H]
	CMP	EAX,DWORD [EBP-01BCH]
	JG	SHORT	L_103
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01C0H]
	JL	SHORT	L_103
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01B8H]
	JG	SHORT	L_103
L_104:
L_102:
;
; Line 207:	if (len > 0)	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_105
;
; Line 208:	x2 = x1+len-1;
;
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,EBX
	DEC	EAX
	MOV	DWORD [EBP-08H],EAX
	JMP	SHORT	L_107
L_109:
;
; Line 210:	--x2;
;
	DEC	DWORD [EBP-08H]
;
; Line 211:	--len;
;
	DEC	EBX
L_107:
;
; Line 209:	while (len && !InsideRect(x2,y1,rc))	{
;
	TEST	EBX,EBX
	JE	SHORT	L_110
	MOV	EAX,DWORD [EBP-08H]
	CMP	EAX,DWORD [EBP-01C4H]
	JL	SHORT	L_109
	MOV	EAX,DWORD [EBP-08H]
	CMP	EAX,DWORD [EBP-01BCH]
	JG	SHORT	L_109
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01C0H]
	JL	SHORT	L_109
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01B8H]
	JG	SHORT	L_109
L_110:
L_108:
L_105:
L_93:
;
; Line 215:	if (len > 0)	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_111
;
; Line 216:	hide_mousecursor();
;
	CALL	_hide_mousecursor
;
; Line 217:	movetoscreen(ln+off, vad(x1+off,y1), len*2);
;
	MOV	EAX,EBX
	SHL	EAX,01H
	PUSH	EAX
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,DWORD [EBP-04H]
	MOV	ECX,DWORD [EBP-0CH]
	ADD	ECX,DWORD [EBP-018H]
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	SHL	ECX,04H
	ADD	EAX,ECX
	PUSH	EAX
	MOV	EAX,DWORD [EBP-018H]
	SHL	EAX,01H
	LEA	ECX,[EBP-01B4H]
	ADD	EAX,ECX
	PUSH	EAX
	CALL	_movetoscreen
	ADD	ESP,BYTE 0CH
;
; Line 218:	show_mousecursor();
;
	CALL	_show_mousecursor
L_111:
L_66:
;
; Line 221:	}
;
L_64:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_twputs]
;
; Line 223:	void twputs(WINDOW wnd, void *s, int x, int y)
;
_twputs:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,01CCH
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
L_114:
;
; Line 224:	{
;
;
; Line 225:	BOOL changecolor = FALSE;
;
	MOV	DWORD [EBP-010H],00H
;
; Line 226:	int x1 = GetLeft(wnd)+x;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+0CH]
	ADD	EAX,DWORD [EBP+010H]
	MOV	DWORD [EBP-0CH],EAX
;
; Line 227:	int x2 = x1;
;
	MOV	EAX,DWORD [EBP-0CH]
	MOV	DWORD [EBP-08H],EAX
;
; Line 228:	int y1 = GetTop(wnd)+y;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+010H]
	ADD	EAX,DWORD [EBP+014H]
	MOV	DWORD [EBP-04H],EAX
;
; Line 229:	if (x1 < SCREENWIDTH && y1 < SCREENHEIGHT && isVisible(wnd))	{
;
	MOV	EAX,DWORD [EBP-0CH]
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	CMP	EAX,ECX
	JGE	NEAR	L_115
	MOV	EAX,DWORD [EBP-04H]
	PUSH	EAX
	CALL	_isVGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JNE	SHORT	L_119
	PUSH	EAX
	CALL	_isEGA
	MOV	ECX,EAX
	POP	EAX
	TEST	ECX,ECX
	JE	SHORT	L_117
L_119:
	MOV	ECX,084H
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	INC	ECX
	JMP	SHORT	L_118
L_117:
	MOV	ECX,019H
L_118:
	CMP	EAX,ECX
	JGE	NEAR	L_115
	PUSH	DWORD [EBP+08H]
	CALL	_isVisible
	POP	ECX
	TEST	EAX,EAX
	JE	NEAR	L_115
;
; Line 231:	short *cp1 = ln;
;
	LEA	EAX,[EBP-01ACH]
	MOV	DWORD [EBP-01CH],EAX
;
; Line 232:	ATTRCHR *str = s;
;
	MOV	ESI,DWORD [EBP+0CH]
;
; Line 234:	int off = 0;
;
	MOV	DWORD [EBP-018H],00H
	JMP	NEAR	L_120
L_122:
;
; Line 236:	if (str->ch == CHANGECOLOR)    {
;
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,0FCH
	JNE	SHORT	L_123
;
; Line 237:	if (changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JE	SHORT	L_125
;
; Line 239:	str += 3;
;
	ADD	ESI,BYTE 06H
	JMP	SHORT	L_126
L_125:
;
; Line 243:	str++;
;
	ADD	ESI,BYTE 02H
;
; Line 244:	foreground = (str++->ch) & 0x7f;
;
	MOV	EAX,ESI
	ADD	ESI,BYTE 02H
	MOVZX	EAX,BYTE [EAX+00H]
	AND	EAX,BYTE 07FH
	MOV	DWORD [_foreground],EAX
;
; Line 245:	background = (str++->ch) & 0x7f;
;
	MOV	EAX,ESI
	ADD	ESI,BYTE 02H
	MOVZX	EAX,BYTE [EAX+00H]
	AND	EAX,BYTE 07FH
	MOV	DWORD [_background],EAX
L_126:
;
; Line 247:	changecolor++;
;
	INC	DWORD [EBP-010H]
;
; Line 248:	continue;
;
	JMP	NEAR	L_120
L_123:
;
; Line 250:	if (str->ch == RESETCOLOR)    {
;
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,0FDH
	JNE	SHORT	L_127
;
; Line 251:	if (changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JE	SHORT	L_129
;
; Line 252:	changecolor--;
;
	DEC	DWORD [EBP-010H]
L_129:
;
; Line 253:	str++;
;
	ADD	ESI,BYTE 02H
;
; Line 254:	continue;
;
	JMP	NEAR	L_120
L_127:
;
; Line 256:	if (str->ch == ('\t' | 0x80) || str->ch == ('\f' | 0x80))
;
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,089H
	JE	SHORT	L_133
	MOVZX	EAX,BYTE [ESI+00H]
	CMP	EAX,08CH
	JNE	SHORT	L_131
L_133:
;
; Line 257:	if (changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JE	SHORT	L_134
;
; Line 258:	*cp1 = ' ' | (clr(foreground, background) << 8);
;
	MOV	EAX,DWORD [_background]
	SAL	EAX,04H
	OR	EAX,DWORD [_foreground]
	SAL	EAX,08H
	OR	EAX,BYTE 020H
	MOV	ECX,DWORD [EBP-01CH]
	MOV	WORD [ECX+00H],AX
	JMP	SHORT	L_135
L_134:
;
; Line 260:	*cp1 = ' ' | (str->attrib << 8);
;
	MOVZX	EAX,BYTE [ESI+01H]
	SAL	EAX,08H
	OR	EAX,BYTE 020H
	MOV	ECX,DWORD [EBP-01CH]
	MOV	WORD [ECX+00H],AX
L_135:
	JMP	SHORT	L_132
L_131:
;
; Line 262:	if (changecolor)
;
	MOV	EAX,DWORD [EBP-010H]
	TEST	EAX,EAX
	JE	SHORT	L_136
;
; Line 263:	*cp1 = (str->ch & 255) | (clr(foreground, background) << 8);
;
	MOVZX	EAX,BYTE [ESI+00H]
	MOVZX	EAX,AL
	MOV	ECX,DWORD [_background]
	SAL	ECX,04H
	OR	ECX,DWORD [_foreground]
	SAL	ECX,08H
	OR	EAX,ECX
	MOV	ECX,DWORD [EBP-01CH]
	MOV	WORD [ECX+00H],AX
	JMP	SHORT	L_137
L_136:
;
; Line 265:	*cp1 = (str->ch & 255) | (str->attrib << 8);
;
	MOVZX	EAX,BYTE [ESI+01H]
	SAL	EAX,08H
	MOVZX	ECX,BYTE [ESI+00H]
	MOVZX	ECX,CL
	OR	EAX,ECX
	MOV	ECX,DWORD [EBP-01CH]
	MOV	WORD [ECX+00H],AX
L_137:
L_132:
;
; Line 266:	if (ClipString)
;
	MOV	EAX,DWORD [_ClipString]
	TEST	EAX,EAX
	JE	SHORT	L_138
;
; Line 267:	if (!CharInView(wnd, x, y))
;
	PUSH	DWORD [EBP+014H]
	PUSH	DWORD [EBP+010H]
	PUSH	DWORD [EBP+08H]
	CALL	_CharInView
	ADD	ESP,BYTE 0CH
	TEST	EAX,EAX
	JNE	SHORT	L_140
;
; Line 268:	*cp1 = peek(video_address, vad(x2,y1));
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,DWORD [EBP-04H]
	MOV	ECX,DWORD [EBP-08H]
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	IMUL	ECX,BYTE 010H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_address]
	MOV	FS,ECX
	PUSH	GS
	MOV	AX,WORD [FS:EAX+00H]
	MOV	ECX,DWORD [EBP-01CH]
	MOV	WORD [ECX+00H],AX
	POP	GS
L_140:
L_138:
;
; Line 269:	cp1++;
;
	ADD	DWORD [EBP-01CH],BYTE 02H
;
; Line 270:	str++;
;
	ADD	ESI,BYTE 02H
;
; Line 271:	x++;
;
	INC	DWORD [EBP+010H]
;
; Line 272:	x2++;
;
	INC	DWORD [EBP-08H]
L_120:
;
; Line 235:	while (str->ch)    {
;
	MOV	AL,BYTE [ESI+00H]
	TEST	AL,AL
	JNE	NEAR	L_122
L_121:
;
; Line 274:	len = (int)(cp1-ln);
;
	MOV	EAX,DWORD [EBP-01CH]
	LEA	ECX,[EBP-01ACH]
	SUB	EAX,ECX
	SHR	EAX,01H
	MOV	EBX,EAX
;
; Line 275:	if (x1+len > SCREENWIDTH)
;
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,EBX
	MOV	ECX,04AH
	MOVZX	EDX,WORD [___seg0040]
	MOV	GS,EDX
	MOVSX	ECX,BYTE [GS:ECX+00H]
	MOVZX	ECX,CL
	CMP	EAX,ECX
	JLE	SHORT	L_142
;
; Line 276:	len = SCREENWIDTH-x1;
;
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SUB	EAX,DWORD [EBP-0CH]
	MOV	EBX,EAX
L_142:
;
; Line 278:	if (!ClipString && !TestAttribute(wnd, NOCLIP))	{
;
	MOV	EAX,DWORD [_ClipString]
	TEST	EAX,EAX
	JNE	NEAR	L_144
	MOV	EAX,DWORD [EBP+08H]
	MOV	EAX,DWORD [EAX+054H]
	AND	EAX,0800H
	JNE	NEAR	L_144
;
; Line 280:	RECT rc = WindowRect(wnd);
;
	MOV	EAX,DWORD [EBP+08H]
	PUSH	ESI
	PUSH	EDI
	LEA	ESI,[EAX+0CH]
	LEA	EDI,[EBP-01BCH]
	PUSH	ES
	PUSH	DS
	POP	ES
	CLD
	MOV	ECX,04H
	REP	MOVSD
	POP	ES
	POP	EDI
	POP	ESI
;
; Line 281:	WINDOW nwnd = GetParent(wnd);
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EDI,DWORD [EAX+03CH]
	JMP	SHORT	L_146
L_148:
;
; Line 283:	if (!isVisible(nwnd))	{
;
	PUSH	EDI
	CALL	_isVisible
	POP	ECX
	TEST	EAX,EAX
	JNE	SHORT	L_149
;
; Line 284:	len = 0;
;
	MOV	EBX,00H
;
; Line 285:	break;
;
	JMP	SHORT	L_147
L_149:
;
; Line 287:	rc = subRectangle(rc, ClientRect(nwnd));
;
	PUSH	EDI
	LEA	EAX,[EBP-01CCH]
	PUSH	EAX
	CALL	_ClientRect
	ADD	ESP,BYTE 08H
	PUSH	DWORD [EAX+00H+0CH]
	PUSH	DWORD [EAX+00H+08H]
	PUSH	DWORD [EAX+00H+04H]
	PUSH	DWORD [EAX+00H+00H]
	PUSH	DWORD [EBP-01BCH+0CH]
	PUSH	DWORD [EBP-01BCH+08H]
	PUSH	DWORD [EBP-01BCH+04H]
	PUSH	DWORD [EBP-01BCH+00H]
	LEA	EAX,[EBP-01BCH]
	PUSH	EAX
	CALL	_subRectangle
	ADD	ESP,BYTE 024H
;
; Line 288:	nwnd = GetParent(nwnd);
;
	MOV	EDI,DWORD [EDI+03CH]
L_146:
;
; Line 282:	while (len > 0 && nwnd != NULL)	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_151
	MOV	EAX,EDI
	TEST	EAX,EAX
	JNE	SHORT	L_148
L_151:
L_147:
	JMP	SHORT	L_152
L_154:
;
; Line 291:	off++;
;
	INC	DWORD [EBP-018H]
;
; Line 292:	--len;
;
	DEC	EBX
L_152:
;
; Line 290:	while (len > 0 && !InsideRect(x1+off,y1,rc))	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_155
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,DWORD [EBP-018H]
	CMP	EAX,DWORD [EBP-01BCH]
	JL	SHORT	L_154
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,DWORD [EBP-018H]
	CMP	EAX,DWORD [EBP-01B4H]
	JG	SHORT	L_154
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01B8H]
	JL	SHORT	L_154
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01B0H]
	JG	SHORT	L_154
L_155:
L_153:
;
; Line 294:	if (len > 0)	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_156
;
; Line 295:	x2 = x1+len-1;
;
	MOV	EAX,DWORD [EBP-0CH]
	ADD	EAX,EBX
	DEC	EAX
	MOV	DWORD [EBP-08H],EAX
	JMP	SHORT	L_158
L_160:
;
; Line 297:	--x2;
;
	DEC	DWORD [EBP-08H]
;
; Line 298:	--len;
;
	DEC	EBX
L_158:
;
; Line 296:	while (len && !InsideRect(x2,y1,rc))	{
;
	TEST	EBX,EBX
	JE	SHORT	L_161
	MOV	EAX,DWORD [EBP-08H]
	CMP	EAX,DWORD [EBP-01BCH]
	JL	SHORT	L_160
	MOV	EAX,DWORD [EBP-08H]
	CMP	EAX,DWORD [EBP-01B4H]
	JG	SHORT	L_160
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01B8H]
	JL	SHORT	L_160
	MOV	EAX,DWORD [EBP-04H]
	CMP	EAX,DWORD [EBP-01B0H]
	JG	SHORT	L_160
L_161:
L_159:
L_156:
L_144:
;
; Line 302:	if (len > 0)	{
;
	MOV	EAX,EBX
	TEST	EAX,EAX
	JLE	SHORT	L_162
;
; Line 303:	hide_mousecursor();
;
	CALL	_hide_mousecursor
;
; Line 304:	movetoscreen(ln+off, vad(x1+off,y1), len*2);
;
	MOV	EAX,EBX
	SHL	EAX,01H
	PUSH	EAX
	MOV	EAX,04AH
	MOVZX	ECX,WORD [___seg0040]
	MOV	GS,ECX
	MOVSX	EAX,BYTE [GS:EAX+00H]
	MOVZX	EAX,AL
	SHL	EAX,01H
	IMUL	EAX,DWORD [EBP-04H]
	MOV	ECX,DWORD [EBP-0CH]
	ADD	ECX,DWORD [EBP-018H]
	SHL	ECX,01H
	ADD	EAX,ECX
	MOV	ECX,DWORD [_video_page]
	SHL	ECX,04H
	ADD	EAX,ECX
	PUSH	EAX
	MOV	EAX,DWORD [EBP-018H]
	SHL	EAX,01H
	LEA	ECX,[EBP-01ACH]
	ADD	EAX,ECX
	PUSH	EAX
	CALL	_movetoscreen
	ADD	ESP,BYTE 0CH
;
; Line 305:	show_mousecursor();
;
	CALL	_show_mousecursor
L_162:
L_115:
;
; Line 308:	}
;
L_113:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_get_videomode]
;
; Line 311:	void get_videomode(void)
;
_get_videomode:
	PUSH	EBP
	MOV	EBP,ESP
L_165:
;
; Line 312:	{
;
;
; Line 313:	videomode();
;
	CALL	_videomode
;
; Line 315:	snowy = FALSE;
;
	MOV	DWORD [_snowy],00H
;
; Line 316:	if (ismono())
;
	MOV	EAX,DWORD [_video_mode]
	CMP	EAX,BYTE 07H
	JNE	SHORT	L_166
;
; Line 317:	video_address = __segB000;
;
	MOVZX	EAX,WORD [___segB000]
	MOV	DWORD [_video_address],EAX
	JMP	SHORT	L_167
L_166:
;
; Line 320:	video_address = __segB800;
;
	MOVZX	EAX,WORD [___segB800]
	MOV	DWORD [_video_address],EAX
;
; Line 321:	if (!isEGA() && !isVGA())
;
	CALL	_isEGA
	TEST	EAX,EAX
	JNE	SHORT	L_168
	CALL	_isVGA
	TEST	EAX,EAX
	JNE	SHORT	L_168
;
; Line 323:	snowy = cfg.snowy;
;
	MOV	EAX,DWORD [010H+_cfg]
	MOV	DWORD [_snowy],EAX
L_168:
L_167:
;
; Line 325:	}
;
L_164:
	POP	EBP
	RET
[GLOBAL	_scroll_window]
;
; Line 328:	void scroll_window(WINDOW wnd, RECT rc, int d)
;
_scroll_window:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 01CH
	PUSH	EBX
	MOV	EBX,DWORD [EBP+08H]
L_171:
;
; Line 329:	{
;
;
; Line 330:	if (RectTop(rc) != RectBottom(rc))	{
;
	MOV	EAX,DWORD [EBP+010H]
	CMP	EAX,DWORD [EBP+018H]
	JE	SHORT	L_172
;
; Line 332:	regs.h.cl = RectLeft(rc);
;
	MOV	AL,BYTE [EBP+0CH]
	MOV	BYTE [EBP-014H],AL
;
; Line 333:	regs.h.ch = RectTop(rc);
;
	MOV	AL,BYTE [EBP+010H]
	MOV	BYTE [EBP-013H],AL
;
; Line 334:	regs.h.dl = RectRight(rc);
;
	MOV	AL,BYTE [EBP+014H]
	MOV	BYTE [EBP-010H],AL
;
; Line 335:	regs.h.dh = RectBottom(rc);
;
	MOV	AL,BYTE [EBP+018H]
	MOV	BYTE [EBP-0FH],AL
;
; Line 336:	regs.h.bh = clr(WndForeground(wnd),WndBackground(wnd));
;
	MOVSX	EAX,BYTE [EBX+035H]
	SAL	EAX,04H
	MOVSX	ECX,BYTE [EBX+034H]
	OR	EAX,ECX
	MOV	BYTE [EBP-017H],AL
;
; Line 337:	regs.h.ah = 7 - d;
;
	MOV	EAX,DWORD [EBP+01CH]
	NEG	EAX
	ADD	EAX,BYTE 07H
	MOV	BYTE [EBP-01BH],AL
;
; Line 338:	regs.h.al = 1;
;
	MOV	BYTE [EBP-01CH],01H
;
; Line 339:	hide_mousecursor();
;
	CALL	_hide_mousecursor
;
; Line 340:	_int386(VIDEO, &regs, &regs);
;
	LEA	EAX,[EBP-01CH]
	PUSH	EAX
	LEA	EAX,[EBP-01CH]
	PUSH	EAX
	PUSH	BYTE 010H
	CALL	__int386
	ADD	ESP,BYTE 0CH
;
; Line 341:	show_mousecursor();
;
	CALL	_show_mousecursor
L_172:
;
; Line 343:	}
;
L_170:
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
;
; Line 346:	static void near waitforretrace(void)
;
_waitforretrace:
	PUSH	EBP
	MOV	EBP,ESP
L_178:
;
; Line 347:	{
;
;
; Line 349:	asm		mov		dx,0x3da
;
	MOV	DX,03DAH
;
; Line 350:	loop1:
;
L_174:
;
; Line 351:	asm		mov		cx,6
;
	MOV	CX,06H
;
; Line 352:	loop2:
;
L_175:
;
; Line 353:	asm		in		al,dx
;
	IN	AL,DX
;
; Line 354:	asm		test	al,8
;
	TEST	AL,08H
;
; Line 355:	asm		jnz		loop2
;
	JNZ	SHORT	L_175
;
; Line 356:	asm		test	al,1
;
	TEST	AL,01H
;
; Line 357:	asm		jz		loop2
;
	JZ	SHORT	L_175
;
; Line 358:	asm		cli
;
	CLI
;
; Line 359:	loop3:
;
L_176:
;
; Line 360:	asm		in		al,dx
;
	IN	AL,DX
;
; Line 361:	asm		test	al,1
;
	TEST	AL,01H
;
; Line 362:	asm		loopnz	loop3
;
	LOOPNZ	L_176
;
; Line 363:	asm		sti
;
	STI
;
; Line 364:	asm		jz		loop1
;
	JZ	SHORT	L_174
;
; Line 366:	}
;
L_177:
	POP	EBP
	RET
[GLOBAL	_movetoscreen]
;
; Line 368:	void movetoscreen(void *bf, int offset, int len)
;
_movetoscreen:
	PUSH	EBP
	MOV	EBP,ESP
L_180:
;
; Line 369:	{
;
;
; Line 370:	if (snowy)
;
	MOV	EAX,DWORD [_snowy]
	TEST	EAX,EAX
	JE	SHORT	L_181
;
; Line 371:	waitforretrace();
;
	CALL	_waitforretrace
L_181:
;
; Line 372:	movedata(_DS, (int)bf, video_address, offset + video_page * 16, len);
;
	PUSH	DWORD [EBP+010H]
	PUSH	DWORD [EBP+08H]
	MOV	EAX,DS
	PUSH	EAX
	MOV	EAX,DWORD [_video_page]
	SHL	EAX,04H
	ADD	EAX,DWORD [EBP+0CH]
	PUSH	EAX
	MOVZX	EAX,WORD [_video_address]
	PUSH	EAX
	CALL	_dpmi_arbitrary_copy
	ADD	ESP,BYTE 014H
;
; Line 373:	}
;
L_179:
	POP	EBP
	RET
[GLOBAL	_movefromscreen]
;
; Line 375:	void movefromscreen(void *bf, int offset, int len)
;
_movefromscreen:
	PUSH	EBP
	MOV	EBP,ESP
L_184:
;
; Line 376:	{
;
;
; Line 377:	if (snowy)
;
	MOV	EAX,DWORD [_snowy]
	TEST	EAX,EAX
	JE	SHORT	L_185
;
; Line 378:	waitforretrace();
;
	CALL	_waitforretrace
L_185:
;
; Line 379:	movedata(video_address, offset + video_page * 16,	_DS, (int)bf,	len);
;
	PUSH	DWORD [EBP+010H]
	MOV	EAX,DWORD [_video_page]
	SHL	EAX,04H
	ADD	EAX,DWORD [EBP+0CH]
	PUSH	EAX
	MOVZX	EAX,WORD [_video_address]
	PUSH	EAX
	PUSH	DWORD [EBP+08H]
	MOV	EAX,DS
	PUSH	EAX
	CALL	_dpmi_arbitrary_copy
	ADD	ESP,BYTE 014H
;
; Line 380:	}
;
L_183:
	POP	EBP
	RET
;
; Line 383:	static int near vpeek(short far *vp)
;
_vpeek:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
L_188:
;
; Line 384:	{
;
;
; Line 386:	waitforretrace();
;
	CALL	_waitforretrace
;
; Line 387:	c = *vp;
;
	LGS	EAX,[EBP+08H]
	MOVSX	EAX,WORD [GS:EAX+00H]
	MOV	EBX,EAX
;
; Line 388:	return c;
;
	MOV	EAX,EBX
L_187:
	POP	EBX
	POP	EBP
	RET
;
; Line 391:	static void near vpoke(short far *vp, int c)
;
_vpoke:
	PUSH	EBP
	MOV	EBP,ESP
L_190:
;
; Line 392:	{
;
;
; Line 393:	waitforretrace();
;
	CALL	_waitforretrace
;
; Line 394:	*vp = c;
;
	MOV	AX,WORD [EBP+010H]
	LGS	ECX,[EBP+08H]
	MOV	WORD [GS:ECX+00H],AX
;
; Line 395:	}
;
L_189:
	POP	EBP
	RET
SECTION _BSS
[GLOBAL	_ClipString]

_ClipString	RESB	04H

_snowy	RESB	04H

_video_address	RESB	04H
SECTION _CONST

SECTION _TEXT
[EXTERN	___segB800]
[EXTERN	_ClientRect]
[EXTERN	_show_mousecursor]
[EXTERN	_isVisible]
[EXTERN	_hide_mousecursor]
[EXTERN	___segB000]
[EXTERN	_isEGA]
[EXTERN	_cfg]
[EXTERN	_videomode]
[EXTERN	_video_mode]
[EXTERN	_background]
[EXTERN	_isVGA]
[EXTERN	_dpmi_arbitrary_copy]
[EXTERN	_video_page]
[EXTERN	_foreground]
[EXTERN	_subRectangle]
[EXTERN	___seg0040]
[EXTERN	__int386]
