.section .text
.global asm_main
asm_main:
enter $0,$0 # setup routine
pusha
call print_nl
mov $mensaje, %eax # imprime el prompt
call print_string
call read_int
mov %eax, valor
movl $1, i
call print_nl
for_ext:
mov valor, %ebx
cmp %ebx, i
jae fin_for_ext
movl $1, j
for_int:
cmp %ebx, j
jae fin_for_int
if:
cmp $1, i
je entonces
#mov $0, %eax
mov i, %eax
mov $0, %edx
mov valor, %ebx
div %ebx
cmp $0, %edx
je entonces
cmp $1, j
je entonces
#mov $0, %eax
mov $0, %edx
mov valor, %eax
mov $2, %ecx
div %ecx
add $1, %eax
cmp %eax, j
je entonces
else:
#mov $0, %eax
mov $bola, %eax
call print_string
jmp fin_si
entonces:
#mov $0, %eax
mov $asterisco, %eax
call print_string
jmp fin_si
fin_si:
incl j
jmp for_int
fin_for_int:
call print_nl
incl i
#movl $0, j
jmp for_ext
fin_for_ext:
call print_nl
popa
mov $0, %eax # retorna a C
leave
ret