Stack_Examples_Sol

Stack_Examples_Sol - II Just after the first execution of...

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

View Full Document Right Arrow Icon
Stack Sample Solutions ORG $0F00 0F00 START MOVE.L #L0+2,D4 0F06 MOVE.L L0+2,D5 0F0C MOVE.L #$F13B9475,D1 0F12 L0 SUBI.L #L0+8,D1 0F18 MOVE.L #$FF,D0 0F1E ROL.L D0,D1 0F20 MOVE.L D1,VAR_1 0F26 BSR.L SUB 0F2A VAR_1 DS.L 1 0F2E VAR_2 DS.L 1 0F32 MOVE.L VAR_2,D1 0F36 STOP #$2700 ORG $1000 1000 SUB MOVEA.L (SP),A4 1002 MOVE.L D4,-(SP) 1004 MOVE.L (A4)+,D4 1006 ASR.L D0,D4 1008 MOVE.L D4,(A4)+ 100A MOVE.L (SP)+,D4 100C MOVE.L A4,(SP) 100E RTS 1010 END START b.)(VAR_1) = $F89DC2AD (VAR_2) = $FFFFFFFF (D0) = $000000FF (D1) = $FFFFFFFF (D4) = $00000F14 (D5) = $00000F1A (A4) = $00000F32 c.) 3FE8 3FEC 3FF0 0000 0F14 3FF4 0000 0F2A Initially 3FF8 <- (SP)=3FF8 Hint: This is an absolute address a.)(VAR_1) = $F89DC2AD (VAR_2) = $-------- (D0) = $000000FF (D4) = $00000F14
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
1.) (35) Consider the following assembly code. a.) Show the word content (in hex) of registers D0, D1, SP, and PC: I. Just after execution of the BSR instruction at location L1
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: II. Just after the first execution of the BSR instruction at L2 III. Just after the first RTS instruction execution IV. After execution of the STOP instruction b.) Show the machine code of the two BSR instructions in hex. c.) Show the contents of the stack at its fullest. d.) What arithmetic function is this code performing? b.) Machine code for: BSR.L SUB1 at L1 : 6100 00FA BSR.S SUB1 at L2 : 61F6 c.) 3FE0 0000 100A 3FE4 0000 100A 3FE8 0000 100A 3FEC 0000 100A 3FF0 0000 100A 3FF4 0000 Initially 0F08 (SP)=3FF8 --> 3FF8 d.) What function or operation is this code performing? D1 x 2 D0 (D0) (D1) (SP) (PC) I) 0005 0001 3FF4 1000 II) 0004 0002 3FF0 1000 III) 0000 0020 3FE4 100A IV) 0000 0020 3FF8 0F0C ORG $0F00 0F00 START MOVE.L #5,D0 0F02 MOVE.L #1,D1 0F04 L1 BSR.L SUB1 0F08 STOP #$2700 ORG $1000 1000 SUB1 TST.L D0 1002 BEQ.S EXIT 1004 LSL.L #1,D1 1006 SUBI.L #1,D0 1008 L2 BSR.S SUB1 100A EXIT RTS...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

Stack_Examples_Sol - II Just after the first execution of...

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

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