Answered step by step
Verified Expert Solution
Link Copied!

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 7.10 Use right shifts to divide the unsigned number 65143
by 4. Put the quotient in Ax.
Solution: To divide by 4, two right shifts are needed. Since the divi-
dend is unsigned, we use SHR. The code is
Example 7.11. If AL contains -15, give the decimal value of L after
SAR AL.,1 is performed.
Solution: Execution of SAR AL,1 divides the number by 2 and rounds
down. Dividing -15 by 2 yields -7.5, and after rounding down we get -8.
In terms of the binary contents, we have -15=11110001b. After shifting,
we have 11111000b=-8.
Example 9.7 Write a procedure FACTORIAL that will compute N! for a
positive integer N. The procedure should receive N in Cx and return N!
in AX. Suppose that overflow does not occur.
Solution: The definition of N! is
N1ifN=1
=N(N-1)(N-2)dots1ifN>1
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 16 bits.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

Multiply. Give answers in standard form. 2 (4 + 5i)

Answered: 1 week ago