# CSE 322 Summer 2018 Lab 10

### Problem 1 (section 10.7)

Encoding and Decoding string using XLAT instruction

//Code
Title secret message
.Model small
.stack 100h
.data
; ;ABCDEFGHIJKLMNOPQRSTUVWXYZ
code_key db 65 dup(' '), 'XQPOGHZBCADEIJUVFMNKLRSTWY'
db 37 dup(' ')
; ;ABCDEFGHIJKLMNOPQRSTUVWXYZ
decode_key db 65 dup(' '), 'JHIKLQEFMNTURSDCBVWXOPYAZG'
db 37 dup(' ')
coded db 80 dup('$') ; XQPO4 prompt db 'Enter a message to be encoded', 0dh, 0ah, '$'
crlf db 0dh, 0ah, '$' .code main proc mov ax, @data mov ds, ax mov ah, 9 lea dx, prompt int 21h mov ah, 1 lea bx, code_key lea di, coded while_: int 21h cmp al, 0dh je endwhile xlat mov [di], al inc di jmp while_ endwhile: mov ah, 9 lea dx, crlf int 21h lea dx, coded int 21h lea dx, crlf int 21h mov ah, 2 lea bx, decode_key lea si, coded while1: mov al, [si] cmp al, '$'
je endwhile1
xlat
mov dl, al
int 21h
inc si
jmp while1
endwhile1:
mov ax, 4ch
int 21h
main endp
end main

### Problem 2

Change the encode key and decode key in problem 1 to create a decoded message with the letters replaced by 3 letters ahead.
Example A becomes D, B becomes E, etc

//Code
To be done by students



Problem 3

Change the code in problem 2 to encode both capital and small letters

//Code
To be done by students