I'm expirimenting with assembly. Now I have a simple while loop starting with eax = 1 and then loop until eax = 10. In the loop i use a print macro to print te progress (should print 1 - 10) but it doesnt work..
section .bss
buffer resd 1
section .text
global _start
%macro write 3
mov eax, 4
mov ebx, %1
mov ecx, %2
mov edx, %3
int 80H
%endmacro
_start:
xor eax, eax
inc eax
while:
cmp eax, 10
jg end
mov [buffer], eax
write 1, [buffer], 1
mov eax, [buffer]
inc eax
jmp while
end:
mov eax, 1
xor ebx, ebx
int 0x80
The c equivalent is:
#include <stdio.h>
int main(void)
{
unsigned int i = 1;
while(i <= 10)
{
printf("%d", i);
i++;
}
return 0;
}
So my question is.. how can i use the write macro to print the values? What do i have to change in it?
Thanks