	.data
tab_modules:	dd 64 dup ?
ptr_modules	dd ?
	
	.code

init_registering:
	mov eax,tab_modules
	mov d fs:ptr_modules,eax
	ret

; This will deinitialize started modules when terminating TMA.

; In:	EAX	Function addr, segment will be global FS
register_module:
	pushad
	mov es,fs
	mov edi,ptr_modules
	cld
	stosd
	mov tab_modules,edi
	popad
	ret

destroy:pushad
	pushf
	mov ds,fs
	std
	mov esi,ptr_modules
l1:	lodsd
	push esi,ds
	fs:call eax
	pop ds,esi
	std
	cmp esi,tab_modules
	jne l1
	popf
	popad
	ret

