Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use assembler language MASM to write the code mode x86 Write a single program that will compute the value of a function where the independent

Use assembler language MASM to write the code mode x86

image text in transcribed

Write a single program that will compute the value of a function where the independent variable is some random input value 1. Remember that we have to call randomize before we can use randomrange and that this is only done once in the program. The procedure randomize does not take any parameters but randomrange does. In other to know how it needs to be set and where it returns the random value you generate read about it on the ASMIO folder and run the file ASMlibHelp (The file with a ? icon) 2. After the call to randomize you need to randomly generate a value for x from - 8 to +12. In order to do that the call to randomize has to send the correct parameters 3. Based on the value of x, calculate the value of the function: f(x) - -x3 +14x - 3. Test your program with the 10 random values from - 8 to +12. Make sure to use the imul multiplication instruction to evaluate 14x. The output message must be of the form 4. Put your program in a loop to generate 20 different values of x and calculate f(x). In order to put the code in a loop use the loop instruction. This instruction works with register ECX. As long as ECX is not zero it continues to loop back to the label L1: mov ecx, 20 ;ECX set to 20: Loops 20 times Lpl: i The loop instruction cannot be too far ; off from the beginning of the label so your code loop Lp1 cont is a lable to jump back 5. Expected output for the possible values required: f (-8)397 f (-7) - 242 f (-6) 129 f (-5) = 52 f(-4) = 5 f (-3) - -18 f (-2)-23 f (-1)-16 f (0) -3 f(1) -10 f(2) = 17 f (3) 12 f (10)-863 f(11) = -1180 f (12)1563 f (4)-11 f (5)-58 f (6) --135 f (7) -248 f (8) -403 f (9) -606 Write a single program that will compute the value of a function where the independent variable is some random input value 1. Remember that we have to call randomize before we can use randomrange and that this is only done once in the program. The procedure randomize does not take any parameters but randomrange does. In other to know how it needs to be set and where it returns the random value you generate read about it on the ASMIO folder and run the file ASMlibHelp (The file with a ? icon) 2. After the call to randomize you need to randomly generate a value for x from - 8 to +12. In order to do that the call to randomize has to send the correct parameters 3. Based on the value of x, calculate the value of the function: f(x) - -x3 +14x - 3. Test your program with the 10 random values from - 8 to +12. Make sure to use the imul multiplication instruction to evaluate 14x. The output message must be of the form 4. Put your program in a loop to generate 20 different values of x and calculate f(x). In order to put the code in a loop use the loop instruction. This instruction works with register ECX. As long as ECX is not zero it continues to loop back to the label L1: mov ecx, 20 ;ECX set to 20: Loops 20 times Lpl: i The loop instruction cannot be too far ; off from the beginning of the label so your code loop Lp1 cont is a lable to jump back 5. Expected output for the possible values required: f (-8)397 f (-7) - 242 f (-6) 129 f (-5) = 52 f(-4) = 5 f (-3) - -18 f (-2)-23 f (-1)-16 f (0) -3 f(1) -10 f(2) = 17 f (3) 12 f (10)-863 f(11) = -1180 f (12)1563 f (4)-11 f (5)-58 f (6) --135 f (7) -248 f (8) -403 f (9) -606

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

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions