To do for the lab report 3] Solve task #24 from the SMS documentation:
24) Write a procedure that works out Factorial N. This example
shows one method for working out factorial N.
Factorial 5 is 5 * 4 * 3 * 2 * 1 = 120. Your procedure
should work properly for factorial 1, 2, 3, 4 or 5.
Factorial 6 would cause an overflow. Use the stack to pass
parameters and return the result. Calculate the result.
Using a look up table is cheating!
Use this starter code:
; ----- Main program for iterative factorial is the same as for recursive------ MOV AL,5 ; Do not try n>5, it overflows PUSH AL ; Parameter is passed on the stack. Assume >= 0. CALL 60 POP AL ; Factorial is here OUT 01 ; Output the result to port 01 (traffic lights) HALT