	format	MS COFF
	extrn	___bb_blitz_blitz
	extrn	___bb_system_system
	extrn	_bbArrayNew1D
	extrn	_bbEmptyArray
	extrn	_bbGCFree
	extrn	_bbNullObject
	extrn	_bbObjectDowncast
	extrn	_brl_event_EmitEventHook
	extrn	_brl_event_TEvent
	extrn	_brl_hook_AddHook
	extrn	_brl_hook_RemoveHook
	extrn	_brl_system_PollSystem
	extrn	_brl_system_WaitSystem
	public	___bb_polledinput_polledinput
	public	_brl_polledinput_AppSuspended
	public	_brl_polledinput_AppTerminate
	public	_brl_polledinput_DisablePolledInput
	public	_brl_polledinput_EnablePolledInput
	public	_brl_polledinput_FlushKeys
	public	_brl_polledinput_FlushMouse
	public	_brl_polledinput_GetChar
	public	_brl_polledinput_KeyDown
	public	_brl_polledinput_KeyHit
	public	_brl_polledinput_MouseDown
	public	_brl_polledinput_MouseHit
	public	_brl_polledinput_MouseX
	public	_brl_polledinput_MouseXSpeed
	public	_brl_polledinput_MouseY
	public	_brl_polledinput_MouseYSpeed
	public	_brl_polledinput_MouseZ
	public	_brl_polledinput_MouseZSpeed
	public	_brl_polledinput_SetAutoPoll
	public	_brl_polledinput_WaitChar
	public	_brl_polledinput_WaitKey
	public	_brl_polledinput_WaitMouse
	section	"code" code
___bb_polledinput_polledinput:
	push	ebp
	mov	ebp,esp
	cmp	dword [_116],0
	je	_117
	mov	eax,0
	mov	esp,ebp
	pop	ebp
	ret
_117:
	mov	dword [_116],1
	call	___bb_blitz_blitz
	call	___bb_system_system
	mov	eax,dword [_88]
	and	eax,1
	cmp	eax,0
	jne	_89
	push	256
	push	_85
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_86],eax
	or	dword [_88],1
_89:
	mov	eax,dword [_88]
	and	eax,2
	cmp	eax,0
	jne	_93
	push	256
	push	_90
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_91],eax
	or	dword [_88],2
_93:
	mov	eax,dword [_88]
	and	eax,4
	cmp	eax,0
	jne	_99
	push	256
	push	_96
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_97],eax
	or	dword [_88],4
_99:
	mov	eax,dword [_88]
	and	eax,8
	cmp	eax,0
	jne	_103
	push	4
	push	_100
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_101],eax
	or	dword [_88],8
_103:
	mov	eax,dword [_88]
	and	eax,16
	cmp	eax,0
	jne	_107
	push	4
	push	_104
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_105],eax
	or	dword [_88],16
_107:
	mov	eax,dword [_88]
	and	eax,32
	cmp	eax,0
	jne	_111
	push	4
	push	_108
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_109],eax
	or	dword [_88],32
_111:
	mov	eax,dword [_88]
	and	eax,64
	cmp	eax,0
	jne	_115
	push	4
	push	_112
	call	_bbArrayNew1D
	add	esp,8
	inc	dword [eax+4]
	mov	dword [_113],eax
	or	dword [_88],64
_115:
	mov	eax,0
	jmp	_25
_25:
	mov	esp,ebp
	pop	ebp
	ret
_3:
	push	ebp
	mov	ebp,esp
	push	ebx
	push	esi
	mov	ebx,dword [ebp+12]
	push	_brl_event_TEvent
	push	ebx
	call	_bbObjectDowncast
	add	esp,8
	mov	edx,eax
	cmp	edx,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	jne	_119
	mov	eax,ebx
	jmp	_30
_119:
	mov	eax,dword [_82]
	cmp	eax,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	je	_120
	mov	eax,dword [_82]
	cmp	eax,dword [edx+12]
	setne	al
	movzx	eax,al
_120:
	cmp	eax,0
	je	_122
	mov	eax,ebx
	jmp	_30
