I have just started to learn NASM using tutorialspoint's online Asm Compiler (https://www.tutorialspoint.com/compile_assembly_online.php).
My first warmup is to write a code that calculates the factorial of 5. Here is my try:
section .text
global _start
_start:
mov eax, 1 ;a = 1
mov ebx, 1 ;f = 1
int 0x80 ;call kernel
l1:
mul ebx ; f = f*a
inc eax ; a++
cmp eax, 5 ; if a<=5
jle l1 ; jump to l1
section .data
msg db 'Factorial 5 is:',0xa
len equ $ - msg
It doesn't print any value out, can anyone give me a hint on what's the problem? Thank you.