home
section .bss
char resb 1
section .text
global _start
_start:
; for(i=32; i<128; i++)
xor ecx,ecx ;i = 0
inc ecx ;i = 1
shl ecx,5 ;i = i * 2 * 2 * 2 * 2 * 2
bucle:
cmp ecx, 80h
jz exit ;i==128? Sí, salta a exit. No, sigue.
mov [char], ecx ;char = i
push ecx ;lo guardamos en la pila, para no perderlo :)
mov eax,04h ;syscall 4 (write)
mov ebx,01h ;donde? en STDOUT (1)
mov ecx,char ;que? el char
mov edx,1 ;cuantos bytes? 1
int 80h ;llamamos al kernel...
pop ecx ;recuperamos ecx de la pila
inc ecx ;i--
jmp bucle
exit:
mov eax, 0Ah
mov [char], eax ;char = '\n'
mov eax,04h ;syscall 4 (write)
mov ebx,01h ;donde? en STDOUT (1)
mov ecx,char ;que? un /n
mov edx,1 ;cuantos bytes? 1
int 80h ;llamamos al kernel...
mov eax,01h ;system call number (exit)
int 80h ;llamamos al kernel...