Question

Write a macro for calculating the dot product of two vectors in 80x86 assy language ;...

Write a macro for calculating the dot product of two vectors in 80x86 assy language


; computes the dot product of two vectors
dot_product MACRO x1, y1, z1, x2, y2, z2

ENDM

Homework Answers

Answer #1

dot_product MACRO x1,y1,z1,x2,y2,z2

push cx # ax and cx is pushed to the stack so that its value in the main program is not altered

push ax

mov al,x1

mov cl,x2

mul cl

add bx,ax #register bx is used to store the sum

mov al,y1

mov cl,y2

mul cl

add bx,ax

mov al,z1

mov cl,z2

mul cl

add bx,ax

dis

pop cx #initial values of ax and cx are brought back

pop ax

ENDM

dis MACRO #This MACRO is to display the result on the screen

mov ax,bx

add ax,3030h #3030h is added so the the ascii value of the number is obtained

mov cx,ax

mov dl,ah

mov ah,2h #interrupt to print a value on the screen

int 21h

mov dl,cl

mov ah,2h

int 21h

ENDM

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a complete C program that prompts the user for the coordinates of two 3- D...
Write a complete C program that prompts the user for the coordinates of two 3- D points ( x1 , y1 , z1 ) and ( x2 , y2 , z2 ) and displays the distance between them computed using the following formula: distance= square root of (x1-x2)2+(y1-y2)2+(z1-z2)2
function [Ax,Ay,Az]=GravityAcc(M1,X1,Y1,Z1,X2,Y2,Z2) %We are calculating the acceleration for object 2 G=6.67408*1e-11; R=? Am=G*M1/(R^2); Ax=(X1-X2)/R*Am; Ay=(Y1-Y2)/R*Am; Az=(Z1-Z2)/R*Am;...
function [Ax,Ay,Az]=GravityAcc(M1,X1,Y1,Z1,X2,Y2,Z2) %We are calculating the acceleration for object 2 G=6.67408*1e-11; R=? Am=G*M1/(R^2); Ax=(X1-X2)/R*Am; Ay=(Y1-Y2)/R*Am; Az=(Z1-Z2)/R*Am; end What is R in this gravitational acceleration code?
Define grammar of a language to write boolean expritions. The language can recognize identifieres of boolean...
Define grammar of a language to write boolean expritions. The language can recognize identifieres of boolean variables. It shoud recognize sympoles of (&,|,~) respectivly (and/or/not). Examples of valid expressions: 1- (~ x0 & ~ x1) | (x0' & ~ x1) ) 2- ~ (x0 & x1)) 3- (x0 & y0) | (x1 & y1) | (x2 & y2)
Write vectors in R2 as (x,y). Define the relation on R2 by writing (x1,y1) ∼ (x2,y2)...
Write vectors in R2 as (x,y). Define the relation on R2 by writing (x1,y1) ∼ (x2,y2) iff y1 − sin x1 = y2 − sin x2 . Prove that ∼ is an equivalence relation. Find the classes [(0, 0)], [(2, π/2)] and draw them on the plane. Describe the sets which are the equivalence classes for this relation.
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1,...
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1, x2) and y = (y1, y2). (Hints: 1- You have to use z = (z1, z2) to prove or disprove transitivity. 2- You can disprove by a counter example) — x ≽y iff x1 > y1 or x1 = y1 and x2 > y2.
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1,...
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1, x2) and y = (y1, y2). (Hints: 1- You have to use z = (z1, z2) to prove or disprove transitivity. 2- You can disprove by a counter example) — x ≽y iff x1 > y1 or x1 = y1 and x2 > y2.
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1,...
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1, x2) and y = (y1, y2). (Hints: 1- You have to use z = (z1, z2) to prove or disprove transitivity. 2- You can disprove by a counter example) — x ≽y iff x1 > y1 or x1 = y1 and x2 > y2.
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1,...
Determine if completeness and transitivity are satisfied for the following preferences defined on x = (x1, x2) and y = (y1, y2). x ≽ y iff x1 > y1 or x1 = y1 and x2 > y2. (Hints: 1- You have to use z = (z1, z2) to prove or disprove transitivity. 2- You can disprove by a counter example)
What is the effect on the dot product of two vectors, if the angle between the...
What is the effect on the dot product of two vectors, if the angle between the two vectors is fixed, but one of the vectors doubles in length? or triples in length? two explainations please
Which of the following vectors are unit vectors with respect to the inner product: <(x1, x2,...
Which of the following vectors are unit vectors with respect to the inner product: <(x1, x2, x3) , (y1, y2, y3)> = 2x1y1 = 2x3y3 in R3? A. (1, 0, 0)   B. (1, 0, 0)/sqrt(2)   C. (1, 0, 1)/sqrt(2)    D. (1, 1, 0)/2 Select from the following: 1. Only A 2. Only B and D 3. Only A and C 4. All of A, B, C and D 5. None of the above Thank you!
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT