Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

LC-3 assembly language help I am writing a short LC-3 program to ask the user to

ID: 3561180 • Letter: L

Question

LC-3 assembly language help

I am writing a short LC-3 program to ask the user to input their name and print it out.

The output of the program should be something like this...

===========================================

What is your name?

ABCD

Hi ABCD, nice to meet you!

===========================================

But in my program, it showed the output in this way...

===========================================

What is your name?

ABCD

Hi ABCE

, nice to meet you!

===========================================

Here's the problem, why the sentence ", nice to meet you!" go to the next line ?

I created 2 .STRINGZ for the sentence, "Hi " as String1 and ", nice to meet you!" as String2,

I did put a " " in fron the string "Hi " but haven't do this in the string ", nice to meet you!"

How to make the sentence ", have a nice day!" after the user name to make it to be a complete sentence ?

Thanks!

Explanation / Answer

You put that's why next sentance going to next line.Plz check below code.I have tested it's working fine for u..

     ORIG x3000
AND R3, R3, #0 ;r3 stores the sum, set r3 to zero
AND R4, R4, #0 ;r4 is the counter
LD R5, INVERSE_ASCII_OFFSET ;inverse ascii offset
LD R6, DECIMAL_OFFSET ;decimal offset
;---------------------
;storing first input string
LEA R0, display1 ;load the address of the 'display1' message string
PUTS ;Prints the message string
GETC ;get the first string
OUT ;print the first string
ADD R1, R0, #0 ;store input value(ascii) to r1
ADD R1, R1, R5 ;get real value of r1
;storing second input string
LEA R0, display2 ;load the address of the 'display2' message string
PUTS ;Prints the message string
GETC ;get the first string
OUT ;print the first string
ADD R2, R0, #0 ;store input value(ascii) to r2
ADD R2, R2, R5 ;get real value of r2

stringResult .STRINGZ " Result: "
INVERSE_ASCII_OFFSET .fill xFFD0 ; Negative of x0030.
DECIMAL_OFFSET .fill #48
.END