I'm learning Assembly with linux x86_64 and i compiles my codes with nasm and ld. This time i want to print secuentially a list of numbers set into an array named 'Llista'. Once compiled, linked and executed with ./printLlista the terminal shows me this:
The list is: 1�Violació de segment (s'ha bolcat la memòria)
Mi intention is to do something like this in C:
The program printLlista.asm is this:
; printLlista.asm 
; Print a list of values from an array.
; Compiled : nasm -f elf printLlista.asm
; Linked : ld -m elf_i386 printLlista.o -o printLlista
; Execute : ./printLlista
section      .data 
    Llista db 1, 2, -3, 4
    len_Llista equ $ - Llista
    res_Llista db 0
    Missatge db "The list is: ", 0h
    len_Missatge equ $ - Missatge
section      .text 
global  _start
    _start:
    print_Missatge: 
 mov     edx, len_Missatge
 mov     ecx, Missatge
 mov     ebx, 1
 mov     eax, 4
 int     80h
   get_first_item: 
 mov     esi, 0
 mov     ebx, 0
 mov     ecx, Llista
    search_Llista:
 mov     ebx, [ecx]
 add     ebx, '0'
 mov     [res_Llista], ebx
    print_items:
 mov     edx, len_Llista
 mov     ecx, res_Llista
 mov     ebx, 1
 mov     eax, 4
 int     80h
   test_if_loop: 
 mov     ecx, 1
 inc     esi
 cmp     esi, len_Llista
 jl      search_Llista
    exit:
 mov     ebx, 0
 mov     eax, 1
 int     80h 
I don't understand where is the problem, I hope you can. Thanks in advance.
