Write a short (~15 lines) LC-3 machine code program that processes data that we provide that you may assume starts at address x3000. The data is a variable number of values in a list, and the end of the list is marked with a terminating value that is 0. Process each value in the list following this simple algorithm:
Initialize index to zero
For each data value
Add index to the value
Output the resulting sum as an ASCII character
Increment index
Repeat for the next data value until the terminating value is reached
Halt the program
The first list of data below is for developing your program. If your program is working correctly, it will display "CS" and then halt. Recall that the first line is the starting address that LC3 Tutor requires.
0011 0000 0000 0000
0000 0000 0100 0011
0000 0000 0101 0010
0000 0000 0000 0000
;
Use the larger list of data below to confirm your program still works for a different size list. Without changing any of your program's instructions, just replace the data and run the program. A working program will display a recognizable word, name, or phrase.
0011 0000 0000 0000
0000 0000 0100 0011
0000 0000 0110 1110
0000 0000 0110 1011
0000 0000 0110 1101
0000 0000 0100 1111
0000 0000 0101 1110
0000 0000 0110 0011
0000 0000 0000 0000
;
ASIDE: Recall LC3 Tutor begins executing instructions at the address specified in the first line (i.e., x3000), but that's the start of the list of data. How does execution skip over this data to get to your code? It actually executes each data value as an instruction, but the execution does nothing! As discussed in lecture, any data of the form 0000 0000 XXXX XXXX is executed as a "branch never" operation, which is consider a NOP since it does No OPeration.
Provide the complete machine code including the larger list of data above followed by your program's instructions. Assembly code programs will not receive credit. For grading, we'll copy and paste your submission into LC3 Tutor's RAW editor. For full credit, your submission should process without any errors, load into the simulator, and run displaying the correct result. We will also run your code on a secret list of data of a different size to confirm your program operates as specified. You may assume this secret data list is in the correct format - a list of values terminated with a 0.
Not the question you are looking for? Ask here!
Enter question by text
Enter question by image
Unlock Smarter Learning with AskSia Super!
Join Super, our all-in-one AI solution that can greatly improve your learning efficiency.