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.