Description
Solving Quadratics
Topics: Instructions for integer arithmetic, calling a C function from assembly.
Prerequisite Reading: Chapters 1-5
Create a single ARM Cortex-M4 assembly source code file containing four functions. (Note that functions π
πππ‘1 and π
πππ‘2 should both contain calls to functions π·ππ πππππππππ‘ and πππ’ππππ
πππ‘.) Functions π·ππ πππππππππ‘, π
πππ‘1, π
πππ‘2 and ππ’πππππ‘ππ are called by a main program (download from here) that will test your functions for three test cases. All of the parameters and return values are of type int32_t:
1. π·ππ πππππππππ‘(π, π, π) = π2 β 4ππ
2. π
πππ‘1(π, π, π) =
βπ+πππ’ππππ
πππ‘(π·ππ πππππππππ‘(π,π,π))
2π
3. π
πππ‘2(π, π, π) =
βπβπππ’ππππ
πππ‘(π·ππ πππππππππ‘(π,π,π))
2π
4. ππ’πππππ‘ππ(π₯, π, π, π) = ππ₯2 + ππ₯ + π
Note: Function SquareRoot is a function written in C implemented in the same source code file as the main program. It requires a single unsigned integer parameter and returns an unsigned integer result. It should be called from your assembly language functions Root1 and Root2.
If your code is correct, the three test cases should look similar to the image above. Incorrect values will be displayed as white text on a red background.
Reviews
There are no reviews yet.