联系我们: 手动添加方式: 微信>添加朋友>企业微信联系人>13262280223 或者 QQ: 1483266981
University of Liverpool
Department of Computer Science
COMP124 – Computer Systems
Coursework – Assembly Language Programming
Deadline: Wednesday 20th March at 17:00
Weighting: 20%
Follow the instructions to correctly submit your work. Penalties for late work will be applied in accordance
with the Code of Practice on Assessment. Marking criteria are shown at the end of this document.
Overview
The purpose of this assessment is to test your ability to write readable, well-structured, and efficient
assembly language code. Write a small Intel x86 assembly language program that…
Asks the user how many numbers they would like to enter
Loops for the given number of times
Prompts the user to input a number each time round the loop
Displays a summary of how many positive, negative and zero numbers were entered
Your assembly code will be inside an _asm block within a C program, with variables declared using C
syntax, as shown in the lectures. Your assembly code should use the Intel syntax and target a 32-bit CPU.
Create a new Visual Studio project from your existing template. The screenshot below shows the expected
output of the program.
All the aspects of the program are covered in the lab tasks, so your solution will be based on code that
you’ve already written. In particular, you will use code to output strings, input integers, test or compare
register values, jump according to status flags, and loop according to a counter register. You should try to
make your code as optimal and efficient as possible.
Useful Hint
An optimal solution will use very few comparisons and jumps. If you structure the code with one line per
instruction, plus a few blank lines to help readability, an efficient solution will be less than 100 lines. If your
code is getting big and unwieldy, take a step back and think about each aspect of the solution in turn. It has
three distinct parts: Prompting for the initial input, looping and testing each number, and outputting the
results.
Code Comments & Layout
Use the correct notation (C or assembly) to place useful comments within the code. These should help the
reader to understand how your code is structured. Don’t write lengthy comments that get in the way of
readability. Include your student ID as a comment at the top of your code.
Assembly language doesn’t make much use of indentation, but you should still make sure your code is easy
to understand, including correct placement of any code labels. The C code containing your _asm block
should be properly indented.
How to Submit
Locate the Visual Studio project folder in your file system and navigate to the source file. It will have a .cpp
extension. Refer to the very first lab sheet for guidance. Copy this to another location so you don’t corrupt
your project, then change its name so it uses the format below…
username_studentID.cpp
For example, if your username is sgnab23 and your student ID is 201355426, your file would be named…
sgnab23_201355426.cpp
Submit only this single file via the assessment page on Canvas. Please don’t submit any other documents.
We can only mark your work if we can easily locate and open the file. Please do not submit the entire
Visual Studio project. Submissions will only be accepted via Canvas.
If you submit multiple attempts, we’ll mark whichever was submitted most recently (up to the deadline).
Canvas automatically adds a version number to the end of each submission. To be very clear, marks will
not be deducted if Canvas renames your file by putting a number on the end.
Marking Penalties
We will deduct 5 marks if you do not follow the submission and naming instructions. In other words, if we
need to extract your code from a project and/or rename the source file before we can mark it. Standard
late penalties will be applied if you do not submit on time. Do not wait until the final moment to submit
your work, as the deadline is strict.
Non-Working Code
If you can’t complete the solution, or if it doesn’t work, submit something anyway. We can still give some
marks for code that doesn’t work, provided there is something for us to see.
This assessment is worth 20% of the module. If your code doesn’t work (or you don’t submit anything), you
can still pass the module with a good mark if you score well in the class test and the final exam.
Marking Criteria
Your code will be marked manually by loading it into Visual Studio, compiling it, and running it with test
data. You will receive a mark in each of the following categories. The maximum mark is shown for each
category, and the total adds up to 100.
Please note: If your code does not compile on a Lab PC (when we mark it), you cannot receive more than a
bare pass. We will look at your code and give marks for parts that seem to match the criteria, but the
overall mark will be capped at 40.
Readability (4) – How easy it is for us to understand the layout and structure of your code, including
meaningful label and variable names, code indentation, and clearly delineated parts.
Comments (4) – How useful your comments are in helping us to understand what your code does, without
cluttering the code and getting in the way.
Compilation (6) – Whether your code compiles and runs without any errors, or compiles with some
warnings but still runs as expected, or doesn’t compile at all.
Correctness (12) – Whether your code does what it’s supposed to do, as described in the instructions and
screenshot above, including whether it terminates properly or crashes.
Output (10) – Your correct use of the external output routine to display text to the user, and whether you
use the correct calling convention to pass parameters and tidy up.
Input (10) – Your correct use of the external input routine to request data from the user, and whether you
use the correct calling convention to pass parameters and tidy up.
Conditions (15) – Your use of comparisons and jumps to implement branching via code labels, using as few
instructions as possible, and without writing unwieldy spaghetti code.
Looping (15) – Your implementation of the main program loop to request numbers from the user, using as
few instructions as possible and ensuring the loop terminates as expected.
Stack (10) – Your balanced use of the stack to push parameters for external I/O calls, and how efficiently
you clean up the stack after use.
Efficiency (8) – How optimal your code is, in terms of using as few instructions as possible and as little
memory as possible, while implementing a full solution.
Display (6) – How efficiently and effectively you right-align the output, as shown in the screenshot above,
which will require reading beyond the material presented in the lectures.
Code should follow the style and usage demonstrated during the lectures and practiced in the labs. You
will lose marks if your code is written in a different format, syntax, or language. Do not implement your
solution in a high-level language. You are expected to demonstrate an understanding of the lecture
material presented in the first three weeks of the module.
Academic Misconduct
Your submission must be all your own work. Do not share solutions with other students. Do not ask the
teaching assistants for help with this assessment. The penalties for misconduct can be severe.


发表评论