Fill xfff6 negative value of character n r0tmp fill 0

This preview shows page 6 - 9 out of 9 pages.

NEGCHAR .FILL xFFF6 ; Negative value of character '\n' R0_TMP .FILL 0 R1_TMP .FILL 0 R2_TMP .FILL 0 .END b. Assume the above assembly code is a service routine that can be called using TRAP x55. What is the address of the corresponding System Control Block entry and what are its contents? Give your answer in hex. (1 Point) Address of trap vector table entry Contents at this memory location 0x0055 0x0650
Image of page 6

Subscribe to view the full document.

7 Problem 5: Subroutines (5 Points) a. There is a problem with the below assembly code segment for a subroutine called PUTCH. What is it, and how can you fix the error? (2 Points) .ORIG x3010 PUTCH ST R0, TMP_R0 ADD R0, R4, 0 OUT ; TRAP x21 which displays the ; character in R0 LD R0, TMP_R0 RET TMP_R0 .FILL 0 .END R7 has to be saved before OUT is called. b. Is the above subroutine PUTCH a callee-save or caller-save subroutine? Explain. (1 Point) Callee-save, it restores the register that it modifies (R0) to its original value. c. Given the following initial values of registers, what are the values of the registers after the execution of an instruction at address x3030: JSR PUTCH ; and before the execution of the first instruction of the subroutine. (2 Points) Register Initial Final R0 0x3010 0x3010 R4 0x3030 0x3030 R7 0x3010 0x3031 PC 0x3030 0x3010
Image of page 7
8 Problem 6: I/O (3 Points) Let us monitor the contents of the KBSR (Keyboard Status Register), KBDR (Keyboard Data Register), DSR (Display Status Register) and DDR (Display Data Register) during the execution of TRAP x23 (IN) in LC-3. The leftmost bit of the block is the MSB and the rightmost bit is the LSB of the registers. Note: TRAP x23 (IN) prints prompt to console, read and echo a character from the keyboard. Below fill in the contents of the different registers at the different steps b, c, and d during the execution of the trap handler for TRAP x23 .
Image of page 8

Subscribe to view the full document.

Image of page 9
  • Spring '13
  • GuriSohi
  • Assembly Language, SEPTA Regional Rail, LD R1, STR R2, LD R2

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern