BgnProcsPool = 10000
macro runPool n,[fun=0] {

match a:b,fun \{ 
mov ebp,dword [scriptPool.poolsTab+n*4]
mov dword [ebp+BgnProcsPool+b*4],a
 
\}
common
local .ee1
        mov ebp,dword [scriptPool.poolsTab+n*4]
        test ebp,ebp
        jz .ee1
        call ebp
.ee1:
}
BgnDataSlotsPool = 11000
scriptPool:     ;mov edi,.poolsTab
                mov eax,[scriptSlots.poolsection]
                test eax,eax
                jz @f
.0:             movsd xmm0,qword [eax-2]
                movsd qword [.pp],xmm0
                movzx ebx,byte [eax-2]
                sub bl,48
                lea edi,[.poolsTab+ebx*4]
;alloc mem
                push  eax
                invoke  VirtualAlloc,0,2048*6,MEM_COMMIT,PAGE_READWRITE
                mov     dword [edi],eax
                mov     dword [.curAllocPool],eax

                mov byte [eax],0xC3     ;ret
invoke VirtualProtect,eax, 2048*6, PAGE_EXECUTE_READWRITE,s!c!Buffer
                ;add    edi,4
                pop   eax 
                cmp byte [eax-2],';'
                jnz .1
@@:             ret
.1:     inc eax
        cmp byte [eax],0
        jz .exit
        cmdInit '..',.exit,'#s',.set2List,'#f',.loadbinProc,'#d',.loadbinData,'#e',.BgnDataElement2EBX,'#g',.getDataPool
        jmp .1
.exit:
                DbgScriptInfa .scriptok
        cmp word [eax],'..'
        jnz @f
.xx:    inc eax
        cmp byte [eax],0
        jz  @f
        cmp dword [eax],'@@po'
        jnz .xx
        mov [.ofst],0
        mov dword [.curAllocPool+4],0
        inc eax
        jmp .0
@@:
ret
.getDataPool:
	lea ebx,[eax+2]
        mov esi,initBuffer2
        push eax
        call mygetDigs
          cvtss2si eax,[initBuffer2]
	mov eax,dword [scriptPool.poolsTab+eax*4]
	cvtss2si edx,[initBuffer2+4]    ;index elementa for ebx
	shl edx,2
	mov eax,[eax+BgnDataSlotsPool+edx]
	mov ecx,[.curAllocPool]
	add ecx,dword [.curAllocPool+4]
	add dword [.curAllocPool+4],4
	mov [ecx+BgnDataSlotsPool],eax
	pop eax
	jmp .1
.loadbinData:
        mov byte [load.allocMode],1
        lea ebx,[eax+4]
        copyTxt@ ebx,s!c!Buffer,"'"
        push eax
        mov eax,s!c!Buffer
        call pc@LoadFile
mov eax,[dataAllocPtr@]
mov ecx,[.curAllocPool]
add ecx,dword [.curAllocPool+4]
add dword [.curAllocPool+4],4
mov [ecx+BgnDataSlotsPool],eax
        pop eax
        mov byte [load.allocMode],0
        jmp .1
.loadbinProc: lea ebx,[eax+4]
        copyTxt@ ebx,s!c!Buffer,"'"
        push eax
        ;puMsg Buffer ;ebx
        mov edx,[edi]
        add edx,[.ofst]
;esi +ofst
;mov byte [edx],0xBE
;mov eax,[.ofst]
;add eax,5
;mov [edx+1],eax
;add edx,5
;-----

        mov eax,s!c!Buffer
        call pc@LoadFile
;---ofst
        mov edx,[.ofst]
        mov eax,edx
        add edx,[edi]
        mov dword [edx+2],eax
;---
        pop eax
        jmp .1

.BgnDataElement2EBX:
	lea ebx,[eax+2]
        mov esi,initBuffer2
        push eax
        call mygetDigs
          cvtss2si eax,[initBuffer2]    
          xor ebx,ebx
        call getSSlot
cvtss2si eax,[initBuffer2+4]    ;index elementa for ebx
shl eax,3
add edx,eax
mov edx,[edx]
        
	mov eax,[edi]   ;-4]
        add eax,[.ofst]
        add dword [.ofst],5
	mov byte [eax],0xbb
	mov dword [eax+1],edx
pop eax
	jmp .1
.set2List: lea ebx,[eax+2]
        mov esi,initBuffer2
        push eax
        call mygetDigs
          cvtss2si eax,[initBuffer2]    
          xor ebx,ebx
        call getSSlot
cvtss2si eax,[initBuffer2+8]    ;index elementa for proc
mov dword [initBuffer2+8],0
shl eax,3
add edx,eax
        mov dword [.asmbc+1],edx
pop eax
cvtss2si ecx,[initBuffer2+4]
mov edx,[scriptInit.p@TabProcs]
mov edx,[edx+ecx*4]
test edx,edx
jz .1
mov dword [.asmbc+6],edx
        movups xmm0,xword [.asmbc]
        mov edx,[edi]   ;-4]
        add edx,[.ofst]
        add dword [.ofst],12
        movups xword [edx],xmm0
;call edx
        jmp .1
.ofst   dd 0
.asmbc  db 0x68,0,0,0,0 ;push address
        db 0xBB,0,0,0,0 ;mov ebx,value
        dd 0x00C3D3FF   ;call ebx & ret
.curAllocPool dd 0,0
.poolsTab dd 20 dup(0)
.scriptok db 'script pool ok: '
.pp db 9 dup(0) 