Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROGRAM 7 : Flight Calculator Write an HLA Assembly language program that calculates the cost of an airline ticket. The ticket will be based on
PROGRAM : Flight Calculator
Write an HLA Assembly language program that calculates the cost of an airline ticket. The ticket will be based on different choices made by the traveler as represented by a bit field as shown below:
Flight Packed Bit Field
Since just bits are being entered, your program should expect to read hexidecimal digits.
The two loworder bits shown in white represent the number of checked bags. Each checked bag add $ to the cost of the airline ticket.
The next four bits shown in blue represents the flight length, in mile increments. A flight of miles or less would be represented by A flight of up to miles in length would be represented by A flight up to miles in length would be represented by and so on Each miles flown adds $ to the cost of the airline ticket. For the fare to be valid, the smallest allowed value for this field is The biggest allowed value for this field would be meaning miles in length.
The next bit shown in yellow represents whether a meal is purchased on board. A meal adds $ to the cost of the airline ticket.
The highorder bit shown in orange represents whether a firstclass fare is being purchased. Firstclass tickets cost twice as much an economy ticket.
Below are some sample program dialogues that demonstrate these ideas.
Hint: Do this in small steps, bitbybit. There's alot to it
Further Hint: The most important part of this assignment is to worked with the packed data field entered by the user to extract the subparts 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...
Further Hint: You can read hex numbers by reading directly into a register. Just don't use EAX since stdin.get uses that one when it executes.
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 hex digits:
Miles flown cannot be zero!
Feed me hex digits:
Miles flown cannot be zero!
Feed me hex digits:
Economy ticket
No meal
No bags
miles flown
Total Fees $
Feed me hex digits:
First class ticket
No meal
No bags
miles flown
Total Fees $
Feed me hex digits: F
Economy ticket
Meal purchased
bags
miles flown
Total Fees $
Feed me hex digits: FF
First class ticket
Meal purchased
bags
miles flown
Total Fees $
here is the c code i have convert it to HLA assembly without using high level language such as loops and if statments
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