Lab 3 Advanced Program Vending Machine Your program will simulate the operation of a vending machine. The machine will dispense, upon reception of the correct amount of money, a choice of Gum,...

Do lab 4 . I just provide the lab 3 requirement and the lab3 code because this is base on lab3


Lab 3 Advanced Program Vending Machine Your program will simulate the operation of a vending machine. The machine will dispense, upon reception of the correct amount of money, a choice of Gum, Peanuts, Cheese Crackers, or M&Ms. Your software will perform the following: 1. Display a welcome message and instructions. 2. Set the initial inventory to two (2) of each kind. 3. Prompt the user for item selection. Gum (G), Peanuts (P), Cheese Crackers (C), or M&Ms (M). Reject any invalid selections. 4. Confirm the customer’s selection. 5. Prompt the user for the amount to enter: Gum ($0.50), Peanuts ($0.55), Cheese Crackers ($0.65), or M&Ms ($1.00). 6. Accept money inputs of dimes (D), quarters (Q), and one-dollar bills (B). 7. If the customer selects an out of inventory item, prompt them to make another selection. 8. Vending machine will shut down if the entire inventory reaches zero. 9. Assume there is no limit on the amount of change the vending machine contains. 10. Make provisions for a secret code that when entered will display the current inventory of items. Sample Processing Welcome to Mr. Zippy’s vending machine. Cost of Gum ($0.50), Peanuts ($0.55), Cheese Crackers ($0.65), or M&Ms ($1.00). Enter item selection: Gum (G), Peanuts (P), Cheese Crackers (C), or M&Ms (M) C You selected Cheese Crackers. Is this correct (Y/N)? Y Enter at least 65 cents for selection. Dimes (D), Quarters (Q) and dollar bills (B): B Enough money entered. Cheese Crackers have been dispensed. Change of 35 cents has been returned. Enter item selection: Gum (G), Peanuts (P), Cheese Crackers (C), or M&Ms (M) General Requirements: The student’s ARM Assembly code file needs to contain the following: 1. Proper header information that include commands that assemble, link, run the file and run the file using the debugger that is specific for their file. 2. Data section that defines all the output strings. 3. Code comment sections that describe the major sections of the code: a. Welcome message b. Cost of items message c. Prompt for selection d. Verify selection e. Prompt for payment until enough is entered f. Dispense item, update inventory and given change g. Exit program when inventory of all items reaches zero h. Go back to step b. i. Print inventory when secret code is entered. Students should retain a copy of this lab to be used in labs 4 and 5. This lab was assigned Fall 2021 Spring 2020 Student ________________________Lab Instructor: ________________________ Total Score: ________________ Late Penalty? No _____Yes: ______ Feature Points off Code Comments/Documentation  · Class, Term, Author, Date. · Purpose of software · Documentation for the start of each loop and function (subroutine) · Documentation for error checking  · In-line comments that explain why the following code exists.  Welcome and instruction message are displayed and clear. Enter invalid item selection and ensure it is rejected and program re-prompts for entry. Enter secret code and ensure inventory of all four items is set at 2 each. Select M&Ms and select it is NOT the right selection. Select M&Ms, select it is correct selection. Enter payment of dollar bill. Verify item and correct change is dispensed (0 cents). Select Cheese Cracker, select it is correct selection. Enter payment of dollar bill. Verify item and correct change is dispensed (35 cents). Select Peanuts, select it is correct selection. Enter payment of dollar bill. Verify item and correct change is dispensed (45 cents). Select Gum, select it is correct selection. Enter payment of dollar bill. Verify item and correct change is dispensed (50 cents). Enter secret code and ensure inventory of all four items is at 1 each. Select M&Ms, select it is correct selection. Enter payment of dimes until $1.00 is entered. Verify item and correct change is dispensed (0 cents). Select Cheese Cracker, select it is correct selection. Enter payment of Quarter, Quarter, dollar bill. Verify item and correct change is dispensed (85 cents). Enter secret code and ensure inventory is: M&Ms – 0 Cheese Crackers – 0 Peanuts – 1 Gum – 1 Select M&Ms and ensure message is displayed that item is out and please make another selection. Select Cheese Crackers and ensure message is displayed that item is out and please make another selection. Select Peanuts, select it is correct selection. Enter payment of Dime, Dime, Quarter, then a dollar bill. Verify item and correct change is dispensed (90 cents). Select Gum, select it is correct selection. Enter payment of Quarter, Quarter. Verify item and correct change is dispensed (0 cents). Verify out of inventory message is displayed and machine is shut down. Control is returned to OS. Lab3 Set_3 Lab 4 ARM Thumb Mode Purpose: The purpose of this lab is to provide students experience with the ARM Thumb mode in assembly programming. Directions: Students are to take the previously submitted ARM Lab 3 and convert it to run under ARM Thumb. No other changes to the code are to be made OTHER to have the existing code to assemble and run correctly under Thumb mode. Depending on how you implemented Lab 3 there may or may not be significant changes to your code. This lab is to have the same functionality as required by the previous grading rubric. How to get into ARM Thumb mode: After the label for main insert the following code: ldr r0, =startthumb + 1 bx r0 .code 16 @Make all this code thumb mode. Will not exit back out of Thumb mode. startthumb: There is no need to return back to 32-bit mode so the code needed to convert back to non-thumb mode is not needed. See the textbook section 4.6.1 for the differences between the ARM and ARM Thumb versions of the code. This lab was assigned: Fall 2021 Lab4_Set4 @Yuxuan Li @CS413 Fall 2021 @Dr. CS413 Dr.Vineetha Menon @10/10/2021 @User can use vending to buy snacks and each snack contains 2 for inventory. .equ READERROR, 0 .global main .global printf .global scanf main: LDR r0, =welcome@Welcome Message BL printf getInput:@Ask user for input LDR r0, =numPrompt BL printf LDR r0, =UserInput LDR r1, =sideInput BL scanf CMP r0, #READERROR BEQ readerror LDR r1, =sideInput ldr r1, [r1] cmp r1, #'G'@Enter G for gum beq Gum cmp r1, #'P'@Enter P for peanut beq Peanut cmp r1, #'C'@Enter C for cheese cracker beq Cracker cmp r1, #'M'@Enter M for M&M beq MM cmp r1, #'I' beq InventInfo b readerror readerror: LDR r0, =strInputPattern LDR r1, =strInputError BL scanf b getInput readerror2: LDR r0, =strInputPattern LDR r1, =strInputError BL scanf b payment readerror3: ldr r0, =OutStock bl printf b readerror Gum: LDR r10, =GAmount @The amount of gum ldr r9, [r10] cmp r9, #0 beq readerror3 ldr r4, =GPrompt@Gum is selected mov r8, #50 B confirmation@To confirmation Peanut: LDR r10, =PAmount@The amount of peanut ldr r9, [r10] cmp r9, #0 beq readerror3 ldr r4, =PPrompt@peanut is selected mov r8, #55 B confirmation@to confirmation Cracker: LDR r10, =CAmount@The amount of cracker ldr r9, [r10] cmp r9, #0 beq readerror3 ldr r4, =CPrompt@cracker is selected mov r8, #65 B confirmation@go to confirmation MM: LDR r10, =MAmount@amount of M&M ldr r9, [r10] cmp r9, #0 beq readerror3 ldr r4, =MPrompt@M&M is selected mov r8, #100 B confirmation@go to confirmation confirmation: mov r1, r4@ Moves item name into %s position ldr r0, =correctCheck bl printf ldr r0, =UserInput ldr r1, =checkInput bl scanf cmp r0, #READERROR beq readerror ldr r1, =checkInput ldr r4, [r1] cmp r4, #'Y' moveq r7, #0@ Move $0.00 amount into r7 subeq r9, r9, #1 str r9, [r10] beq payment b readerror InventInfo: ldr r4, =GAmount ldr r5, =PAmount ldr r6, =CAmount ldr r7, =MAmount @ Load amounts into registers and print respective fields ldr r0, =inventory ldr r1, =GPrompt ldr r2, [r4] bl printf ldr r0, =inventory ldr r1, =PPrompt ldr r2, [r5] bl printf ldr r0, =inventory ldr r1, =CPrompt ldr r2, [r6] bl printf ldr r0, =inventory ldr r1, =MPrompt ldr r2, [r7] bl printf b getInput payment: subs r6, r8, r7@ Test if cash in has surpassed price and branch accordingly ble Return cmp r6, #100@ Split money into dollar and cent amounts if r6 >= 100 subge r6, r6, #100 movge r1, #1 movlt r1, #00@ Else, move 0 into dollar slot ldr r0, =costPrompt@ Print cash request with amount remaining mov r2, r6 bl printf ldr r0, =UserInput ldr r1, =requestInput@ Scan payment in info bl scanf cmp r0, #READERROR beq readerror3@ Ensure valid input ldr r1, =requestInput ldr r4, [r1] cmp r4, #'B' addeq r7, r7, #100@ Add 100 cents to total if $1 bill inserted cmp r4, #'Q' addeq r7, r7, #25@ Add 25 cents to total if Quarter inserted cmp r4, #'D' addeq r7, r7, #10@ Add 10 cents to total if Dime inserted b payment@ payment loop Return: rsb r6, r6, #0 ldr r0, =changeMsg mov r1, r6 bl printf exit: ldr r4, =GAmount
Oct 15, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here