Question: ;Project 2 - Encryption and Decryption message using encryption key and special logic. ;The line with Add code here need to supply the LC -
;Project Encryption and Decryption message using encryption key and special
logic.
;The line with "Add code here" need to supply the LC Instruction for asm program
run success.
;Algorithm
;
;The encryption algorithm is as follows. Each ASCII code in the message will be
transformed as follows:
;
; The low order bit of the code will be toggled. That is if it is a
; it will be replaced by a if it is a it will be replaced by a
;
; The key will be added to the result of step above.
; For example, if the input plain text is A and the encryption key is
; the program should take the ASCII value of A toggle bit :
; producing and then add the encryption key,
; The final output character would be which is the ASCII value F
;
;The decryption algorithm is the reverse. That is
; Subtract the encryption key from the ASCII code. Toggle the low order bit
of the result of step
; For example, if the input cipher text is F and the encryption key is
; we first subtract the encryption key ie we add from the ASCII value
of F
; yielding We then toggle bit :
; producing which is the ASCII value for A
;
;The result of the encryptiondecryption algorithm should be stored in locations
x to x
;
;Output
;
;Your program should output the encrypted or decrypted message to the screen.
;Note that the encryptiondecryption algorithm stored the message to be output
starting in location x
ORIG x
AND R R # ;Clear R
AND R R # ;Clear R
AND R R # ;Clear R
AND R R # ;Clear R
AND R R # ;Clear R
AND R R # ;Clear R
AND R R # ;Clear R
LD R STORE ; Sets R to x for memory storage and access
LEA R PROMPT ; Load PromptEncryption or Decryption
PUTS ; Output Prompt same as TRAP Write null
terminated string to console.
IN ; Get character input from keyboard same as
TRAP
STR R R # ; Storeswrite character at memory location
indicated by R
LEA R PROMPT ; Load Prompt Encryption Key
PUTS ; Output Prompt same as TRAP
IN ; Get character input from keyboard same as
TRAP
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
