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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education