I'm in need to convert the letters of a string to the corresponding order in alphabet, (ex: A -> 1, B -> 2, etc.)
In this example, the string I have to convert is: "mostra os objetos e os morfismos", I tried a lot of things, but nothing worked. It seems like I get the ascii value of the char, but when I add it back on the string it prints the corresponding last 2 dec digits in ascii, ex: (m which in dec is 0155 prints - that is 55 in ascii)
here is my code:
SYS_EXIT  equ 1
SYS_WRITE equ 4
STDIN     equ 0
STDOUT    equ 1
global    _start
section   .text
_start:
qe:
    mov         eax, SYS_WRITE                  ;  
    mov         ebx, STDOUT                     ; 
    mov         ecx, e                          ;
    mov         edx, len                      ; 
    int 0x80                                    ; 
    mov         rdi, string                     ; 
    mov         rdx, string_e                     ; 
    mov         r9, 0                           ;      
    jmp         loop_e
next:
    mov         [rdx], esp                      ; write single character
    inc         rdx                             ; advance pointer to next cell to write
    inc         rdi                             ; advance pointer to next cell to write
    inc         r9                              ; "count" number so far on 
    cmp         r9, len_string                    ; did we reach the number of stars for this line?
    jne         loop_e                            ; not yet, keep writing on this line
    jmp         result_e
loop_e:
    mov         esp, [rdi]
    cmp         byte [rdi], ' '
    je          next
    xor         esp, 40H
    mov         [rdx], esp                      ; write single character
    inc         rdx                             ; advance pointer to next cell to write
    inc         rdi                             ; advance pointer to next cell to write
    inc         r9                              ; "count" number so far on line
    cmp         r9, len_string                    ; did we reach the number of stars for this line?
    jne         loop_e                            ; not yet, keep writing on this line
    jmp         result_e
result_e:
    mov         eax, SYS_WRITE                  ; system call number for write (SYS_WRITE)
    mov         ebx, STDOUT                     ; system call number for file handle (STDOUT)
    mov         ecx, string                          ; address of string to output
    mov         edx, len_string                      ; number of bytes
    int 0x80
    mov         eax, SYS_WRITE                  ; system call number for write (SYS_WRITE)
    mov         ebx, STDOUT                     ; system call number for file handle (STDOUT)
    mov         ecx, lbreak                          ; address of string to output
    mov         edx, 1                      ; number of bytes
    int 0x80
    mov         eax, SYS_WRITE                  ; system call number for write (SYS_WRITE)
    mov         ebx, STDOUT                     ; system call number for file handle (STDOUT)
    mov         ecx, string_e                          ; address of string to output
    mov         edx, len_string                      ; number of bytes
    int 0x80
    mov         eax, SYS_WRITE                  ; system call number for write (SYS_WRITE)
    mov         ebx, STDOUT                     ; system call number for file handle (STDOUT)
    mov         ecx, lbreak                          ; address of string to output
    mov         edx, 1                      ; number of bytes
    int 0x80
    jmp         _finish
    
_finish:
    mov eax,SYS_EXIT                            ;system call number (SYS_EXIT)
    int 0x80                                    ;call kernel
    ret
section   .data
e:              db        "e.", 0xA,0xD
len             equ       $ - e
string:         db        "mostra os objetos e os morfismos", 0
lbreak:         db        0xA,0xD
section   .bss
string:                     resb        44
string_e:                   resb        44
zero                        equ         0
len_string                  equ         32
my output:
e.
mostra os objetos e os morfismos
-/342! /3 /"*%4/3 % /3 -/2&)3-/3
what I expect:
e.
mostra os objetos e os morfismos
13151920181 1519 152105201519 5 1519 1315186919131519
 
    