Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

masm615 assembly: Theory Division using shift Two numbers A (a n a n-1 ... a 2 a 1 a 0 ) and B (b n

masm615 assembly:

Theory

Division using shift

Two numbers A (an an-1 ... a2 a1 a0) and B (bn bn-1 ... b2 b1 b0). The division of A/B yields a quotient Q (bn qn-1 ... q2 q1 q0) and a remainder R that can be calculated by a series of shifts and subtractions.

Algorithm:(note:

1. Initialize i = n, Q = 0, Y = 0

2. Y = (Y i

3. If Y >= B then: {Q = Q + 1, Y = Y - B}

4. i = i - 1

5. If i > 0 then goto 2

6. R = Y

Assignment

Your assignment will be to implement division suing shift instruction and conditional instructions Make sure your code works for 0's as arguments.

here is a pervious code to show you an example of the structure and how simple my codes are:image text in transcribed

MODEL SMALL 386 STACK DATA. SBYTE 1, 16 28 88 100 116 68 104 92 40 52, 128 80 -8, 64 76 56 -44, 32 -20 Y SWORD 32765 16373 1965 -22927, 29491 7, 3271 26215 6559 16387, 13111, 98 35, 328 3, -6545, -9823, -13099, 22937, 19663, z SWORD 20 DUP CODE MAIN PROC FAR STARTUP program MOV SI 0 MOV CX, 20 L1 MOVSX AX, XCESI we are in a byte so its fine MOV BX, 5 IMUL BX MOV BX, 4 IDIV BX MOV DI AX MOV AK Y 2 ESI because we are going to a word MOV BX, 2 IMUL BX MOV BX 3 IDIV BX MOV BP, AK ADD DI BP MOV 202 ESI DI INC ESI Loop L1 EXIT MAIN ENDP END MODEL SMALL 386 STACK DATA. SBYTE 1, 16 28 88 100 116 68 104 92 40 52, 128 80 -8, 64 76 56 -44, 32 -20 Y SWORD 32765 16373 1965 -22927, 29491 7, 3271 26215 6559 16387, 13111, 98 35, 328 3, -6545, -9823, -13099, 22937, 19663, z SWORD 20 DUP CODE MAIN PROC FAR STARTUP program MOV SI 0 MOV CX, 20 L1 MOVSX AX, XCESI we are in a byte so its fine MOV BX, 5 IMUL BX MOV BX, 4 IDIV BX MOV DI AX MOV AK Y 2 ESI because we are going to a word MOV BX, 2 IMUL BX MOV BX 3 IDIV BX MOV BP, AK ADD DI BP MOV 202 ESI DI INC ESI Loop L1 EXIT MAIN ENDP END

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_2

Step: 3

blur-text-image_3

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago