	format	MS COFF
	extrn	___bb_blitz_blitz
	extrn	___bb_max2d_driver
	extrn	_bbArrayNew1D
	extrn	_bbEmptyArray
	extrn	_bbGCFree
	extrn	_bbNullObject
	extrn	_bbObjectClass
	extrn	_bbObjectCompare
	extrn	_bbObjectCtor
	extrn	_bbObjectDowncast
	extrn	_bbObjectFree
	extrn	_bbObjectNew
	extrn	_bbObjectRegisterType
	extrn	_bbObjectReserved
	extrn	_bbObjectSendMessage
	extrn	_bbObjectToString
	extrn	_brl_graphics_GraphicsSeq
	extrn	_brl_max2d__max2dDriver
	extrn	_brl_pixmap_AlphaBitsPerPixel
	extrn	_brl_pixmap_CreatePixmap
	extrn	_brl_pixmap_LoadPixmap
	extrn	_brl_pixmap_MaskPixmap
	extrn	_brl_pixmap_TPixmap
	public	___bb_max2d_image
	public	__brl_max2d_TImage_Create
	public	__brl_max2d_TImage_Delete
	public	__brl_max2d_TImage_Frame
	public	__brl_max2d_TImage_Load
	public	__brl_max2d_TImage_LoadAnim
	public	__brl_max2d_TImage_Lock
	public	__brl_max2d_TImage_New
	public	__brl_max2d_TImage_SetPixmap
	public	__brl_max2d_TImage__pad
	public	_brl_max2d_TImage
	section	"code" code
___bb_max2d_image:
	push	ebp
	mov	ebp,esp
	cmp	dword [_93],0
	je	_94
	mov	eax,0
	mov	esp,ebp
	pop	ebp
	ret
_94:
	mov	dword [_93],1
	call	___bb_blitz_blitz
	call	___bb_max2d_driver
	push	_brl_max2d_TImage
	call	_bbObjectRegisterType
	add	esp,4
	mov	eax,0
	jmp	_40
_40:
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_New:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
	push	ebx
	call	_bbObjectCtor
	add	esp,4
	mov	dword [ebx],_brl_max2d_TImage
	mov	dword [ebx+8],0
	mov	dword [ebx+12],0
	mov	dword [ebx+16],0
	mov	dword [ebx+20],0
	mov	dword [ebx+24],0
	mov	dword [ebx+28],0
	fldz
	fstp	dword [ebx+32]
	fldz
	fstp	dword [ebx+36]
	mov	eax,_bbEmptyArray
	inc	dword [eax+4]
	mov	dword [ebx+40],eax
	mov	eax,_bbEmptyArray
	inc	dword [eax+4]
	mov	dword [ebx+44],eax
	mov	eax,_bbEmptyArray
	inc	dword [eax+4]
	mov	dword [ebx+48],eax
	mov	eax,0
	jmp	_43
_43:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_Delete:
	push	ebp
	mov	ebp,esp
	push	ebx
	mov	ebx,dword [ebp+8]
_46:
	mov	eax,dword [ebx+48]
	dec	dword [eax+4]
	jnz	_100
	push	eax
	call	_bbGCFree
	add	esp,4
_100:
	mov	eax,dword [ebx+44]
	dec	dword [eax+4]
	jnz	_102
	push	eax
	call	_bbGCFree
	add	esp,4
_102:
	mov	eax,dword [ebx+40]
	dec	dword [eax+4]
	jnz	_104
	push	eax
	call	_bbGCFree
	add	esp,4
_104:
	mov	eax,0
	jmp	_98
_98:
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage__pad:
	push	ebp
	mov	ebp,esp
	mov	eax,0
	jmp	_49
_49:
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_Frame:
	push	ebp
	mov	ebp,esp
	push	ebx
	push	esi
	push	edi
	mov	ebx,dword [ebp+8]
	mov	edi,dword [ebp+12]
	mov	edx,dword [ebx+48]
	mov	eax,dword [_brl_graphics_GraphicsSeq]
	cmp	dword [edx+edi*4+24],eax
	jne	_105
	mov	eax,dword [ebx+44]
	mov	eax,dword [eax+edi*4+24]
	jmp	_53
_105:
	mov	esi,dword [_brl_max2d__max2dDriver]
	mov	eax,ebx
	push	dword [ebx+16]
	push	0
	push	1
	push	edi
	push	eax
	mov	eax,dword [eax]
	call	dword [eax+56]
	add	esp,16
	push	eax
	push	esi
	mov	eax,dword [esi]
	call	dword [eax+68]
	add	esp,12
	inc	dword [eax+4]
	mov	esi,eax
	mov	eax,dword [ebx+44]
	mov	eax,dword [eax+edi*4+24]
	dec	dword [eax+4]
	jnz	_111
	push	eax
	call	_bbGCFree
	add	esp,4
