COAL Lectures Week 13 Pat A
COAL Lectures Week 13 Pat A
Assembly Language
Week 13 part a
Chapter 8 “Advanced Procedures”
Recursion
• A recursive subroutine is one that calls itself, either directly or
indirectly.
factorial(5);
Calculating Factorial (Assembly code)
; Calculating a Factorial (Fact.asm)
INCLUDE Irvine32.inc
.code
main PROC
push 5 ; calc 5!
call Factorial ; calculate factorial (EAX)
call WriteDec ; display it
call Crlf
exit
main ENDP
;----------------------------------------------------
Calculating Factorial(Assembly code continued)
.MODEL Directive
• Syntax:
– label PROTO paramList