Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!