;--------------------------------------------------------------------------------------; Factorial_Recursive ;this subrouinte returns the factorial of R0, ;and writes it back into R0. ;this function is recursive CMP R0, #0 ; if argument n is 0, return 1 BNE notzero MOV R0, #1 PUSH{LR} B theRend notzero PUSH{LR} PUSH{R0} ; otherwise save argument n into R3 SUB R0, R0, #1 ; and perform recursive call on R3 - 1 BL Factorial_Recursive POP{R1} MUL R0, R1, R0 ; multiply returned value by n theRend POP{PC} ; and return ;--------------------------------------------------------------------------------------;