Я прокомментировал это для вас:
.MODEL SMALL ; We're writing code for x86-16
.STACK 100H ; Give us a stack of 256 bytes
.CODE ; What follows is the code
MAIN PROC
MOV DX,0 ; Set the counter keeping track of the length of the string to 0
MOV AH,1 ; The DOS service we want is to read a character from standard input
INT 21H ; Call said DOS service
WHILE_:
CMP AL,0DH ; Is the character we read a carriage return?
JE END_WHILE ; if so jump to the end of the program
INC DX ; if not increment the counter keeping track of the string length
INT 21H ; Call the DOS service for reading the standard input again
JMP WHILE_ ; Jump back to _WHILE
END_WHILE:
MAIN ENDP ; Exit the procedure
END MAIN
Для справки, вы можете написать эту сборку гораздо более кратко и более современно:
.model small
.stack 0x100 ; This style of hex literal is more common nowadays
.code
main proc
mov ah, 1 ; We don't need to set this continually since nothing clobbers it
mov dx, -1
_while:
inc dx
int 0x21
cmp al, `\r` ; most modern assemblers will support string literals
jne _while
main endp
end main