ce12_w08_hw6 - CMPE 12 Winter 2008 Homework 6: Due February...

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

View Full Document Right Arrow Icon
CMPE 12 Winter 2008 Name:________________ Homework 6: Due February 27 Email:________________ .orig x3000 INIT: LD R0, var1 JSR FUN1 LD R0, var2 JSR FUN1 LD R0, var3 JSR FUN1 AND R1, R1, 0 MAIN: JSR FUN2 ADD R1, R0, 0 JSR FUN2 NOT R0, R0 ADD R0, R0, #1 ADD R1, R0, R1 JSR FUN2 ADD R1, R0, R1 ST R1, var4 HALT FUN1: LD R6, ObjP STR R0, R6, 0 ADD R6, R6, #1 ST R6, ObjP RET FUN2: LD R6, ObjP ADD R6, R6, #-1 LDR R0, R6, 0 ST R6, ObjP RET var1: .FILL x40 var2: .FILL x56 var3: .FILL #-31 var4: .FILL 0 ObjP: .FILL Obj Obj: .BLKW 5 .end 1) a) (12 pts) When the PC reaches MAIN , what are the values stored in x301F-x3024? ( ObjP = x301F) b) (3 pts) What is the value of var4 after this program is done executing? 2) In this program, Obj is a 'stack' datastructure. Subroutine FUN1 is a 'push' function. a) (5 pts) What function is subroutine FUN2 ? c) (4 pts) Which register is acting as the stack pointer?
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/06/2009 for the course CMPE 12 taught by Professor Diblas during the Fall '08 term at University of California, Santa Cruz.

Ask a homework question - tutors are online