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:

Don't use plagiarized sources. Get Your Assignment on
Programming Assignment | Homework Help Websites
Just from $13/Page
Order Now

 

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.

©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 your paper price
Pages (550 words)
Approximate price: -

Why Choose Us

Quality Papers

At Myhomeworkwriters.com, we always aim at 100% customer satisfaction. As such, we never compromise o the quality of our homework services. Our homework helpers ensure that they craft each paper carefully to match the requirements of the instruction form.

Professional Academic Writers

With Myhomeworkwriters.com, every student is guaranteed high-quality, professionally written papers. We ensure that we hire individuals with high academic qualifications who can maintain our quality policy. These writers undergo further training to sharpen their writing skills, making them more competent in writing academic papers.

Affordable Prices

Our company maintains a fair pricing system for all academic writing services to ensure affordability. Our pricing system generates quotations based on the properties of individual papers.

On-Time delivery

My Homework Writers guarantees all students of swift delivery of papers. We understand that time is an essential factor in the academic world. Therefore, we ensure that we deliver the paper on or before the agreed date to give students ample time for reviewing.

100% Originality

Myhomeworkwriters.com maintains a zero-plagiarism policy in all papers. As such, My Homework Writers professional academic writers ensure that they use the students’ instructions to deliver plagiarism-free papers. We are very keen on avoiding any chance of similarities with previous papers.

Customer Support 24/7

Our customer support works around the clock to provide students with assistance or guidance at any time of the day. Students can always communicate with us through our live chat system or our email and receive instant responses. Feel free to contact us via the Chat window or support email: support@myhomeworkwriters.com.

Try it now!

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Homework Writing Services

My Homework Writers holds a reputation for being a platform that provides high-quality homework writing services. All you need to do is provide us with all the necessary requirements of the paper and wait for quality results.

Essays

Essay Writing Services

At My Homework Writers, we have highly qualified academic gurus who will offer great assistance towards completing your essays. Our homework writing service providers are well-versed with all the aspects of developing high-quality and relevant essays.

Admissions

Admission and Business Papers

With Myhomeworkwriters.com, we will help you secure a position at your desired institution. Our essay writing services include the crafting of admissions papers. We will still help you climb your career ladder by helping you write the official papers that will help you secure a job. We will guide you on how to write an outstanding portfolio or resume.

Editing

Editing and Proofreading

Myhomeworkwriters.com has a professional editorial team that will help you organize your paper, paraphrase it, and eliminate any possible mistakes. Also, we will help you check on plagiarism to ensure that your final paper posses quality and originality.

Coursework

Technical papers

My Homework Writers harbors professional academic writers from diverse academic disciplines. As such, we can develop homework writing services in all academic areas. The simplicity or complexity of the paper does not affect the quality of homework writing services.