Reference no: EM13348001
2. The MARIE Simulator
The MARIE simulator is provided as a zip file containing Java archives (*.jar) files, documentation, and example source files. Unzip the file to a directory for use. Do the following to become familiar with the MARIE simulator.
- Read "A Quick Start Guide for the MARIE Machine Simulator Environment" (QuickGuide.pdf provided in the zip file).
- Depending on how comfortable you are with using the MARIE simulator after reading the quick start guide, you may also wish to read "A Guide to the MARIE Machine Simulator Environment" (MarieGuide.pdf provided in the zip file).
- Review the example assembly language source files and experiment with the MARIE simulator using these examples. The Ex4_1.mas example is likely the most relevant to this assignment.
You are to use the MARIE simulator (MarieSim.jar) to complete this project. You will not be using the data path simulator (MarieDP1.jar). Also, note that the Marie simulator requires Java version 5 or later to be installed on your computer.
3. Design Specification
You are to design, write, test, and debug a MARIE assembly language program that counts the number of instances of a particular value in a set of words.
A template source code file (Project-2_Start.mas) is provided with this assignment. Edit this file to meet the program specifications. Note that the template includes instructions to initialize some working values that your program can use. The template also defines memory locations. You may add data memory locations, but it is not necessary to do so.
For full credit, your solution must perform the required function and must satisfy the following requirements.
a) The first instruction of the program must be placed at location (address) 0x100 (100 hexadecimal) in MARIE's memory. This is accomplished by following the program template that is provided.
b) The constant data values (One, Words, Key, and Base) should not be changed by the program. The program can load from these memory locations, but should not store to them. The array of word values that are to be processed by the program should be in successive memory locations beginning at location Array as indicated in the template file. The program should not change any of the data values in the array. These values should all be "hard-coded" into the program. Note that you will need to set the value in location Base depending on where the assembler places the array, as indicated in the listing file.
c) The program should always initialize the values for Cnt, Ptr, and Match in the working data memory and not rely on the values for these locations that are defined in the assembly source file. This initialization is done by the provided template file.
d) The program should work for any value in location Words and Key and for any set of values in the array of words, not just those provided in the template file. The value in location Words must be greater than or equal to 1. Test the program with some different values.
e) The program must place the final value for the count of matching words in location Match.
f) The program must use a loop and indirect addressing to access the values in the array of words.
Note that variables Ptr, Cnt, and Match are initialized in the template code and should be used in the loop.
Note that one solution for the project requires about 15 additional instructions to implement the correct loop. If you find that you are using significantly more instructions than this, you should reconsider your design and, as needed, consult with the GTA and/or instructor.
4. Testing
Test and debug the program using the MARIE simulator (MarieSim.jar). Debug the program using the "Step" function in the simulator. You must test your program with the following three test cases.
Test 1: Use the values for Words, Key, and the word array that are specified in the template file, assemble, and test.
Test 2: Change the value of Key to be "0000" (instead of "00AA") and change the value of Words to be decimal "10" (instead of "30"), reassemble, load, and test.
Test 3: Change the values of Key and Words and at least some of the values in the word array to values of your choice, reassemble, load, and test.
When you create your source file within MarieSim (using the File > Edit menu pick), use file name lastname_firstname_p2.mas, where "lastname" is your last or family name and "firstname" is your first or given name. You can assemble your source file in the editor program. The assembly process creates a listing file (lastname_firstname_p2.lst) and an executable file (lastname_firstname_p2.mex). Load the executable file into the simulator for execution.