Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I got it to where I can display the number inputted. The code i have thus far will give me this. But, I need to add to it in order to verify that the number entered is between 1-8, and for what number 1-8 is entered, produces the factorial of that number. I am at a loss here. HELP! The following is what I have:
Prompt db 'Enter a number 1-8: $'
msg2 db 10, 10, 13, 'Factorial is: $'
mov ax, @data
mov dx,offset prompt
mov ah, 01h; get character input
mov ah, 0
sub ax, 30h; make it a number from ASCII char
call div10; proc to create the base 10
mov dx, offset msg2
mov ah,4ch;send return to dos code
mov dx, 0
mov bx, 10
add cx, 1
cmp ax, 0
add dl, 30h
mov ah, 02h
ret; return after the call
0 · ·