	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 cstartup align=4 CLASS=INITDATA USE32
	SECTION crundown align=4 CLASS=EXITDATA USE32
	SECTION cppinit  align=4 CLASS=CPPINIT USE32
	SECTION cppexit  align=4 CLASS=CPPEXIT USE32
	GROUP DGROUP _DATA _BSS _CONST _STRING

SECTION _TEXT
[GLOBAL	_SpinButtonProc]
;
; Line 5:	int SpinButtonProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
;
_SpinButtonProc:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+08H]
	MOV	EBX,DWORD [EBP+010H]
L_2:
;
; Line 6:	{
;
;
; Line 8:	CTLWINDOW *ct = GetControl(wnd);
;
	MOV	EAX,DWORD [ESI+0108H]
	MOV	DWORD [EBP-04H],EAX
;
; Line 9:	if (ct != NULL)    {
;
	CMP	DWORD [EBP-04H],BYTE 00H
	JE	NEAR	L_3
;
; Line 10:	switch (msg)    {
;
	MOV	EAX,DWORD [EBP+0CH]
	CMP	EAX,BYTE 09H
	JE	NEAR	L_9
	JA	SHORT	L_12
	CMP	EAX,BYTE 08H
	JE	SHORT	L_8
	JA	NEAR	L_6
	CMP	EAX,BYTE 03H
	JE	SHORT	L_7
	JMP	NEAR	L_6
L_12:
	CMP	EAX,BYTE 044H
	JE	NEAR	L_11
	JA	NEAR	L_6
	CMP	EAX,BYTE 024H
	JE	NEAR	L_10
	JMP	NEAR	L_6
L_7:
;
; Line 12:	wnd->wd -= 2;
;
	SUB	DWORD [ESI+020H],BYTE 02H
;
; Line 13:	wnd->rc.rt -= 2;
;
	SUB	DWORD [ESI+014H],BYTE 02H
;
; Line 14:	break;
;
	JMP	NEAR	L_5
L_8:
;
; Line 16:	rtn = BaseWndProc(SPINBUTTON, wnd, msg, p1, p2);
;
	PUSH	DWORD [EBP+014H]
	PUSH	EBX
	MOVSX	EAX,WORD [EBP+0CH]
	PUSH	EAX
	PUSH	ESI
	MOV	EAX,DWORD [_classdefs+0C0H]
	IMUL	EAX,BYTE 0CH
	CALL	DWORD [EAX+04H+_classdefs+00H]
	ADD	ESP,BYTE 010H
	MOV	EDI,EAX
;
; Line 17:	if (!(int)p1)
;
	TEST	EBX,EBX
	JNE	SHORT	L_13
;
; Line 18:	SendMessage(NULL, HIDE_CURSOR, 0, 0);
;
	PUSH	BYTE 00H
	PUSH	BYTE 00H
	PUSH	BYTE 01AH
	PUSH	BYTE 00H
	CALL	_SendMessage
	ADD	ESP,BYTE 010H
L_13:
;
; Line 19:	SetFocusCursor(wnd);
;
	PUSH	ESI
	CALL	_SetFocusCursor
	POP	ECX
;
; Line 20:	return rtn;
;
	MOV	EAX,EDI
	JMP	NEAR	L_1
L_9:
;
; Line 22:	foreground = WndBackground(wnd);
;
	MOVSX	EAX,BYTE [ESI+035H]
	MOV	DWORD [_foreground],EAX
;
; Line 23:	background = WndForeground(wnd);
;
	MOVSX	EAX,BYTE [ESI+034H]
	MOV	DWORD [_background],EAX
;
; Line 24:	wputch(wnd,UPSCROLLBOX,WindowWidth(wnd), 0);
;
	PUSH	BYTE 00H
	PUSH	DWORD [ESI+020H]
	PUSH	BYTE 01EH
	PUSH	ESI
	CALL	_wputch
	ADD	ESP,BYTE 010H
;
; Line 25:	wputch(wnd,DOWNSCROLLBOX,WindowWidth(wnd)+1,0);
;
	PUSH	BYTE 00H
	MOV	EAX,DWORD [ESI+020H]
	INC	EAX
	PUSH	EAX
	PUSH	BYTE 01FH
	PUSH	ESI
	CALL	_wputch
	ADD	ESP,BYTE 010H
;
; Line 26:	SetFocusCursor(wnd);
;
	PUSH	ESI
	CALL	_SetFocusCursor
	POP	ECX
;
; Line 27:	break;
;
	JMP	NEAR	L_5
L_10:
;
; Line 29:	if (p1 == GetRight(wnd) + 1)
;
	MOV	EAX,DWORD [ESI+014H]
	INC	EAX
	CMP	EBX,EAX
	JNE	SHORT	L_15
;
; Line 30:	SendMessage(wnd, KEYBOARD, UP, 0);
;
	PUSH	BYTE 00H
	PUSH	DWORD 010C8H
	PUSH	BYTE 015H
	PUSH	ESI
	CALL	_SendMessage
	ADD	ESP,BYTE 010H
	JMP	SHORT	L_16
L_15:
;
; Line 31:	else if (p1 == GetRight(wnd) + 2)
;
	MOV	EAX,DWORD [ESI+014H]
	ADD	EAX,BYTE 02H
	CMP	EBX,EAX
	JNE	SHORT	L_17
;
; Line 32:	SendMessage(wnd, KEYBOARD, DN, 0);
;
	PUSH	BYTE 00H
	PUSH	DWORD 010D0H
	PUSH	BYTE 015H
	PUSH	ESI
	CALL	_SendMessage
	ADD	ESP,BYTE 010H
L_17:
L_16:
;
; Line 33:	if (wnd != inFocus)
;
	CMP	ESI,DWORD [_inFocus]
	JE	SHORT	L_19
;
; Line 34:	SendMessage(wnd, SETFOCUS, TRUE, 0);
;
	PUSH	BYTE 00H
	PUSH	BYTE 01H
	PUSH	BYTE 08H
	PUSH	ESI
	CALL	_SendMessage
	ADD	ESP,BYTE 010H
L_19:
;
; Line 35:	return TRUE;
;
	MOV	EAX,01H
	JMP	SHORT	L_1
L_11:
;
; Line 37:	rtn = BaseWndProc(SPINBUTTON, wnd, msg, p1, p2);
;
	PUSH	DWORD [EBP+014H]
	PUSH	EBX
	MOVSX	EAX,WORD [EBP+0CH]
	PUSH	EAX
	PUSH	ESI
	MOV	EAX,DWORD [_classdefs+0C0H]
	IMUL	EAX,BYTE 0CH
	CALL	DWORD [EAX+04H+_classdefs+00H]
	ADD	ESP,BYTE 010H
	MOV	EDI,EAX
;
; Line 38:	wnd->wtop = (int) p1;
;
	MOV	DWORD [ESI+094H],EBX
;
; Line 39:	SendMessage(wnd, PAINT, 0, 0);
;
	PUSH	BYTE 00H
	PUSH	BYTE 00H
	PUSH	BYTE 09H
	PUSH	ESI
	CALL	_SendMessage
	ADD	ESP,BYTE 010H
;
; Line 40:	return rtn;
;
	MOV	EAX,EDI
	JMP	SHORT	L_1
L_6:
;
; Line 42:	break;
;
	JMP	SHORT	L_5
L_5:
L_3:
;
; Line 45:	return BaseWndProc(SPINBUTTON, wnd, msg, p1, p2);
;
	PUSH	DWORD [EBP+014H]
	PUSH	EBX
	MOVSX	EAX,WORD [EBP+0CH]
	PUSH	EAX
	PUSH	ESI
	MOV	EAX,DWORD [_classdefs+0C0H]
	IMUL	EAX,BYTE 0CH
	CALL	DWORD [EAX+04H+_classdefs+00H]
	ADD	ESP,BYTE 010H
L_1:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
SECTION _CONST

SECTION _TEXT
[EXTERN	_wputch]
[EXTERN	_inFocus]
[EXTERN	_background]
[EXTERN	_foreground]
[EXTERN	_classdefs]
[EXTERN	_SetFocusCursor]
[EXTERN	_SendMessage]
