Categories
Assembly Language

Write an HLA Assembly language program that calculates the cost of various movie tickets. The cost will be based on a single 16-bit value entered by the value. The value will be used to specify a number of adult, senior citizen and children tickets. In addition, there might be matinee discount for each ticket sold

Swamped with your writing assignments? Take the weight off your shoulder!

Submit your assignment instructions

Write an HLA Assembly language program that calculates the cost of various movie tickets. The cost will be based on a single 16-bit value entered by the value. The value will be used to specify a number of adult, senior citizen and children tickets. In addition, there might be matinee discount for each ticket sold. There might be a blockbuster premium applied to each ticket sold. The format of this bit field is diagrammed below:
Three bits are being used to specify the number of child tickets, each costing $5. Three bits are being used to specify the number of adult tickets, each costing $10. Three bits are being used to specify the number of senior citizen tickets, each costing $7. Once all the costs are totaled, the matinee discount should save $2 per ticket. Once all the costs are totaled, add $1 per ticket for blockbuster premium.
Since 16 bits are being entered here, your program should expect to read 4 hexadecimal digits.
Below are some sample program dialogues that demonstrate these ideas.
(Hint: Do this in small steps, bit-by-bit. There’s alot to it… )
(Another Hint: HLA read in hex format when you read directly into a register. So do that…)
(Further Hint: The most important part of this assignment is to worked with the packed data field entered by the user to extract the sub-parts out of it. The overlapping design of the Intel registers helps you parse this kind of data field and you can shift the bits around to get the right part into BH or BL, for example… )
(Final Hint: Since we haven’t learned how to do multiplication yet, although it’s kinda painful, I was expecting that you would perform the multiplication by a looping set of addition instructions)
Feed me 4 hex digits: 0001
1 Children
0 Adult
0 Senior Citizen
No Matinee Discount
No Blockbuster Premium
Total: $5
Feed me 4 hex digits: 0049
1 Children
1 Adult
1 Senior Citizen
No Matinee Discount
No Blockbuster Premium
Total: $22
Feed me 4 hex digits: 025C
4 Children
3 Adult
1 Senior Citizen
Matinee Discount
No Blockbuster Premium
Total: $41
Feed me 4 hex digits: 045D
5 Children
3 Adult
1 Senior Citizen
No Matinee Discount
Blockbuster Premium
Total: $71

Swamped with your writing assignments? Take the weight off your shoulder!

Submit your assignment instructions

Leave a Reply