.entry start loop: ; If the counter is less or equal to 1, finish cmp R3, 1 jle @end sub R3, 1 mul R1, R3 jmp @loop end: ret start: ; Find factorial for the initial value of R3, load R3, 5 ; Copy the initial value of R3 to R1, ; R1 is our factorial result load R1, R3 call @loop ; Display the message and exit store @1000, R1 inspect @1000 halt