HW3 - 0306-250 Assembly Language Programming Fall 2009...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0306-250 Assembly Language Programming Fall 2009 Homework Three Solution 1. Write an assembly language subroutine Total according to these specifications. · Accepts a pointer to an array of words in register X. · Accepts a word value in register Y, which indicates the number of array elements. · Returns the sum of the array elements in register D. · On return, preserves contents of all registers, other than return result register. (continued on next page) Page 1 of 2 0306-250 20091 Homework Three Page 2 of 2 2. For the subroutine specified below, write an assembly language code fragment to set the input parameters for the subroutine, call the subroutine, and retrieve the return parameters. Note: Do not write the subroutine—just setup the call, call it, and process the return. MatrixMult: ;************************************************ ; This subroutine performs matrix multiplication: ; MatrixF = MatrixP * MatrixQ ; Input parameters: ; 6,SP: Address of first element of MatrixP ; 4,SP: Address of first element of MatrixQ ; 2,SP: Address of first element of MatrixF ; X: Number of Rows and Columns in MatrixP ; D: Number of Rows and Columns in MatrixQ ; Output parameters: ; D: Number of Rows and Columns of MatrixF ; C (bit in CCR): 0: multiplication successful; ; 1: otherwise ; No other registers modified. ; NOTE: For number of rows and columns parameters, ; the most significant byte of the register ; must contain the number of rows, ; and the least significant byte must contain ; the number of columns. ;************************************************ ; . . . Unspecified code/algorithm . . . ;************************************************ rts Your code fragment to call should use the variable and symbol definitions that follow. It should use MatrixMult to compute the product of matrix P and matrix Q and to store the result in matrix F. In addition your code fragment should set the row and column variables of matrix F if and only if no errors were detected during the multiplication operation. P_ROWS: P_COLS: MatrixP: Q_ROWS: Q_COLS: MatrixQ: MatrixF: FRows: FCols: EQU EQU DS.W EQU EQU DS.W DS.W DS.B DS.B 33 44 (P_ROWS*P_COLS) 44 50 (Q_ROWS*Q_COLS) 2000 1 1 Grading Criteria · · 10%: Code format—proper indentation, proper comments. etc., (especially proper subroutine descriptive header comments) 90%: Correct passing and use of parameters ...
View Full Document

This note was uploaded on 05/06/2010 for the course EECC 0306-250 taught by Professor Roymelton during the Fall '10 term at RIT.

Ask a homework question - tutors are online