_111:
	mov	eax,dword [ebx+44]
	mov	dword [eax+edi*4+24],esi
	mov	eax,dword [ebx+44]
	cmp	dword [eax+edi*4+24],_bbNullObject
	je	_112
	mov	edx,dword [ebx+48]
	mov	eax,dword [_brl_graphics_GraphicsSeq]
	mov	dword [edx+edi*4+24],eax
	jmp	_113
_112:
	mov	eax,dword [ebx+48]
	mov	dword [eax+edi*4+24],0
_113:
	mov	eax,dword [ebx+44]
	mov	eax,dword [eax+edi*4+24]
	jmp	_53
_53:
	pop	edi
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_Lock:
	push	ebp
	mov	ebp,esp
	push	ebx
	push	esi
	push	edi
	mov	ebx,dword [ebp+8]
	mov	edi,dword [ebp+12]
	mov	eax,dword [ebp+20]
	cmp	eax,0
	je	_114
	mov	eax,dword [ebx+48]
	mov	dword [eax+edi*4+24],0
	mov	eax,_bbNullObject
	inc	dword [eax+4]
	mov	esi,eax
	mov	eax,dword [ebx+44]
	mov	eax,dword [eax+edi*4+24]
	dec	dword [eax+4]
	jnz	_118
	push	eax
	call	_bbGCFree
	add	esp,4
_118:
	mov	eax,dword [ebx+44]
	mov	dword [eax+edi*4+24],esi
_114:
	mov	eax,dword [ebx+40]
	mov	eax,dword [eax+edi*4+24]
	cmp	eax,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	jne	_119
	push	4
	push	6
	push	dword [ebx+12]
	push	dword [ebx+8]
	call	_brl_pixmap_CreatePixmap
	add	esp,16
	inc	dword [eax+4]
	mov	esi,eax
	mov	eax,dword [ebx+40]
	mov	eax,dword [eax+edi*4+24]
	dec	dword [eax+4]
	jnz	_123
	push	eax
	call	_bbGCFree
	add	esp,4
_123:
	mov	eax,dword [ebx+40]
	mov	dword [eax+edi*4+24],esi
_119:
	mov	eax,dword [ebx+40]
	mov	eax,dword [eax+edi*4+24]
	jmp	_59
_59:
	pop	edi
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_SetPixmap:
	push	ebp
	mov	ebp,esp
	push	ebx
	push	esi
	push	edi
	mov	ebx,dword [ebp+8]
	mov	edi,dword [ebp+12]
	mov	edx,dword [ebp+16]
	mov	eax,dword [ebx+16]
	and	eax,1
	cmp	eax,0
	je	_124
	mov	ecx,dword [_brl_pixmap_AlphaBitsPerPixel]
	mov	eax,dword [edx+24]
	mov	eax,dword [ecx+eax*4+24]
	cmp	eax,0
	sete	al
	movzx	eax,al
_124:
	cmp	eax,0
	je	_126
	push	dword [ebx+28]
	push	dword [ebx+24]
	push	dword [ebx+20]
	push	edx
	call	_brl_pixmap_MaskPixmap
	add	esp,16
	mov	edx,eax
_126:
	inc	dword [edx+4]
	mov	esi,edx
	mov	eax,dword [ebx+40]
	mov	eax,dword [eax+edi*4+24]
	dec	dword [eax+4]
	jnz	_130
	push	eax
	call	_bbGCFree
	add	esp,4
_130:
	mov	eax,dword [ebx+40]
	mov	dword [eax+edi*4+24],esi
	mov	eax,dword [ebx+48]
	mov	dword [eax+edi*4+24],0
	mov	eax,_bbNullObject
	inc	dword [eax+4]
	mov	esi,eax
	mov	eax,dword [ebx+44]
	mov	eax,dword [eax+edi*4+24]
	dec	dword [eax+4]
	jnz	_134
	push	eax
	call	_bbGCFree
	add	esp,4
_134:
	mov	eax,dword [ebx+44]
	mov	dword [eax+edi*4+24],esi
	mov	eax,0
	jmp	_64
