Question
1. Construct a symbol table for the following program. .orig x3222 ld r0,str puts ld r1,index repeat brz end add r1,r1,#-3 br repeat end halt
1. Construct a symbol table for the following program. .orig x3222 ld r0,str puts ld r1,index repeat brz end add r1,r1,#-3 br repeat end halt str .stringz "Assignment#2!" index .fill 10 .end The headings in the table should be Symbol followed by Address. List the symbols in ascending alphabetic order.
Part A: IF/ELSE Write an LC3 assembly language program that does the following (8 marks): 1. Display the prompt "Enter any character: " 2. Read a character from the keyboard using getc (Trap x20). 3. Display the character to the console window using out (Trap x21). 4. If the three least significant bits of the ASCII representation of the character are 101, use puts to display the message "The character ends with 101."
5. Otherwise, if the two least significant bits of the ASCII representation of the character are 01 use puts to display the message "The character ends with 01." 6. Display a termination message that includes your name before halting the program. If the character is 5 then the output from the program should look like: Enter any character: 5 The character ends with 101. Programmed by Stew Dent. End of processing. If the character is A then the output from the program should look like: Enter any character: A The character ends with 01. Programmed by Stew Dent. End of processing. If the character is b then the output from the program should look like: Enter any character: b Programmed by Stew Dent. End of processing.
Part B: WHILE LOOP Modify the LC-3 assembly language program from part A so that: 1. It loops and checks characters from the keyboard until the user enters CTRLD (x04) CTRL-D is the EOT character, which means "End of Transmission" You may have used it when working with the UNIX Terminal 2. If the character entered is EOT, do not display it on the console. 3. Display a termination message that includes your name before halting the program. 4. All other functionality is the same as in Part A, only now it loops until receiving EOT. A sample run of the program is shown below. Enter any character: 0 Enter any character: 1 The character ends with 01. Enter any character: 2 Enter any character: 3 Enter any character: 4 Enter any character: 5 The character ends with 101. Enter any character: 6 Enter any character: 7
Enter any character: 8 Enter any character: 9 The character ends with 01. Enter any character: a The character ends with 01. Enter any character: b Enter any character: c Enter any character: d Enter any character: e The character ends with 101. Enter any character: f Enter any character: g Enter any character: h Enter any character: i The character ends with 01. Enter any character: Programmed by Stew Dent End of processing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started