Question
Background : Two structures defined below to specify the number of bills of each of four different denominations and the number coins of each of
Background: Two structures defined below to specify the number of bills of each of four different denominations and the number coins of each of four types:
#include
#include
#include
#include
#include "library.h"
#include "graphics.h"
#include "touch.h"
Assignment: Create two assembly language functions that fill-in the values of the structure members by finding the smallest number of bills that add up to dollars and the smallest number of coins that add up to cents. For example, the number of twenty-dollar bills may be computed as the integer quotient of 20; the remainder is then used to find the number of ten-dollar bills, and so on. You will soon discover most of the code in the two functions is identical; use this fact to reduce the amount of code you write.
Important: The objective of this assignment is to gain experience using instruction sequences to replace multiplication or division by a constant. Therefore, your final solution may not contain any multiply or divide instructions of any kind. However, you should first write the functions using such instructions to be sure your algorithms work, and then replace the multiply and divide instructions one at a time (testing each as you do) with equivalent instruction sequences.
typedef struct typedef struct uint32_t uint32_t uint32_t uint32_t } BILLS ; twenties; tens ; fives ; ones ; uint32_t uint32_t uint32_t uint32_t } COINS ; quarters ; dimes ; nickels ; pennies ; void Bills(uint32_t dollars, BILLS *paper); void Coins (uint32_t cents, COINS *coins); typedef struct typedef struct uint32_t uint32_t uint32_t uint32_t } BILLS ; twenties; tens ; fives ; ones ; uint32_t uint32_t uint32_t uint32_t } COINS ; quarters ; dimes ; nickels ; pennies ; void Bills(uint32_t dollars, BILLS *paper); void Coins (uint32_t cents, COINS *coins)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started