You are given a string of essentially random characters, and your task is to replace all non-numeric characters with space characters.
4 Instructions
The following files have been provided for you:
- timedlab3.asm
You will be editing timedlab3.asm to replace instances of non-numeric characters in a string with space characters. The space character (i.e. ) corresponds to decimal value 32 in ASCII. All other ASCII characters in the provided string, outside of the range 09 should be replaced with .
Remember: Strings are zero-terminated arrays of characters!
An ASCII table has been provided for your reference at the end of this document: The space character is highlighted with red and the numeric digits are highlighted with yellow .
We have defined the following assembly language labels for you:
- STR ADDR: The address of the beginning of the string Consider the following examples:
Before | After |
a3hf5k32ss | 3 5 32 |
A3HF5K32SS | 3 5 32 |
aBcD3fGhIj | 3 |
Note: Replace characters in the existing string. Do not copy it!
Hint: You may create your own labels with .fills!
4.1 Restrictions
You are not allowed to use the JSR and JSRR instructions for this assignment. In addition, you are not allowed to use Appendix-A or the textbook during this timed lab.
5 Testing Your Work
To test your program, upload timedlab3.asm to the Timed Lab 3 assignment on Gradescope. You may resubmit your work as many times as needed, until you sign out and leave the classroom.
6 Common Errors
To trace problems with your code, load the file into complx, the LC-3 simulator. To use complx:
- In the Terminal, type complx
- In the File menu, click Reload, and open your assembly file (asm)
- Use the Step button to run each instruction one step at a time, or use the Run button to execute all of the instructions until HALT
7 Rubric
The output of the Gradescope autograder is an approximation of your score on this assignment. The tool is provided so you can evaluate whether your submission fulfills the assignment expectations.
However, we reserve the right to run additional tests, fewer tests, different tests, or potentially change individual tests your final score will be determined by your instructors, and there is no guarantee your score will correlate with tester output.
8 Deliverables
Please upload the following files to the assignment on Gradescope:
- timedlab3.asm
Do NOT upload an archive, upload the file individually.
Be sure to check your Gradescope test score before you leave the room.
9 LC-3 Assembly Programming Requirements
9.1 Overview
- Your code must assemble with NO WARNINGS OR ERRORS. To assemble your program, open the file with Complx. It will complain if there are any issues. If the code in this file does not assemble, you WILL get a zero for that file.
- Comment your code! This is especially important in assembly, because its much harder to interpret what is happening later, and youll be glad you left yourself notes on what certain instructions are contributing to the code. Comment things like what registers are being used for and what less intuitive lines of code are actually doing. To comment code in LC-3 assembly just type a semicolon (;), and the rest of that line will be a comment.
- Avoid stating the obvious in your comments; it doesnt help in understanding what the code is doing. Try to write high-level pseudo-code instead!
Good Comment
ADD R3, R3, -1 | ; counter |
BRp LOOPBad Comment | ; if counter == 0 dont loop again |
ADD R3, R3, -1 | ; Decrement R3 |
BRp LOOP | ; Branch to LOOP if positive |
Reviews
There are no reviews yet.