ce12_w08_hw6_sol

# ce12_w08_hw6_sol - CMPE 12 Winter 2008 Homework 6: Due...

This preview shows pages 1–2. Sign up to view the full content.

CMPE 12 Winter 2008 Name: SOLUTIONS 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) Memory Location Value x301F (ObjP) x3023 x3020 (Obj) X40 x3021 X56 x3022 #-31 x3023 0 x3024 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
b) (3 pts) What is the value of var4 after this program is done executing? var4 = -31 – x56 + x40 = -53 or xFFCB or -x35 2) In this program, Obj is a 'stack' datastructure. Subroutine FUN1 is a 'push' function. a) (5 pts) What function is subroutine
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 UCSC.

### Page1 / 2

ce12_w08_hw6_sol - CMPE 12 Winter 2008 Homework 6: Due...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online