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
Introduction
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:
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.
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:

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:
ReadChar
WriteChar
WriteString

©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
2
1
2
3
4
2
1
3
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:
Lastname-Assn4-Program.asm
Lastname-Assn4-ProgramDocument.docx
For example:
Jones-Assn4-Program.asm
Jones-Assn4-ProgramDocument.docx

©2016, Regis University
Grading
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
accomplishing.
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.
Documentation
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
identifiers.
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.
Individual
calculations and
summations
performed correctly.
Keeps track of counts
correctly.
All if statements
written correctly and
efficiently.
Problems with ONE
of the program
calculations and/or if
statement not written
correctly and
efficiently.
Multiple problems
with program
calculations or if
statements. All calculations
incorrect.

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
pausing,
OR does not satisfy
one of the
requirements. Multiple problems
with display output. No display output
produced.
Demonstrates
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
value).
Multiple problems
with parameter
definition and/or
usage,
OR global variables
were used
OR
several major errors. Does not demonstrate
any understanding or
program or
control/data
structures. Most parameters
incorrectly defined or
passed.
Major coding
standard violations. Program is modular
in design (if
applicable, functions
with arguments, not
including main) and
all are logically
organized with
prototyping.
Each module
performs ONE well- defined task and is
defined and called
correctly.
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
organized.
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
called.
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
organized.
Multiple problems
with parameter
definition and/or
usage.
Program has little
efficient use of code.
More than one
required function
missing, or multiple
problems with
module
definitions/calls. Modules could not be
modified and/or
reused, without
substantial work.
Program is not
modular in design
and is not logically
organized.
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
and/or
has other major
issues.

©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
late
(3% deducted per
day late)
Submitted 4-7 days
late
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.

INCLUDE Irvine32.inc

.data

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

.code
main PROC

call clrscr

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

StateB:
cmp al, ‘1’
je State1

cmp al, 2
je State2

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

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

Quit:
call Crlf
exit
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
ret
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
ret
Count1 ENDP

;———————————————–
Count2 PROC
;
;
;———————————————–
add bl,1
call DisplayMessage1
call WriteInt
call crlf

ret
Count2 ENDP

;———————————————–
DisplayMessage1 PROC
;
;
;———————————————–
push edx
mov edx,OFFSET DisplayMsg1
call WriteString
pop edx
ret
DisplayMessage1 ENDP

END main

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*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
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
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.
Testimonials
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.
Nursing
Thanks.
Customer 453939, May 29th, 2020
Retail
This task was well written Looking forward to your future contribution.
Customer 463463, November 11th, 2022
Nursing
Awesome job, thanks for the quality work!!!
Customer 453939, February 15th, 2020
Psychology
Good job.
Customer 453707, May 8th, 2022
Psychology
Looks great.
Customer 463363, September 23rd, 2022
Nursing
Good well done!!!
Customer 453939, April 2nd, 2020
Education
Excellent.
Customer 452441, April 19th, 2022
Finance/Acc related
Great job!
Customer 460073, August 14th, 2022
Other
Excellent
Customer 463759, January 21st, 2023
History
Just impeccable!
Customer 463001, May 19th, 2022
Communications
The best writer. Thank you!
Customer 462787, August 1st, 2022
SEO
good work
Customer 463813, March 31st, 2023
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
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