_122:
	mov	eax,dword [edx+8]
	cmp	eax,513
	je	_125
	cmp	eax,514
	je	_126
	cmp	eax,515
	je	_127
	cmp	eax,1025
	je	_128
	cmp	eax,1026
	je	_129
	cmp	eax,1027
	je	_130
	cmp	eax,1028
	je	_131
	cmp	eax,257
	je	_132
	cmp	eax,258
	je	_133
	cmp	eax,259
	je	_134
	jmp	_124
_125:
	mov	ecx,dword [_86]
	mov	eax,dword [edx+16]
	cmp	dword [ecx+eax*4+24],0
	jne	_135
	mov	ecx,dword [_86]
	mov	eax,dword [edx+16]
	mov	dword [ecx+eax*4+24],1
	mov	esi,dword [_91]
	mov	ecx,dword [edx+16]
	mov	eax,dword [_91]
	mov	edx,dword [edx+16]
	mov	eax,dword [eax+edx*4+24]
	add	eax,1
	mov	dword [esi+ecx*4+24],eax
_135:
	jmp	_124
_126:
	mov	ecx,dword [_86]
	mov	eax,dword [edx+16]
	mov	dword [ecx+eax*4+24],0
	jmp	_124
_127:
	mov	eax,dword [_95]
	sub	eax,dword [_94]
	cmp	eax,256
	jge	_136
	mov	esi,dword [_97]
	mov	ecx,dword [_95]
	and	ecx,255
	mov	eax,dword [edx+16]
	mov	dword [esi+ecx*4+24],eax
	add	dword [_95],1
_136:
	jmp	_124
_128:
	mov	ecx,dword [_101]
	mov	eax,dword [edx+16]
	cmp	dword [ecx+eax*4+24],0
	jne	_137
	mov	ecx,dword [_101]
	mov	eax,dword [edx+16]
	mov	dword [ecx+eax*4+24],1
	mov	esi,dword [_105]
	mov	ecx,dword [edx+16]
	mov	eax,dword [_105]
	mov	edx,dword [edx+16]
	mov	eax,dword [eax+edx*4+24]
	add	eax,1
	mov	dword [esi+ecx*4+24],eax
_137:
	jmp	_124
_129:
	mov	ecx,dword [_101]
	mov	eax,dword [edx+16]
	mov	dword [ecx+eax*4+24],0
	jmp	_124
_130:
	mov	ecx,dword [_109]
	mov	eax,dword [edx+24]
	mov	dword [ecx+24],eax
	mov	ecx,dword [_109]
	mov	eax,dword [edx+28]
	mov	dword [ecx+4+24],eax
	jmp	_124
_131:
	mov	ecx,dword [_109]
	mov	eax,dword [_109]
	mov	eax,dword [eax+8+24]
	add	eax,dword [edx+16]
	mov	dword [ecx+8+24],eax
	jmp	_124
_132:
	call	_brl_polledinput_FlushKeys
	call	_brl_polledinput_FlushMouse
	mov	dword [_83],1
	jmp	_124
_133:
	call	_brl_polledinput_FlushKeys
	call	_brl_polledinput_FlushMouse
	mov	dword [_83],0
	jmp	_124
_134:
	mov	dword [_84],1
	jmp	_124
_124:
	mov	eax,ebx
	jmp	_30
_30:
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_EnablePolledInput:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
	cmp	dword [_80],0
	je	_138
	mov	eax,0
	jmp	_33
_138:
	inc	dword [ebx+4]
	mov	eax,dword [_82]
	dec	dword [eax+4]
	jnz	_142
	push	eax
	call	_bbGCFree
	add	esp,4
_142:
	mov	dword [_82],ebx
	call	_brl_polledinput_FlushKeys
	call	_brl_polledinput_FlushMouse
	push	0
	push	_bbNullObject
	push	_3
	push	dword [_brl_event_EmitEventHook]
	call	_brl_hook_AddHook
	add	esp,16
	mov	dword [_80],1
	mov	eax,0
	jmp	_33
_33:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_DisablePolledInput:
	push	ebp
	mov	ebp,esp
	push	ebx
	cmp	dword [_80],0
	jne	_143
	mov	eax,0
	jmp	_35
