Kat H.

asked • 04/23/21

Digits and height. You will write two complete programs in x64 assembly.

You will write two complete programs in x64 assembly. In order to put off a discussion of how to use the operating system (which is necessary for interacting with the console), your programs will not take any input or output. Rather, their input values will be given explicitly in the code, and the output values will be variables that you will assign the correct values. In order to see that they are running and producing the correct results, you will need to step through and examine them in the debugger.


Digits


Write this program in a file named digits.s.

As input, you will define a quad word integer variable named input in the initialized data section. Choose  so that the value is representable in three decimal digits.

As output, you will have three quad word integer variables named onestens, and hundreds in the uninitialized data section (bss). Your program should calculate the decimal representation of input, putting the ones place in ones and so on. The div instruction will be your primary mathematical tool.


Height


Write this program in a file named height.s.

The height in an object will reach if it is thrown straight up depends on its initial velocity and the force of gravity, . The value of  varies depending on what planet/body you are on: on Earth, g is 9.8m/s^2; on Mars, 3.7m/s^2; on the Moon, it is 1/6m/s^2.

As input, you will define a double-precision floating-point variable named velocity in the initialized data section. Similarly define the constant g (based on Earth).

As output, you will define a double-precision floating-point variable named height in the unitialized data section (bss). Calculate height from velocity and g using this formula:

height = (1/2) * ((velocity)^2/g)

This will use the XMM registers for floating-point calculations.


1 Expert Answer

By:

Shanek K. answered • 08/14/21

Tutor
4.7 (74)

Computer Science Professional Tutor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.