Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simply written in assembly language. New learner so please add comments for understanding. Will be using visual studio for this. Sample output would be The

Simply written in assembly language. New learner so please add comments for understanding. Will be using visual studio for this.

Sample output would be

The lock 2s count = 0

please press a button (1,2, or 3): 2

the lock 2s count = 1

please press a button (1,2, or 3):1

etc...

image text in transcribed

image text in transcribed

For this assignment you will create a combination lock simulation. The combination lock has four buttons, numbered 1, 2, 3 and 4. The lock will open if the buttons are pressed in a correct sequence The rules for the combination lock are: The combination lock starts in a state where its 2s count is zero. Pressing the 1 button causes the lock to decrement the 2s count. The 2s count cannot be less than zero. For example: o If the 2s count was three, then the 2s count is now two. o If the 2s count was two, then the 2s count is now one. o If the 2s count was one, then the 2s count is now zero. o If the 2s count was zero, then the 2s count remains 0 Pressing the 2 button causes the lock to increment its 2s count by one. Pressing the 3 button causes the lock to open if 2s count is exactly two. If that is not the case, the lock remains locked and the 2s count is set to zero. ressing the 4 button is the same as pressing the 2 button twice in that button will increment the 2s count by two .P pressing the 4 The lock's memory can only store three 2s. If a button press will cause the 2s count to be greater than three, then the 2s count will be equal to three. Requirements Design a finite state machine (FSM) for the combination lock. The FSM design will be included in the problem document and will consist of All states of the FSM, labeled (the label being an integer stating how far the current state is from the start state). This also includes o The start state. o The terminal state(s). All possible transitions (arrows) from one state to another, labeled (the label being the button press that triggers that particular transition). .For every possible state and every valid button press, there must be a transition Create a program that: Has three user-defined procedures (UDPs) o GetButtonPress-this UDP shall pt the user to enter an integer in the range of 1 to 4. Validate that the integer is actually in the range of 1 to 4. If valid, print the integer to the screen .If not valid, do not prompt the user, but wait for another button press. Keep waiting until a valid value is entered Return the validated value in the AL register o DisplayMessage-this UDP shall .Accept an integer that is passed in the AL register Based on the integer value, displays a message about the state of the combination lock Divides the main procedure into sections with labels describing the combination lock's state. For example, State0 for no 2s count, State1, for a 2s count of 1, etc Accepts button presses from the user using the GetButtonPress procedure. Displays a message, using the DisplayM essage procedure, after each button press, that describes the combination lock's state Enters a termination state once the lock is opened Does not use the IF, REPEAT, or WHILE directives of MASM Allowed Irvine Procedure Calls: . ReadChar WriteChar . WriteString

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

ISBN: 1489982175, 978-1489982179

More Books

Students also viewed these Databases questions