程序代写代做 assembly data structure graph MARIE

MARIE
In this task you will develop a MARIE application that performs some manipulation of strings. We will break it down into small steps for you.

Most of the tasks require you to write the code, test cases and some small analysis. The code must contain comments, and you must submit it as .mas files together with the rest of your assignment. The test cases should also be working, self-contained MARIE assembly files (without requiring much input from the user). The analysis needs to be submitted as part of the main PDF file you submit for this assignment.

Name as Strings
This section introduces the concepts you need for the rest of the assignment.

A string is a sequence of characters. It’s the basic data structure for storing text in a computer. There are several different ways of representing a string in memory and how to deal with strings of arbitrary length.
For this assignment, we will use the following string representation:

• A string is represented in a contiguous memory location, with each address containing a single character.
• The characters are encoded using the ASCII encoding.
• End of a string is marked by the ASCII character ‘0’.
• A name will be composed of two strings, namely, First Name and Last Name.
• End of a name will be marked by another ASCII character ‘0’.
As an example, this is how, a name “John Noah” would be represented in memory (written as hexadecimal numbers):

04A
06F
068
06E
030
04E
06F
061
068
030
030
J
o
h
n
0
N
o
a
h
0
0

Note that for a string with n characters, we need n + 3 words of memory in order to store all the characters belonging to a first name, last name and the additional ‘0’s that marks the end of each of the two strings, i.e. First Name and Last name, and end of the name.

In MARIE assembly language programming, we can make use of the ADR command, the HEX keyword and a label “myName” to put this string into memory:

myNameAdd, ADR myName
myName,
HEX 04A
//J

HEX 06F
//o

HEX 068
//h

HEX 06E
//n

HEX 030
//0

HEX 04E
//N

HEX 06F
//o

HEX 061
//a

HEX 068
//h

HEX 030
//0

HEX 030
//0

Write a main program and a subroutine for entering minimum of three names from the keyboard and printing them at the end of data entry. (25 marks)
Prepare a MARIE program to enter your full name using Unicode / ASCII characters. You should be able enter at most 5 characters for each part of your name (First Name or Last Name)– if your name is longer, you can shorten it (limit the maximum number of characters per full name to 11, including the space character).
You need to submit a MARIE file that contains code, so that after assembling and running the program it should prompt for first name and last name. The program should store full names in MARIE memory and print them at the end.

The code should focus on getting the full names as input from keyboard and storing them in a particular location in MARIE memory. For this task, prepare a MARIE subroutine called subInputNames to input names from keyboard. Your subroutine should take (Unicode /ASCII) ‘0’ terminated First name and (Unicode /ASCII) ‘0’ ‘0’ terminated Last name as described in the previous section. The names are to be stored starting from the memory address 300H. A single name (First Name and Last Name) in a row of MARIE memory. After entering a last name, a second Unicode/ASCII ‘0’ will be stored to mark the end of the full name in the memory, and the program should proceed to take the next name, which is to be stored at memory location 310H. This location is one row (16 words) ahead from the memory location of the previous name entry. You can use memory locations 320H, 330H , … to store more names respectively. After entering a full name, a ‘$’ from input will terminate the entire name entry process and will return control to the calling program. You may need to store the ‘$’ entered instead of ‘0’ ‘0’ and consider that as the placeholder for the end of the sequence. Your program must take names infinitely until a user enters a ‘$’ to stop taking inputs. You can verify the correct working of your program by viewing the memory content starting from #300H.

Then, in the second part of the code is to prepare a MARIE subroutine called printStringName that can print all the full names stored, i.e. it should print out the full names entered earlier and saved by the program (using the “Output” instruction).

Start by using a label “PrintName” that holds the start address of a name string (like, myNameAdd in the example above). The code should then load a character from that address, output it if it is not ‘0’, then increment the address by one, and keep doing that until the character loaded from the address is a ‘0’ (which signals the end of the string / end of the first name). Then, print an ASCII “Space” character, and proceed to print the second part of the name string, i.e. Last Name until the character loaded from the address is a ‘0’ (which signals the end of the string / end of the last name). Then, when you load the second ASCII ‘0’ which marks the “end of a name”, print an ASCII “New Line” character and proceed to print the next name. If the loaded character is ‘$’, the subroutine needs to stop printing and gives control to the main program. For this task, you may use three names (your First Name and Last Name, your friend’s name and your tutor’s name) to enter from keyboard and also to print the names after entering the three names, the names should not be hard coded and assigned a label to identify each of the three names.

To receive full marks, your code needs to be in the form of a main program and use of subroutine that can be called using the JnS instruction. You need to write a MARIE main program to call the subroutine you created accordingly. Save your code as “2_1_Enter_and_PrintingNames.mas”.
A three function Calculator in MARIE
In this task you will develop a MARIE program that performs three mathematical functions of a calculator – multiplication, division and exponent.

The program should be performing the user selected tasks (one of the mentioned mathematical operations) after the user enters one of the selections, ‘m’, ‘d’, or ‘e’. Here, input ‘m’ selects multiplication process, ‘d’ selects division process and ‘e’ is for calculating exponent. User enters ‘q’ to quit the program. If the user input is ‘m’, ‘d’, or ‘e’, then the program should ask for operands x and y and displays the result.
Example:
• INPUT SELECTION = ‘m’ and the input numbers are ‘x’ & ‘y’ then the resultant output = ‘x * y’
• INPUT SELECTION = ‘d’ and the input numbers are ‘x’ & ‘y’ then the resultant output = ‘x/y’
• INPUT SELECTION = ‘e’ and the input numbers are ‘x’ & ‘y’ then the resultant output
= ‘xy’
• INPUT SELECTION = ‘q’ simply quits the program and exit. The program should run infinitely, until a user enters ‘q’.

You are required to write subroutines (for each operation) to perform these tasks (multiplication, division and exponent) and write a main program to process user operation selection, accept the ‘x’ & ‘y’ inputs and call the appropriate subroutine thereof. The codes must contain comments, as a paragraph before any block of code (i.e. subroutine) or as inline comments wherever appropriate. You should submit the “2_2_Calculator.mas” file together with the rest of your assignment.

Files to be submitted:
One zipped folder named “YourFirstName_LastName_StudentID.zip” containing the following files.

• Report for the written tasks
(One PDF file called YourFirstName_LastName_ StudentID.pdf).
• The report should include your Full name, your student ID, your class number and your tutor’s name.
• Include the original truth table in the pdf.
• The pdf report should show the workings for the following:
• Subtask-1: Optimize the function using Karnaugh maps to its minimal form
• Subtask-2: Optimize the function using Boolean identities and verify its minimal form from the subtask-1.
• You will need to include two Karnaugh maps worked on two separate Boolean Identities reduction forms, one for each output Z1 & Z2. Your documentation must show
• the K-maps.
• the groups found in the maps
• The Boolean identities reduction steps
• and how they relate to terms in the optimized Boolean function.
• Documentation related to Task 2, if there is any.

• Task 1.2 – Logisim File. Name the file as “LogicCircuit.circ”.
• Task 1.3 – Logisim File. Name the file as “OptimizedCircuit.circ”
• Task 2.1 – MARIE File. Name the file as “2_1_Enter_and_PrintingNames.mas” 5. Task 2.2 – MARIE File. Name the file as “2_2_Calculator.mas”

Zip the folder with this name (YourFirstName_LastName_StudentID.zip) and submit it to Moodle. You need to make sure there are no spaces in any of the filenames.

• End of Assignment 1