i have this code that Writes an assembly program to: Prompt the user with instructions Allow user to type characters They will be uppercase, lowercase, numbers, spaces, and punctuation Show the user each character they typed as they type them When the user types numeric zero (0), stop accepting character Report to user how many lowercase 'a's were entered to the user I need this code to automatically start over (loop) with the prompt everytime in lc3 stimulate, this code must also use the LC-3 I/O polling to get and display each character the user types and not use Trap routines to get or display user inputs   LEA R0, PROMPT; Load the address of the prompt string PUTS ; Print the prompt string   AND R1,R1,#0 ; R1=0 (counter) LD R3, ASA ; R3=#97 NOT R3,R3 ADD R3,R3,#1 ; R3=#-97 LD R4, AS0 ; R4=#48 NOT R4,R4 ADD R4,R4,#1 ; R4=#-48   loop GETC ; Read a characters from keyboard. OUT ; print the character entered ADD R2,R0,R4 ; check whether character is 0 BRZ done ; if character is 0, exit the loop   ADD R2,R0,R3 ; otherwise, check whether the character is 'a' BRZ count ; if character is 'a', go to label BR loop ; otherwise, repeat the loop count

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 8PE
icon
Related questions
Topic Video
Question
i have this code that
Writes an assembly program to:
Prompt the user with instructions
Allow user to type characters
They will be uppercase, lowercase, numbers, spaces, and punctuation
Show the user each character they typed as they type them
When the user types numeric zero (0), stop accepting character
Report to user how many lowercase 'a's were entered to the user
I need this code to automatically start over (loop) with the prompt everytime in lc3 stimulate, this code must also use the LC-3 I/O polling to get and display each character the user types and not use Trap routines to get or display user inputs
 
LEA R0, PROMPT; Load the address of the prompt string
PUTS ; Print the prompt string
 
AND R1,R1,#0 ; R1=0 (counter)
LD R3, ASA ; R3=#97
NOT R3,R3
ADD R3,R3,#1 ; R3=#-97
LD R4, AS0 ; R4=#48
NOT R4,R4
ADD R4,R4,#1 ; R4=#-48
 
loop GETC ; Read a characters from keyboard.
OUT ; print the character entered
ADD R2,R0,R4 ; check whether character is 0
BRZ done ; if character is 0, exit the loop
 
ADD R2,R0,R3 ; otherwise, check whether the character is 'a'
BRZ count ; if character is 'a', go to label
BR loop ; otherwise, repeat the loop count
count
ADD R1,R1,#1 ; increment the counter by 1
BR loop ; repeat the loop
done LD R0, ASN ; R0=#10
OUT ; print new line
LD R4, AS0 ; R4=#48
AND R0,R0,#0 ; R0=#0
ADD R0,R4,R1 ; R0=R4+R1 (convert the counter to ascii digit)
OUT ; print the counter(as ascii)
 
 
HALT
 
 
 
 
PROMPT .STRINGZ "Enter characters. Type 0 to stop and report the number of 'a's.
"
 
AS0 .FILL x0030 ;#48 ASCII of '0'
 
ASA .FILL x0061 ;#97 ASCII of 'a'
 
ASN .FILL x000A ;#10 ASCII of '
'
 
.END
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,