hw17SLN - ECE 212 HW Set 17 SOLUTIONS p 1 of 9...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 212 HW Set 17 SOLUTIONS p 1 of 9 //home/vdimitrov/7453/f506dd8dc2ce1e348e132902cbbb3505da34075a.doc ECE 212 Homework Set 17 – SOLUTIONS 1. In the program below, the main program saves the register contents on the stack before calling a subroutine. Below are memory contents and the Stack Pointer before the program executes. Give the memory contents and the Stack Pointer after the bsr s1 instruction executes. 7 main: 8 ; . . . Register Conetents 9 ; A B X Y 10 ; 36 5C EACD B03C 11 0100 36 12 psha ;Save 0101 37 13 pshb ; all 0102 3C 14 pshx ; the 0103 183C 15 pshy ; registers. 0105 8D04 16 bsr s1 ;Call the subroutine. 0107 01 17 nop 18 ; . . . ;Restore the registers. 19 ; . . . 0108 7EFF7C 20 jmp Monitor 21 22 ;Subroutine s1 23 s1: 24 ; . . . 010B 39 25 rts
Background image of page 1

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

View Full Document Right Arrow Icon
ECE 212 HW Set 17 SOLUTIONS p 2 of 9 (1.) Solution:
Background image of page 2
HW Set 17 SOLUTIONS p 3 of 9 2. In the program below, the subroutine saves the register contents on the stack. Below are memory contents and the Stack Pointer before the program executes. Give the memory contents and the Stack Pointer after the pshy instruction executes. Program execution begins with main . 7 main: 0100 01 8 nop 0101 01 9 nop 0102 8D04 10 bsr s1 ;Call the subroutine. 0104 01 11 nop 12 ; . . . 0105 7EFF7C 13 jmp Monitor 14 15 ;Subroutine s1 16 s1: ;Register Contents 17 ; A B X Y 18 ; 36 5C EACD B03C 0108 36 19 psha ;Save 0109 37 20 pshb ; all 010A 3C 21 pshx ; the 010B 183C 22 pshy ; registers. 23
Background image of page 3

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

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

{[ snackBarMessage ]}

Page1 / 9

hw17SLN - ECE 212 HW Set 17 SOLUTIONS p 1 of 9...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online