CS250 Project 2: Assembly Language
Due Tuesday, March 18 at 9:00 AM (last thing before midterm 2)
This project is intended to give you some practice using x86 assembly language. All the assembly statements required have been covered in class examples so far, but this project will be somewhat more lengthy. Write a ballistics simulator which will calculate the trajectory of a projectile, assuming no affect from air drag. The simulator should accept a single input from the user, the initial velocity of the projectile. Assume the projectile is fired straight up (as in, will land where it was launched).
Using integer math is recommended for this program. Here is an example use of the program:
Enter Velocity:
250
Height: 218 VVelocity: 218 Time: 1
Height: 404 VVelocity: 186 Time: 2
Height: 558 VVelocity: 154 Time: 3
Height: 680 VVelocity: 122 Time: 4
Height: 770 VVelocity: 90 Time: 5
Height: 828 VVelocity: 58 Time: 6
Height: 854 VVelocity: 26 Time: 7
Height: 848 VVelocity: -6 Time: 8
Height: 810 VVelocity: -38 Time: 9
Height: 740 VVelocity: -70 Time: 10
Height: 638 VVelocity: -102 Time: 11
Height: 504 VVelocity: -134 Time: 12
Height: 338 VVelocity: -166 Time: 13
Height: 140 VVelocity: -198 Time: 14
Height: -90 VVelocity: -230 Time: 15
Units are feet per second (velocity), feet (height), and seconds (time). Gravity is 32 feet per second per second. Notice the velocity decreases by 32 each timestep. Here is a second example, using numbers which will come out even:
Enter Velocity:
96
Height: 64 VVelocity: 64 Time: 1
Height: 96 VVelocity: 32 Time: 2
Height: 96 VVelocity: 0 Time: 3
Height: 64 VVelocity: -32 Time: 4
Height: 0 VVelocity: -64 Time: 5
If you want more precision, you can multiply all numbers by 1,000, and divide by 1,000 before printing results. This won't display decimal places, but will provide more accuracy for internal calculations.
Hints
Adding negative numbers is the same as subtracting (you can add negative velocity to the height).
Calling printf is covered in chapter 8, which is the easiest way to handle printing numbers.