Fill out the following symbol table 3 points symbol

This preview shows page 4 - 8 out of 12 pages.

Fill out the following symbol table: (3 Points) SYMBOL ADDRESS L1 SKIP DONE LOW_A STRG UPP_A b. What is the output of this program? (2 Points)
Image of page 4

Subscribe to view the full document.

5 Problem 3: Assembly Errors (3 Points) Identify the assembly errors in the following assembly program. .ORIG x3000 ADD R1, R2, #21 ; OR R2, R3, R4 LOOP AND R3, R3, #0 ADD R4, R4, R4 ADD R3, R3, #-1 BRzp NEXT STRG .STRINGZ "Error" HALT STR R4, R4, #16 TRAP x25 .END (a) (b) (c)
Image of page 5
6 Problem 4: TRAPS (5 Points) Suppose the following LC-3 subroutine implements a new service routine called GETS . The subroutine will store the input string starting at the address in R0 and then return to normal execution. It performs this operation by repeatedly taking input characters from the keyboard and storing it in the location specified by R0 until it sees the '\n' character. Note: The most significant bit of the KBSR is 1 if keyboard has received a new character. a. Fill in the blanks. There should be only one instruction per line . (4 Points) .ORIG x0650 ST R0, R0_TMP ST R1, R1_TMP ST R2, R2_TMP L1 LDI R1, KBSR (a)______________ ; Check KBSR (b)_____ R2, KBDR ; Load value in the KBDR into R2 LD R1, NEGCHAR ADD R1, R1, R2 BRz DONE ; Check for '\n' STR R2, R0, #0 ADD R0, R0, #1 BRnzp L1 DONE (c)_______________ STR R2, R0, #0 ; Store NULL CHAR LD R2, R2_TMP LD R1, R1_TMP LD R0, R0_TMP (d)________________ KBSR .FILL xFE00 ; Address of KBSR KBDR .FILL xFE02 ; Address of KBDR 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
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 b. Is the above subroutine PUTCH a callee-save or caller-save subroutine? Explain.
Image of page 7
Image of page 8

{[ 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