After entering the line and pressing enter, the message is displayed ...
"Proga.exe program terminated"
Please help me find a bug. And yet, maybe there is a way (not through interrupts) to pause before closing the console?
.data
dest db "Failed to assign console :(", 0
descrIn DD 0; input variable descriptor
descrOut DD 0; output variable descriptor
stroka db 80 dup (0)
readBuf db 80 dup (0); for the input line
kolChrs DD 0; number of characters actually read
start:
call AllocConsole; pickup for the console assignment function
cmp eax, 0
je error; if the console could not be assigned (eax = 0) - error
invoke GetStdHandle, STD_OUTPUT_HANDLE; request the input buffer identifier (console descriptor)
mov descrOut, EAX
invoke GetStdHandle, STD_INPUT_HANDLE
mov descrIn, eax
invoke ReadConsole, descrIn, offset readBuf, 80, offset kolChrs, 0
mov ECX, kolChrs
mov EDI, 0
mov ESI, 0
M1:
mov AL, readBuf [ESI]
mov stroka [EDI], AL
add ESI, 2
inc edi
loop M1
invoke WriteConsole, descrOut, offset stroka, kolChrs, offset kolChrs, MB_OK
invoke ExitProcess, 0
error:
invoke MessageBox, 0, addr dest, NULL, MB_OK
mov ah, 1
int 21h
invoke ExitProcess, 0
end start