Assignment 6: Recursion in ARM -- 03/02/2020

COSC 2200, Spring 2020

Marquette University, Department of Computer Science

Due (extended): Saturday, March 28, 2020 at 11:59 CDT

Submit: Turn in your two source files using the turnin command on a Systems Lab machine. Please name your files "main-grid.S" and "main-phone.S". Failure to follow this simple convention will cause TA-Bot to fail.
Remember, your final turnin command (to submit your final changes) will look like this:

turnin -c cosc2200 main-grid.S main-phone.S

Work may be completed in teams of two. The names of both partners must appear in a comment block at the top of your file for credit to be given. I strongly recommend that you take the time to meet with your partner in person and work together on these projects, rather than work separately and try to integrate at the last minute. Use the command hook "TA-BOT:MAILTO" in a comment in your source files to designate mail addresses for TA-Bot output. An example of this hook is included for you at line 1 of the "main.S" template (in pi3Playground).

This UNIX tutorial may be of some assistance.

Preparation

Q1 - Grid Printer

Write an ARM Assembly program that reads an integer number of columns, "n", and then prompts for n more integers representing a column coordinate for each row. Print out an n x n grid representation of the data entered, using zero-based coordinates.

I have provided an example program for your reference, runnable on on a lab machine as:

~pmcgee6/cosc2200/bin/hw6-grid

Note: The above example is for you to observe the functionality. TA-bot expects this format:

	Number of rows? 5
	Entry in row 0? 0
	Entry in row 1? 0
	Entry in row 2? 2
	Entry in row 3? 3
	Entry in row 4? 4
	X . . . . 
	X . . . . 
	. . X . . 
	. . . X . 
	. . . . X 
	
	All user process have completed.
	

Your program will need to store an arbitrary number of integers before printing out the results. You may dynamically allocate the space using the malloc() library function.

This type of problem is best implemented using helper functions. (For example, a function printrow(cols, value) that prints out a single row of the grid.) As you write your helper functions, build proper activation records that will allow your functions to strictly abide by the standard calling convention -- this will help a great deal.

Q2 - Phone Codes

Write an ARM Assembly program that reads in digits, and produces all of the possible corresponding phone codes for that phone number. You must write a recursive solution using the stack.
Traditional telephone keypads include alphabet letters underneath the numbers on the keypad, allowing human-readable "mnemonic" codes to map to distinct phone numbers.
Phone Keypad
I have provided an example program for your reference, runnable on a lab machine as:

~pmcgee6/cosc2200/bin/hw6-phone
 

Note: The above example is for you to observe the functionality. TA-bot expects this format:

	? 143
	1GD 1GE 1GF 1HD 1HE 1HF 1ID 1IE 1IF 
	
	All user process have completed.		
		

Your program will need to store the phone number digits, and recursively enumerate all of the possible combinations in order.