factorial variant 3
rts is shorthand
can pop the stack explicitly
fact: cmp arg1, #0
jump.ne recurse
load val, #1
rts
recurse: push arg1
sub arg1, #1
jsr fact
pop arg1
mul val, arg1
pop arg2
jump 0(arg2)
Previous slide
Next slide
Back to first slide
View graphic version