cur@@Reg1 equ dl
cur@@Reg2 equ edx
hextxt2int:       
        xor     eax,eax
        ;mov     esi,[lpStr]
.str2hex_loop:
        movsx   cur@@Reg2,byte [esi]
        or      cur@@Reg1,20h
        cmp     cur@@Reg1,'0'
        jb      .str2hex_ret
        cmp     cur@@Reg1,'9'
        ja      .str2hex_1
        sub     cur@@Reg1,'0'
        jmp     .str2hex_calc
.str2hex_1:
        cmp     cur@@Reg1,'a'
        jb      .str2hex_ret
        cmp     cur@@Reg1,'f'
        ja      .str2hex_ret
        sub     cur@@Reg1,('a'-10)
.str2hex_calc:
        shl     eax,4
        add     eax,cur@@Reg2
        inc     esi
        jmp     .str2hex_loop

.str2hex_ret:
        ret
getColors:
   .up0:   call hextxt2int
           mov  [ebx],eax
           add  ebx,4
   .upp:   inc  esi
           cmp  byte [esi],10
           ja   .upp
           inc  esi
cmp  word [esi],'..'
jnz @f
add esi,4
mov ebx,ClrTxtFedit
@@:
           cmp  byte [esi],0
           jnz  .up0 
           ret

;edx=zbuf
;eax=filename
rbait       dd 0
flen        dd 0,0,0,0
filename    dd 0
fhand       dd 0
nameMesh    dd 0
obj3Dset1   dd 0
txterror    db "Fille not found.",0
LoadFile:
             push    edx
             mov     [rbait],0
             mov     [filename],eax
             invoke CreateFile,eax,GENERIC_READ,3,0,OPEN_EXISTING,FILE_ATTRIBUTE_READONLY,0 ;NORMAL,0
             mov    [fhand],eax
             invoke GetFileSizeEx,[fhand],flen
             pop    edx
             invoke ReadFile,[fhand],edx,[flen],rbait,0
             invoke CloseHandle,[fhand]
             mov    eax,[rbait]
             and    eax,eax
             jnz    PLoadFileOK
             mov     eax,[filename]
             invoke  MessageBox, 0, eax, txterror,MB_OK or MB_ICONERROR
PLoadFileOK: mov edx,[rbait]
		ret

getUserFileRGBColors:
	   mov  edx,zbuf
           mov  eax,fileUsrRGB
           call LoadFile
	mov dword [edx+zbuf],0
           mov  esi,zbuf
           mov  ebx,asm_syntax_colors
           call getColors 
		ret