0% found this document useful (0 votes)
33 views1 page

Code

Uploaded by

mayuriprajapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Code

Uploaded by

mayuriprajapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Fact : mov 81h, #20h ; initialize SP

mov r5, number ; number < 9 whose factorial is required


mov r0, ans ; pointer to store the result
push r0
mov a, #01h ; initialize the result
mov @r0, a
inc r0
dec a
mov @r0, a
inc r0
mov @r0, a
pop r0
rept: acall mul16_8

djnz r5, rept


end

mul16_8 :
push r0
mov a, @r0
mov r3, a
inc r0
mov a, @r0
mov r4, a
mov a, r3
mov b, r5
mul ab ; (a) : LSB & (b) : MSB
mov @r0, a
inc r0
mov @r0, b
mov a, r4
mov b, r5
mul ab
add a, @r0
mov a, b
addc a, #00h ; consider carry
inc r0
mov @r0, a
pop r0
ret

You might also like