2.1 Write a main program and a subroutine for entering minimum of three names from the keyboard…

2.1 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 4 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”.

You don't know how to answer this question. We can help you find the right answer.

We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount! Use Discount Code "save15" for a 15% Discount!

Get Started

No need to wonder who can do my homework. You can always reach our team of professionals to do your homework at a low price.