This Caesar cipher program makes de-cipher string (length is always 10) and output is output.txt file. for example below code make .txt file,
ILIKEASSEM
HOWAREYOUU
but when i run this code, the file is
ILIKEASSEM
ILIKEASSEM
I can't know what is wrong even though debug by visual studio 2017 (MASM) debugger (T.T)
what is wrong...?
INCLUDE Irvine32.inc
.data
Num_Str DWORD 2
;;key = 10
Cipher_Str BYTE "SVSUOKCCOW",0
BYTE "RYGKBOIYEE",0
filename BYTE"output.txt", 0
fileHandle DWORD ?
BUFFER_SIZE = 12
buffer BYTE BUFFER_SIZE DUP(?)
L BYTE "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0
Decipher BYTE "QRSTUVWXYZABCDEFGHIJKLMNOP", 0
count DWORD ?
.code
main PROC
mov edx, OFFSET filename
call CreateOutputFile
mov fileHandle, eax
mov ecx, Num_Str
mov esi, 0
L1:
push ecx
mov ecx, 11
L2:
mov al, Cipher_Str[esi]
sub al, 65
movzx ax, al
movzx eax, ax
mov edi, eax
mov al, Decipher[edi]
mov buffer[esi], al
inc esi
loop L2
mov bl, 13
mov buffer[esi], bl
inc esi
mov bl, 10
mov buffer[esi], bl
mov eax,fileHandle
mov edx,OFFSET buffer
mov ecx, BUFFER_SIZE
call WriteToFile
pop ecx
loop L1
mov eax, fileHandle
call CloseFile
exit
main ENDP
END main