Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem with assembly language code( outputting stored characters) Write an LC-3 assembly language program to read and store in memory a character string (length

Problem with assembly language code( outputting stored characters)

Write an LC-3 assembly language program to read and store

in memory a character string (length <= 20) until the

newline

character (ASCII decimal 10) is typed and then

display the string forwards using the trap PUTS.

Sample execution

:(user input underlined)

Please enter your name: John Doe (bold italized= user input)

You entered: John Doe

My code so far------

.ORIG x3000 LEA R0,PROMPT1 ; Displays first prompt. PUTS LEA R2, memSpace LOOP GETC PUTC ADD R3, R0, #-10 BRz DONE ;OUT STR R0, R2, #0 ADD R2, R2, #1 BRnzp LOOP

DONE LD R0,CRLF ; Executes new line. OUT ; Writes char

LEA R0,PROMPT2 ; Displays second prompt.

PUTS

LDR R5,R2, #4 ADD R0,R0,R5 OUT HALT

;************ Data area******************************* PROMPT1 .STRINGZ "Please enter your name: " PROMPT2 .STRINGZ "You entered: "

memSpace .BLKW 20 CHAR .BLKW 20

CRLF .FILL #10 .END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions

Question

Acceptance of the key role of people in this process of adaptation.

Answered: 1 week ago

Question

preference for well defined job functions;

Answered: 1 week ago