Data Segment
str1 db 'string','$'
strlen1 dw $-str1
Data Ends
Code Segment
Assume cs:code, ds:data
Begin:
mov ax, data
mov ds, ax
mov es, ax
mov cx, strlen1
add cx, -2
lea di, str1
mov bl, 02
mov dl, 00h
L1:
mov ah, 00
mov ax, di
div bl
cmp ah, 00
je Even_encrypt
Odd_encrypt:
mov dl, [di]
add dl, 01h
mov [di], dl
inc di
loop L1
Even_encrypt:
mov dl, [di]
add dl, 02h
mov [di], dl
inc di
loop L1
Print:
mov ah, 09h
lea dx, str1
int 21h
Exit:
mov ax, 4c00h
int 21h
Code Ends
End Begin