_143:
	push	_bbNullObject
	push	_3
	push	dword [_brl_event_EmitEventHook]
	call	_brl_hook_RemoveHook
	add	esp,12
	call	_brl_polledinput_FlushKeys
	call	_brl_polledinput_FlushMouse
	mov	ebx,_bbNullObject
	inc	dword [ebx+4]
	mov	eax,dword [_82]
	dec	dword [eax+4]
	jnz	_147
	push	eax
	call	_bbGCFree
	add	esp,4
_147:
	mov	dword [_82],ebx
	mov	dword [_80],0
	mov	eax,0
	jmp	_35
_35:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_AppSuspended:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_148
	call	_brl_system_PollSystem
_148:
	mov	eax,dword [_83]
	jmp	_37
_37:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_AppTerminate:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_149
	call	_brl_system_PollSystem
_149:
	mov	eax,dword [_84]
	mov	dword [_84],0
	jmp	_39
_39:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_KeyHit:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
	cmp	dword [_81],0
	je	_151
	call	_brl_system_PollSystem
_151:
	mov	eax,dword [_91]
	mov	eax,dword [eax+ebx*4+24]
	mov	edx,dword [_91]
	mov	dword [edx+ebx*4+24],0
	jmp	_42
_42:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_KeyDown:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
	cmp	dword [_81],0
	je	_153
	call	_brl_system_PollSystem
_153:
	mov	eax,dword [_86]
	mov	eax,dword [eax+ebx*4+24]
	jmp	_45
_45:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_GetChar:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_154
	call	_brl_system_PollSystem
_154:
	mov	eax,dword [_95]
	cmp	dword [_94],eax
	jne	_155
	mov	eax,0
	jmp	_47
_155:
	mov	edx,dword [_97]
	mov	eax,dword [_94]
	and	eax,255
	mov	eax,dword [edx+eax*4+24]
	add	dword [_94],1
	jmp	_47
_47:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_FlushKeys:
	push	ebp
	mov	ebp,esp
	call	_brl_system_PollSystem
	mov	dword [_94],0
	mov	dword [_95],0
	mov	edx,0
	jmp	_158
_6:
	mov	eax,dword [_86]
	mov	dword [eax+edx*4+24],0
	mov	eax,dword [_91]
	mov	dword [eax+edx*4+24],0
_4:
	add	edx,1
_158:
	cmp	edx,256
	jl	_6
_5:
	mov	eax,0
	jmp	_49
_49:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseX:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_159
	call	_brl_system_PollSystem
_159:
	mov	eax,dword [_109]
	mov	eax,dword [eax+24]
	jmp	_51
_51:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseY:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_160
	call	_brl_system_PollSystem
_160:
	mov	eax,dword [_109]
	mov	eax,dword [eax+4+24]
	jmp	_53
_53:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseZ:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_161
	call	_brl_system_PollSystem
_161:
	mov	eax,dword [_109]
	mov	eax,dword [eax+8+24]
	jmp	_55
_55:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseXSpeed:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_162
	call	_brl_system_PollSystem
_162:
	mov	eax,dword [_109]
	mov	eax,dword [eax+24]
	mov	edx,dword [_113]
	sub	eax,dword [edx+24]
	mov	ecx,dword [_113]
	mov	edx,dword [_109]
	mov	edx,dword [edx+24]
	mov	dword [ecx+24],edx
	jmp	_57
_57:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseYSpeed:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_164
	call	_brl_system_PollSystem
_164:
	mov	eax,dword [_109]
	mov	eax,dword [eax+4+24]
	mov	edx,dword [_113]
	sub	eax,dword [edx+4+24]
	mov	ecx,dword [_113]
	mov	edx,dword [_109]
	mov	edx,dword [edx+4+24]
	mov	dword [ecx+4+24],edx
	jmp	_59
_59:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseZSpeed:
	push	ebp
	mov	ebp,esp
	cmp	dword [_81],0
	je	_166
	call	_brl_system_PollSystem
