Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc caesar
- push ax
- push bx
- push cx
- push dx
- ;start of proc
- mov ah, 09h
- mov dl, offset keyQuery
- call inputstring ;call inputstring to get key
- ;new line
- mov dl, 0Ah
- mov ah, 02h
- int 21h
- mov bx, offset stringbuff + 2
- xor cx, cx
- mov cl, [stringbuff + 1]
- mov al, [bx]
- mov dh, [bx+1]
- sub al, 30h
- sub dh, 30h
- mul [ten]
- add dh, al
- xor ah, ah
- mov [bx], ah
- mov [bx+1], ah
- mov [caesarKey], dh
- sub [caesarinvertkey], dh
- ;now the key is in caesarKey, and stringbuff is cleared again
- call inputstring
- ;new line
- mov dl, 0Ah
- mov ah, 02h
- int 21h
- mov dh, [caesarinvertkey]
- add dh, [A]
- mov bx, offset stringbuff + 2
- xor cx, cx
- mov cl, [stringbuff + 1]
- caesarloop:
- mov dl, [bx]
- cmp [byte ptr bx], '$'
- je endofcaesar
- cmp [byte ptr bx], ' '
- je nextcaesar
- cmp [bx], dh
- jge overthekey
- add dl, [caesarKey]
- nextcaesar:
- mov ah, 02h
- int 21h
- inc bx
- loop caesarloop
- jmp endofcaesar
- overthekey:
- sub dl, [caesarinvertkey]
- jmp nextcaesar
- endofcaesar:
- ;end of proc
- pop dx
- pop cx
- pop bx
- pop ax
- ret
- endp caesar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement