i have a project where i am suppose to encrypt or decrypt a message typed in by the user using the ceaser encryption algorithm and printing it back, i need some help in as to how to write the encryption alg, (ill figure the dec out from there), heres the code im still fixing parts of it so, thanks

.orig x3000
main JSR read_input

read_input LEA R0, prompt1
TRAP x20
ADD R1, R0, #-68 ;will need to sub 68 to dec value of ascii
LEA R1, enckey
again LDR R2, R1, #0
BRz next
ADD R1, R1, #1
BR again
next LEA R0, enckey
LS R3, negenter
again2 GETC
ADD R2, R0, R3
BRz cont
STR R0, R1, #0
ADD R1, R1, #1
BR again2
cont AND R2, R2, #0
STR R2, R2, #0
LEA R0, hello
negenter .FILL xFFF6
prompt1 .FILL x000a
.STRINGZ "E(ncrypt)/D(ecrypt): "
enckey .STRINGZ "Encryption Key: "
.BLKW #2
asciitobinary AND R0, R0, #0
ADD R1, R1, #0
BRz doneatob
LD R3, negasciioffset
LEA R2, asciibuff
ADD R2, R2, R1
ADD R2, R2, #-1
LDR R4, R2, #0
ADD R4, R4, R3
ADD R0, R0, R4
ADD R1, R1, #-1
BRz doneatob
ADD R2, R2, #-1
LDR R4, R2, #0
ADD R4, R4, R3
LEA R5, lookup10
ADD R5, R5, R4
LDR R4, R5, #0
ADD R0, R0, R4
doneatob ret
negasciioffset .FILL xFFD0
asciibuff .BLKW 4
lookup10 .FILL #0
.FILL #10
.FILL #20
.FILL #30
.FILL #40
.FILL #50
.FILL #60
.FILL #70
.FILL #80
.FILL #90
encrypt ;God knows
decrypt ;???
length .FILL #41
string .BLKW #41

i didnt actually, but i got pseudo code that works its just i have not been able to convert it into LC -3 code. what about u??

This article has been dead for over six months. Start a new discussion instead.