_64:
	pop	edi
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_Create:
	push	ebp
	mov	ebp,esp
	push	ebx
	push	esi
	push	edi
	mov	esi,dword [ebp+12]
	mov	edi,dword [ebp+20]
	push	_brl_max2d_TImage
	call	_bbObjectNew
	add	esp,4
	mov	ebx,eax
	mov	eax,dword [ebp+8]
	mov	dword [ebx+8],eax
	mov	dword [ebx+12],esi
	mov	dword [ebx+16],edi
	mov	eax,dword [ebp+24]
	mov	dword [ebx+20],eax
	mov	eax,dword [ebp+28]
	mov	dword [ebx+24],eax
	mov	eax,dword [ebp+32]
	mov	dword [ebx+28],eax
	push	dword [ebp+16]
	push	_136
	call	_bbArrayNew1D
	add	esp,8
	mov	esi,eax
	inc	dword [esi+4]
	mov	eax,dword [ebx+40]
	dec	dword [eax+4]
	jnz	_140
	push	eax
	call	_bbGCFree
	add	esp,4
_140:
	mov	dword [ebx+40],esi
	push	dword [ebp+16]
	push	_141
	call	_bbArrayNew1D
	add	esp,8
	mov	esi,eax
	inc	dword [esi+4]
	mov	eax,dword [ebx+44]
	dec	dword [eax+4]
	jnz	_145
	push	eax
	call	_bbGCFree
	add	esp,4
_145:
	mov	dword [ebx+44],esi
	push	dword [ebp+16]
	push	_146
	call	_bbArrayNew1D
	add	esp,8
	mov	esi,eax
	inc	dword [esi+4]
	mov	eax,dword [ebx+48]
	dec	dword [eax+4]
	jnz	_150
	push	eax
	call	_bbGCFree
	add	esp,4
_150:
	mov	dword [ebx+48],esi
	mov	eax,ebx
	jmp	_73
_73:
	pop	edi
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_Load:
	push	ebp
	mov	ebp,esp
	push	ebx
	push	esi
	push	edi
	mov	esi,dword [ebp+8]
	mov	edi,dword [ebp+12]
	push	_brl_pixmap_TPixmap
	push	esi
	call	_bbObjectDowncast
	add	esp,8
	mov	ebx,eax
	cmp	ebx,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	jne	_152
	push	esi
	call	_brl_pixmap_LoadPixmap
	add	esp,4
	mov	ebx,eax
_152:
	cmp	ebx,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	jne	_153
	mov	esi,_bbNullObject
	jmp	_80
_153:
	push	dword [ebp+24]
	push	dword [ebp+20]
	push	dword [ebp+16]
	push	edi
	push	1
	push	dword [ebx+16]
	push	dword [ebx+12]
	call	dword [_brl_max2d_TImage+64]
	add	esp,28
	mov	esi,eax
	push	ebx
	push	0
	push	esi
	mov	eax,dword [esi]
	call	dword [eax+60]
	add	esp,12
	jmp	_80
_80:
	mov	eax,esi
	pop	edi
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
__brl_max2d_TImage_LoadAnim:
	push	ebp
	mov	ebp,esp
	sub	esp,8
	push	ebx
	push	esi
	push	edi
	mov	esi,dword [ebp+8]
	mov	ebx,dword [ebp+28]
	push	_brl_pixmap_TPixmap
	push	esi
	call	_bbObjectDowncast
	add	esp,8
	mov	dword [ebp-8],eax
	mov	eax,dword [ebp-8]
	cmp	eax,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	jne	_157
	push	esi
	call	_brl_pixmap_LoadPixmap
	add	esp,4
	mov	dword [ebp-8],eax
_157:
	mov	eax,dword [ebp-8]
	cmp	eax,_bbNullObject
	setne	al
	movzx	eax,al
	cmp	eax,0
	jne	_158
	mov	eax,_bbNullObject
	jmp	_91
_158:
	mov	eax,dword [ebp-8]
	mov	eax,dword [eax+12]
	cdq
	cdq
	idiv	dword [ebp+12]
	mov	edi,eax
	mov	eax,dword [ebp-8]
	mov	eax,dword [eax+16]
	cdq
	cdq
	idiv	dword [ebp+16]
	mov	ecx,dword [ebp+20]
	add	ecx,dword [ebp+24]
	mov	edx,edi
	imul	edx,eax
	cmp	ecx,edx
	jle	_161
	mov	eax,_bbNullObject
	jmp	_91
_161:
	push	dword [ebp+40]
	push	dword [ebp+36]
	push	dword [ebp+32]
	push	ebx
	push	dword [ebp+24]
	push	dword [ebp+16]
	push	dword [ebp+12]
	call	dword [_brl_max2d_TImage+64]
	add	esp,28
	mov	ebx,eax
	mov	esi,dword [ebp+20]
	mov	eax,dword [ebp+20]
	add	eax,dword [ebp+24]
	sub	eax,1
	mov	dword [ebp-4],eax
	jmp	_164