_166:
	mov	eax,dword [_109]
	mov	eax,dword [eax+8+24]
	mov	edx,dword [_113]
	sub	eax,dword [edx+8+24]
	mov	ecx,dword [_113]
	mov	edx,dword [_109]
	mov	edx,dword [edx+8+24]
	mov	dword [ecx+8+24],edx
	jmp	_61
_61:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_FlushMouse:
	push	ebp
	mov	ebp,esp
	call	_brl_system_PollSystem
	mov	edx,0
	jmp	_169
_9:
	mov	eax,dword [_101]
	mov	dword [eax+edx*4+24],0
	mov	eax,dword [_105]
	mov	dword [eax+edx*4+24],0
_7:
	add	edx,1
_169:
	cmp	edx,4
	jl	_9
_8:
	mov	eax,dword [_109]
	mov	dword [eax+8+24],0
	mov	eax,0
	jmp	_63
_63:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseHit:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
	cmp	dword [_81],0
	je	_170
	call	_brl_system_PollSystem
_170:
	mov	eax,dword [_105]
	mov	eax,dword [eax+ebx*4+24]
	mov	edx,dword [_105]
	mov	dword [edx+ebx*4+24],0
	jmp	_66
_66:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_MouseDown:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
	cmp	dword [_81],0
	je	_172
	call	_brl_system_PollSystem
_172:
	mov	eax,dword [_101]
	mov	eax,dword [eax+ebx*4+24]
	jmp	_69
_69:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_WaitKey:
	push	ebp
	mov	ebp,esp
	push	ebx
	call	_brl_polledinput_FlushKeys
_12:
_10:
	call	_brl_system_WaitSystem
	mov	ebx,1
	jmp	_174
_15:
	push	ebx
	call	_brl_polledinput_KeyHit
	add	esp,4
	cmp	eax,0
	je	_175
	mov	eax,ebx
	jmp	_71
_175:
_13:
	add	ebx,1
_174:
	cmp	ebx,255
	jle	_15
_14:
	jmp	_12
_71:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_WaitChar:
	push	ebp
	mov	ebp,esp
	call	_brl_polledinput_FlushKeys
_18:
_16:
	call	_brl_system_WaitSystem
	call	_brl_polledinput_GetChar
	cmp	eax,0
	je	_177
	jmp	_73
_177:
	jmp	_18
_73:
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_WaitMouse:
	push	ebp
	mov	ebp,esp
	push	ebx
	call	_brl_polledinput_FlushMouse
_21:
_19:
	call	_brl_system_WaitSystem
	mov	ebx,1
	jmp	_179
_24:
	push	ebx
	call	_brl_polledinput_MouseHit
	add	esp,4
	cmp	eax,0
	je	_180
	mov	eax,ebx
	jmp	_75
_180:
_22:
	add	ebx,1
_179:
	cmp	ebx,3
	jle	_24
_23:
	jmp	_21
_75:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
_brl_polledinput_SetAutoPoll:
	push	ebp
	mov	ebp,esp
	mov	eax,dword [ebp+8]
	mov	dword [_81],eax
	mov	eax,0
	jmp	_78
_78:
	mov	esp,ebp
	pop	ebp
	ret
	section	"data" data writeable align 8
	align	4
_116:
	dd	0
	align	4
_80:
	dd	0
	align	4
_81:
	dd	1
	align	4
_82:
	dd	_bbNullObject
	align	4
_83:
	dd	0
	align	4
_84:
	dd	0
	align	4
_88:
	dd	0
_85:
	db	"i",0
	align	4
_86:
	dd	_bbEmptyArray
_90:
	db	"i",0
	align	4
_91:
	dd	_bbEmptyArray
	align	4
_94:
	dd	0
	align	4
_95:
	dd	0
_96:
	db	"i",0
	align	4
_97:
	dd	_bbEmptyArray
_100:
	db	"i",0
	align	4
_101:
	dd	_bbEmptyArray
_104:
	db	"i",0
	align	4
_105:
	dd	_bbEmptyArray
_108:
	db	"i",0
	align	4
_109:
	dd	_bbEmptyArray
_112:
	db	"i",0
	align	4
_113:
	dd	_bbEmptyArray
