have this code but it needs to work in lc3 stimulate by, it only allows user to type characters and does not prompt user with instructions etc. 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 Automatically start over .ORIG x3000 AND R1,R1,#0 ; R1=0 (counter) LD R3, ASCIIA ; R3=#97 NOT R3,R3 ADD R3,R3,#1 ; R3=#-97 LD R4, ASCII0 ; 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 Count BR loop ; otherwise, repeat the loop count ADD R1,R1,#1 ; increment the counter by 1 BR loop ; repeat the loop done LD R0,ASCNEL ; R0=#10 OUT ; print new line LD R4, ASCII0 ; 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 digit) HALT   ASCII0 .FILL x0030 ;#48 ASCII of '0' ASCIIA .FILL x0061 ;#97 ASCII of 'a' ASCNEL .FILL x000A ;#10 ASCII of '\n' .END

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 14E: In Chapter 4, you created a program that generates a random number, allows a user to guess it, and...
icon
Related questions
Question

I have this code but it needs to work in lc3 stimulate by, it only allows user to type characters and does not prompt user with instructions etc.

  • 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
  • Automatically start over

.ORIG x3000

AND R1,R1,#0 ; R1=0 (counter)

LD R3, ASCIIA ; R3=#97

NOT R3,R3

ADD R3,R3,#1 ; R3=#-97

LD R4, ASCII0 ; 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 Count

BR loop ; otherwise, repeat the loop

count

ADD R1,R1,#1 ; increment the counter by 1

BR loop ; repeat the loop

done LD R0,ASCNEL ; R0=#10

OUT ; print new line

LD R4, ASCII0 ; 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 digit)

HALT  

ASCII0 .FILL x0030 ;#48 ASCII of '0'

ASCIIA .FILL x0061 ;#97 ASCII of 'a'

ASCNEL .FILL x000A ;#10 ASCII of '\n'

.END

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Unary Predicate
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT