Advertisement
Guest User

caesarean shift

a guest
Apr 15th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. proc caesar
  2.     push ax
  3.     push bx
  4.     push cx
  5.     push dx
  6.     ;start of proc
  7.    
  8.     mov ah, 09h
  9.     mov dl, offset keyQuery
  10.    
  11.    
  12.     call inputstring ;call inputstring to get key
  13.    
  14.     ;new line
  15.     mov dl, 0Ah
  16.     mov ah, 02h
  17.     int 21h
  18.    
  19.     mov bx, offset stringbuff + 2
  20.     xor cx, cx
  21.     mov cl, [stringbuff + 1]
  22.    
  23.     mov al, [bx]
  24.     mov dh, [bx+1]
  25.     sub al, 30h
  26.     sub dh, 30h
  27.     mul [ten]
  28.     add dh, al
  29.     xor ah, ah
  30.     mov [bx], ah
  31.     mov [bx+1], ah
  32.     mov [caesarKey], dh
  33.     sub [caesarinvertkey], dh
  34.     ;now the key is in caesarKey, and stringbuff is cleared again
  35.    
  36.     call inputstring
  37.    
  38.     ;new line
  39.     mov dl, 0Ah
  40.     mov ah, 02h
  41.     int 21h
  42.    
  43.     mov dh, [caesarinvertkey]
  44.     add dh, [A]
  45.    
  46.     mov bx, offset stringbuff + 2
  47.     xor cx, cx
  48.     mov cl, [stringbuff + 1]
  49.    
  50.     caesarloop:
  51.         mov dl, [bx]
  52.         cmp [byte ptr bx], '$'
  53.         je endofcaesar
  54.         cmp [byte ptr bx], ' '
  55.         je nextcaesar
  56.         cmp [bx], dh
  57.         jge overthekey
  58.         add dl, [caesarKey]
  59.         nextcaesar:
  60.             mov ah, 02h
  61.             int 21h
  62.             inc bx
  63.             loop caesarloop
  64.             jmp endofcaesar
  65.         overthekey:
  66.             sub dl, [caesarinvertkey]
  67.             jmp nextcaesar
  68.     endofcaesar:
  69.         ;end of proc
  70.         pop dx
  71.         pop cx
  72.         pop bx
  73.         pop ax
  74.         ret
  75. endp caesar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement