Programming Assignment | Homework Help Websites

©2016, Regis University
Regis University CC&IS
CS370 Assembly Language
Programming Assignment 4
Due by: midnight Sunday of Week 4
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
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:
If the 2s count was three, then the 2s count is now two.
If the 2s count was two, then the 2s count is now one.
If the 2s count was one, then the 2s count is now zero.
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.
Pressing the 4 button is the same as pressing the 2 button twice in that pressing the 4
button will increment the 2s count by two.
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.
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:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper


professional writing services near me
The start state.
The terminal state(s).
©2016, Regis University
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):
GetButtonPress this UDP shall:
Prompt 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.
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 l
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 DisplayMessage procedure, after each button press, that
describes t
Enters a termination state once the lock is opened.
Is formatted and commented as required by the CS370 Coding and Documentation
Standards. Does not use the .IF, .REPEAT, or .WHILE directives of MASM. Allowed Irvine Procedure Calls:

©2016, Regis University
Sample Program Input and Output:
Program Documentation
Create your program document which contains:
Algorithms as pseudo-code (C++ structure, but does not have to strictly adhere to the
syntax of the language).
A test plan and results. Input values Expected Result Actual Result
The lock 2s count = 0
The lock 2s count = 1
The lock 2s count = 0
The lock 2s count = 1
The lock 2s count = 0
The lock 2s count = 2
The lock 2s count = 3
The lock 2s count = 2
The lock is open!
A test plan should be created before running the program in order to have tests that will
determine whether the program works correctly or not.
©2016, Regis University
Program Submission
Submit each of program documents to the Assignment 4 Dropbox.
Before submitting your program deliverables, you MUST name them as follows:
For example:

©2016, Regis University
The following rubric will be used to grade your program. Rating Category Exemplary Partially Proficient Basic
(needs work)
Not Demonstrated
Documentation is
well written, clearly
explains what the
code is
Includes complete
and accurate file and
function headers, as
detailed in the CS370
coding standards, along with additional
in-line comments at
all appropriate and
necessary locations.
includes file header,
function headers, and
inline comments, but
may lack clarity or
details in some
instances, OR may
have violated some
minor details of the
CS370 coding
standards. Documentation is
incomplete and/or
incorrect and/or
formatted incorrectly.
Violated significant
details of the CS370
coding standards or
the underlying
program intent. Only a few (or no)
comments in
program. Constants used where
appropriate, correct
data types used for
variables. Constant, variables defined
within correct
program scope.
Followed CS370
coding standards
naming conventions
and used descriptive
names for all
A few minor errors in
data declaration
scope, data typing or
assignment, or may
have violated some
minor details of the
CS370 coding
standards. One or more major
errors, or may have violated
significant details of
the CS370 coding
standards. Constants not used,
identifier names are
not descriptive,
and/or there are
multiple errors in the
data types assigned.
Reads data correctly,
correctly handling
multiple records per
line. Recognizes end
of line correctly.
Recognizes end of
file correctly,
whether the file
contains a newline on
the last line or not.
Last data line is
duplicated or not
read, but rest of lines
are handled correctly
OR other minor
issues in reading and
processing data.
Does not correctly
handle multiple
records per line, OR
major/many issues in
reading and
processing data.
Was not able to read
data from the file.
calculations and
performed correctly.
Keeps track of counts
All if statements
written correctly and
Problems with ONE
of the program
calculations and/or if
statement not written
correctly and
Multiple problems
with program
calculations or if
statements. All calculations

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

©2016, Regis University
All required screen
output is displayed
neatly in columns
under correct
headers. Display pauses for
long files. Problems with
display formatting or
OR does not satisfy
one of the
requirements. Multiple problems
with display output. No display output
understanding of
program structure,
control structures, and file structure.
Appropriate use of
language with correct
parameter passing
and no global
variable usage.
Follows all of the
coding standards for
code usage.
Most parameters are
defined and passed
correctly with no
global variable
usage, but there are
minor errors (e.g.
parameter passed by
reference when it
should be passed by
Multiple problems
with parameter
definition and/or
OR global variables
were used
several major errors. Does not demonstrate
any understanding or
program or
structures. Most parameters
incorrectly defined or
Major coding
standard violations. Program is modular
in design (if
applicable, functions
with arguments, not
including main) and
all are logically
organized with
Each module
performs ONE well- defined task and is
defined and called
Program uses code
efficiently. The
program modules can
be easily modified
and/or reused with
minimal work.
Program is modular
in design and is
mostly logically
Most of program has
efficient use of code.
May be missing one
required function,
contain a module that
performs too many
tasks, or have one
function that is
incorrectly defined or
Some of the program
modules can be
easily modified
and/or reused with
minimal work.
Program is modular
in design and some
parts are logically
Multiple problems
with parameter
definition and/or
Program has little
efficient use of code.
More than one
required function
missing, or multiple
problems with
definitions/calls. Modules could not be
modified and/or
reused, without
substantial work.
Program is not
modular in design
and is not logically
Program has little
efficient use of code
and program
compactness. The program
modules cannot be
easily modified
and/or debugged.
Code is exceptionally
well organized and
very easy to follow
and has no issues. Code is fairly easy to
read, but there are
some spacing,
indentation, and/or
other issues. Code is readable only
by someone who
already knows what
it is supposed to be
doing and/or there
are substantial
spacing, indentation,
and/or other issues. The code is poorly
organized and very
difficult to read
has other major

©2016, Regis University
Test plan includes
rationale and tests that
validate ALL logic.
Missing parts of
rationale or missing
tests of some logic.
Missing all rationale
and/or missing many
tests of the logic.
No test plan submitted.
Submitted on time Submitted 1-3 days
(3% deducted per
day late)
Submitted 4-7 days
Not submitted within
1 week of due date

; Finite State Machine (Finite.asm)

; This program implements a finite state machine that
; accepts an integer with an optional leading sign.



ReadInt proto
WriteInt proto
WriteString proto

prompt BYTE “Please press a button (1,2,3, or 4): “,0
DisplayMsg1 BYTE “The lock 2s count = “,0
;DisplayMsg11 BYTE “The lock is open!”,0

main PROC

call clrscr

call GetButtonPress
cmp al, 4-1
je StateB
;loop StateA

cmp al, ‘1’
je State1

cmp al, 2
je State2

cmp al, ‘1’
mov bl, al
call Count1
loop StateA

cmp al,2
mov bl, al
call Count2
loop StateA

call Crlf
main ENDP

GetButtonPress PROC
; Reads a character from standard input.
; Receives: nothing
; Returns: AL contains the character
mov edx, OFFSET prompt
call WriteString ; input from keyboard
call ReadInt ; echo on screen
GetButtonPress ENDP

Count1 PROC
; with the user integer stored in al
; subtract 1 from the al register

sub bl,1
call DisplayMessage1
call WriteInt
call crlf
Count1 ENDP

Count2 PROC
add bl,1
call DisplayMessage1
call WriteInt
call crlf

Count2 ENDP

DisplayMessage1 PROC
push edx
mov edx,OFFSET DisplayMsg1
call WriteString
pop edx
DisplayMessage1 ENDP

END main

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works

Here is how simple it is to make use of our essay writing services

step 1

Submit a "write my essay for me" request

Fill out a quick order form and provide detailed requirements as to the paper, its format, etc. You can even attach screenshots or add additional instructions later. If something has to be clarified or added, the writer will contact you directly.
Pro service tips
How to get the most out of your experience with Homework Writing Services
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Human Resources Management (HRM)
Good work.
Customer 463125, July 4th, 2022
Thanks for the amazing PPT!!!!
Customer 454007, June 8th, 2020
English 101
Good work.
Customer 453625, May 25th, 2022
Very good job.
Customer 456821, April 8th, 2022
Customer 463469, October 18th, 2022
Customer 452441, April 6th, 2022
good job
Customer 456821, October 24th, 2022
Thank you for following all instructions. Good piece
Customer 463337, March 1st, 2023
Good follow-up task.
Customer 459155, April 7th, 2022
Thank you for doing a great job. I really am glad that you did not use someones else work like the first person who did this did. Awesome job. Because of this I will continue to use this site!
Customer 454345, June 2nd, 2020
Marketing & Advertising
Always capitalize in AP style.
Customer 452441, April 1st, 2022
Good job
Customer 456821, November 28th, 2022
Customer reviews in total
Current satisfaction rate
3 pages
Average paper length
Customers referred by a friend
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat