ECE 471 LAB 2 FALL 2008 PURPOSE: Passing arguments on the stack and use of stack frames. Translating C code. EXERCISE: Write and cross-assemble a program that will compute the "age of the moon" (number of days since new) for an array of three dates. The year, month, and date values are in a struct as packed BCD values. Your code should conform exactly to the C (and assembly) code given on the back of the this sheet (however the order of items may be changed). NOTES: Your code should conform exactly to the C (and assembly) code given on the back of the this sheet. Use the data sizes implied by the code (char = byte, int = 2 bytes); Use the HC11 code for BCD conversion verbatim. You may redo comments and spacing for better readability. (I wanted everything to fit on one page.) Each date is stored as a structure consisting of year (a packed BCD word), month (the next BCD byte), and day (the next BCD byte). The struct statement only declares what this structure looks like. Each of the three dates will have this form. You may initialize the values during assembly/download. Reserve memory for the three moon ages. You must use a stack frame to pass arguments to and from getAge. Also use this stack frame to store local variables (C, T, Y, M, and D). Do not use fixed memory locations for any variables used by this routine. This routine should also be transparent (i.e., restore registers on return). In the main program, you must clean up the stack after each call to getAge. Remember to reset the stack pointer to $DFFF at the beginning of the main program to make sure you have enough stack space. The main program can end with a SWI instruction for a graceful return to BUFFALO. Do not use the C compiler to write your code. Your lab notebook should contain this lab sheet, a flowchart or pseudo code of your implementation, and a listing file. Also include a drawing of the entire stack as it would appear inside the call to BCDbyte.