_5:
	mov	eax,esi
	cdq
	idiv	edi
	mov	eax,edx
	imul	eax,dword [ebp+12]
	mov	ecx,eax
	mov	eax,esi
	cdq
	idiv	edi
	imul	eax,dword [ebp+16]
	mov	edx,eax
	mov	eax,dword [ebp-8]
	push	dword [ebp+16]
	push	dword [ebp+12]
	push	edx
	push	ecx
	push	eax
	mov	eax,dword [eax]
	call	dword [eax+56]
	add	esp,20
	push	eax
	mov	eax,dword [eax]
	call	dword [eax+60]
	add	esp,4
	push	eax
	mov	eax,esi
	sub	eax,dword [ebp+20]
	push	eax
	push	ebx
	mov	eax,dword [ebx]
	call	dword [eax+60]
	add	esp,12
_3:
	add	esi,1
_164:
	cmp	esi,dword [ebp-4]
	jle	_5
_4:
	mov	eax,ebx
	jmp	_91
_91:
	pop	edi
	pop	esi
	pop	ebx
	mov	esp,ebp
	pop	ebp
	ret
	section	"data" data writeable align 8
	align	4
_93:
	dd	0
_7:
	db	"TImage",0
_8:
	db	"width",0
_9:
	db	"i",0
_10:
	db	"height",0
_11:
	db	"flags",0
_12:
	db	"mask_r",0
_13:
	db	"mask_g",0
_14:
	db	"mask_b",0
_15:
	db	"handle_x",0
_16:
	db	"f",0
_17:
	db	"handle_y",0
_18:
	db	"pixmaps",0
_19:
	db	"[]:TPixmap",0
_20:
	db	"frames",0
_21:
	db	"[]:TImageFrame",0
_22:
	db	"seqs",0
_23:
	db	"[]i",0
_24:
	db	"New",0
_25:
	db	"()i",0
_26:
	db	"Delete",0
_27:
	db	"_pad",0
_28:
	db	"Frame",0
_29:
	db	"(i):TImageFrame",0
_30:
	db	"Lock",0
_31:
	db	"(i,i,i):TPixmap",0
_32:
	db	"SetPixmap",0
_33:
	db	"(i,:TPixmap)i",0
_34:
	db	"Create",0
_35:
	db	"(i,i,i,i,i,i,i):TImage",0
_36:
	db	"Load",0
_37:
	db	"(:Object,i,i,i,i):TImage",0
_38:
	db	"LoadAnim",0
_39:
	db	"(:Object,i,i,i,i,i,i,i,i):TImage",0
	align	4
_6:
	dd	2
	dd	_7
	dd	3
	dd	_8
	dd	_9
	dd	8
	dd	3
	dd	_10
	dd	_9
	dd	12
	dd	3
	dd	_11
	dd	_9
	dd	16
	dd	3
	dd	_12
	dd	_9
	dd	20
	dd	3
	dd	_13
	dd	_9
	dd	24
	dd	3
	dd	_14
	dd	_9
	dd	28
	dd	3
	dd	_15
	dd	_16
	dd	32
	dd	3
	dd	_17
	dd	_16
	dd	36
	dd	3
	dd	_18
	dd	_19
	dd	40
	dd	3
	dd	_20
	dd	_21
	dd	44
	dd	3
	dd	_22
	dd	_23
	dd	48
	dd	6
	dd	_24
	dd	_25
	dd	16
	dd	6
	dd	_26
	dd	_25
	dd	20
	dd	6
	dd	_27
	dd	_25
	dd	48
	dd	6
	dd	_28
	dd	_29
	dd	52
	dd	6
	dd	_30
	dd	_31
	dd	56
	dd	6
	dd	_32
	dd	_33
	dd	60
	dd	7
	dd	_34
	dd	_35
	dd	64
	dd	7
	dd	_36
	dd	_37
	dd	68
	dd	7
	dd	_38
	dd	_39
	dd	72
	dd	0
	align	4
_brl_max2d_TImage:
	dd	_bbObjectClass
	dd	_bbObjectFree
	dd	_6
	dd	52
	dd	__brl_max2d_TImage_New
	dd	__brl_max2d_TImage_Delete
	dd	_bbObjectToString
	dd	_bbObjectCompare
	dd	_bbObjectSendMessage
	dd	_bbObjectReserved
	dd	_bbObjectReserved
	dd	_bbObjectReserved
	dd	__brl_max2d_TImage__pad
	dd	__brl_max2d_TImage_Frame
	dd	__brl_max2d_TImage_Lock
	dd	__brl_max2d_TImage_SetPixmap
	dd	__brl_max2d_TImage_Create
	dd	__brl_max2d_TImage_Load
	dd	__brl_max2d_TImage_LoadAnim
_136:
	db	":TPixmap",0
_141:
	db	":TImageFrame",0
_146:
	db	"i",0
