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

HELP WITH LC3 ASSEMBLY. Please help make the program user friendly just like the

ID: 3583198 • Letter: H

Question

HELP WITH LC3 ASSEMBLY.

Please help make the program user friendly just like the assignment says!

here is my code in encryption.

.ORIG x3000
LDI R5, Key
AND R1, R1, #0
LD R1, XOR

AND R6, R6, #0
LD R6, COUNT

LD R4, Result
Again LDR R0, R7, #0
BRz exit

NOT R2, R0   
NOT R3, R1   
AND R3, R0, R3
AND R2 R1, R2   
NOT R3, R3   
NOT R2, R2   
AND R2, R2, R3
NOT R2, R2
ADD R2, R2, R5

STR R2, R4, #0
ADD R7, R7, #1
ADD R4, R4, #1
ADD R6, R6, #-1
BRnp Again


exit HALT
ARRAY1 .BLKW 20
MSG1 .STRINGZ "Enter a message to encrypt, press enter when you are done"
COUNT .FILL #16
ARRAY .FILL x3110
XOR .FILL xF0F
Key .FILL x3100
Result .FILL x3120
.END

3. (50%) Write an LC-3 Assembly language program that accepts text inputs, encrypts it into cipher text and displays the cipher text in a text string. You can either input one character at a time until the "Enter" is pressed, or enter a text string ended with the "Enter." The encryption key will be added is 7. The encryption process adds the key to the cleartext first, and then swaps the higher 4-bits with the lower 4-bits.

Explanation / Answer

.ORIG x3000
MSG1 .STRINGZ "Enter a key for encryption"
LDI R5, Key
AND R1, R1, #0
LD R1, XOR
AND R6, R6, #0
LD R6, COUNT
LD R4, Result
Again LDR R0, R7, #0
BRz exit
NOT R2, R0   
NOT R3, R1   
AND R3, R0, R3
AND R2 R1, R2   
NOT R3, R3   
NOT R2, R2   
AND R2, R2, R3
NOT R2, R2
ADD R2, R2, R5

STR R2, R4, #0
ADD R7, R7, #1
ADD R4, R4, #1
ADD R6, R6, #-1
BRnp Again

exit HALT
ARRAY1 .BLKW 20
MSG1 .STRINGZ "Enter a message to encrypt, press enter when you are done"
COUNT .FILL #16
ARRAY .FILL x3110
XOR .FILL xF0F
Key .FILL x3100
MSG1 .STRINGZ "Encrypted String is: "
Result .FILL x3120
.END