Tnx for help, but im listing full code my programm for point locate where need clear allocated memory block.
lobal _start
section .bss
buffer resb 256
insym resb 1
outsym resb 1
part1 resb 1
part2 resb 1
readsym resb 1
count resb 1
section .data
map db '0123456789ABCDEF'
section .text
_start:
mov edi,buffer
mov bl,0
next: call read
mov al,[readsym]
cmp al,0xa
je enter
mov al,[readsym]
mov [edi],al
inc edi
cmp bl,0xff
je exit
inc bl
mov [count],bl
jmp next
enter: ; THERE NEED CLEAR TOTAL BUFFER
mov edi,buffer
mov ecx, [count] ;count syms
nsym:
mov al,[edi]
mov [insym],al
call symtohex2
inc edi
loop nsym
jmp next
exit: mov eax,1
xor ebx,ebx
int 0x80
read: pushad
mov eax,3
mov ebx,0
mov ecx,readsym
mov edx,1
int 0x80
popad
ret
view: pushad
mov eax,4
mov ebx,1
int 0x80
popad
ret
viewsym: pushad
mov eax,4
mov ebx,1
mov ecx,outsym
mov edx,1
int 0x80
popad
ret
symtohex: pushad
mov ah,[insym] ; 0010.1010 (2.a)
mov al,[insym] ; 0010.1010 (2.a)
shl ah,4 ; 1010.0000 = ah
shr ah,4 ; 0000.1010 = ah = 10 bingo lefst side found = ah
shr al,4 ; 0000.0010 = al = 2 bingo 2h
mov ebx,map
xlat ; al(2) => 2 ascii from map
mov [part1],al
mov al,ah
xlat
mov [part2],al
mov ah,[part1]
mov [outsym],ah
call viewsym
mov ah,[part2]
mov [outsym],ah
call viewsym
popad
ret
symtohex2: pushad
mov ebx,map
mov ah,[insym]
mov al,[insym]
and al,11110000b ; part1
and ah,00001111b ; part2
shr al,4
xlat ; al = map(al)
mov [outsym],al
call viewsym
mov al,ah
xlat
mov [outsym],al
call viewsym
mov al,' '
mov [outsym],al
call viewsym
popad
ret
get
./str_to_hex
tester program
74 65 73 74 65 72 20 70 72 6F 67 72 61 6D nasm
74 65 73 74 65 72 20 70 72 6F 67 72 61 6D 6E 61 73 6D
i want
./str_to_hex
tester program
74 65 73 74 65 72 20 70 72 6F 67 72 61 6D
nasm
6E 61 73 6D
and more...