Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Example 7 . 1 0 Use right shifts to divide the unsigned number 6 5 1 4 3 by 4 . Put the quotient in
Example Use right shifts to divide the unsigned number
by Put the quotient in
Solution: To divide by two right shifts are needed. Since the divi
dend is unsigned, we use SHR The code is
Example If contains give the decimal value of after
SAR AL is performed.
Solution: Execution of SAR AL divides the number by and rounds
down. Dividing by yields and after rounding down we get
In terms of the binary contents, we have After shifting,
we have
Example Write a procedure FACTORIAL that will compute N for a
positive integer The procedure should receive in and return
in AX Suppose that overflow does not occur.
Solution: The definition of is
dots
Here is an algorithm:
It can be coded as follows:
Here CX is both loop counter and term; the LOOP instruction automatically
"decrements" it on each" itratin through the loop. We assume the product
does not overflow bits.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started