Member Avatar
monjo
section .text
global _start:
_start:
mov         esi, array                      ; get pointer to array
mov         edi, arraylen                   ; edi = number of array elements

loop:
mov        edx, 2                          ; print 2 bytes                 
mov        ecx, [esi]                      ; get current array element
add         ecx,48
push        ecx                             ; push to stack since we need an address of                                         item to print

mov     ecx, esp                        ; mov address of char to ecx
mov     ebx, 1
mov     eax, 4
int     80h                             ; now print it
pop     ecx                             ; balance stack
add     esi,2                         
dec     edi                             ; decrease loop counter
jnz     loop                     ; if edi ! 0 continue loop

mov     word [esp], 10
mov     edx, 1
mov     ecx, esp
mov     ebx, 1
mov     eax, 4
int     80h

mov     ebx, 0
mov     eax, 1
int 80H

 section .data
array dw 12,12,45,86,78
arraylen equ ($ - array) /2