Convert string into ascii code, in nasm

0

I'm trying to make a program that converts a string entered by the user into a string with the corresponding ascii codes.

But when I run the program the following error appears:

  

Floating point exception

Also when debugging in gdb I noticed that the values of the al and ah registers are not being copied to buf_code .

The program is to run on linux. This is my code:

section .bss
    buf_symb: RESB 80     ;buffer com a string digitada pelo usuário
    buf_code: RESB 240    ;buffer com os códigos ascii

section .data
    str: db "Enter a string: "
    str_len: equ $-str

section .text
    global _start

_start:
    mov eax, 4
    mov ebx, 1
    mov ecx, str
    mov edx, str_len
    int 80h

    mov eax, 3
    mov ebx, 2
    mov ecx, buf_symb
    mov edx, 80
    int 80h

    mov esi, buf_symb
    mov ebx, buf_code
    mov bl, 10

    continue:
        movzx edx, BYTE [esi]
        cmp edx, 10
        je break

        mov eax, edx
        div bl

        mov BYTE [ebx], al
        inc ebx
        mov BYTE [ebx], ah
        inc ebx
        mov BYTE [ebx], 32
        inc ebx

        jmp continue
    break:

    mov BYTE [ebx], 10

    mov eax, 3
    mov ebx, 2
    mov ecx, buf_code
    mov edx, 240
    int 80h

    mov eax, 1
    mov ebx, 0
    int 80h

I would greatly appreciate your help.

    
asked by anonymous 30.11.2018 / 20:35

0 answers