Reputation: 173
I've already got the program that takes input from the keyboard and print it on the screen but I am having problem understanding few lines of the code,
here is the code,
MOV DS, AX
MOV ES, AX ;Why Move AX content to ES ???
MOV DX, OFFSET PNAME ; PRINT NAME:
MOV AH, 09H
INT 21H
MOV BYTE PTR SNAME, 21
MOV DX, OFFSET SNAME
MOV AH, 0AH
INT 21H
MOV SI, 0002
LEA DX, SNAME[SI] ; PRINT NAME ENTERED
MOV AH, 09H
INT 21H
Why we first move 21 of size byte into SNAME ???? How Result of Keyboard input interrupt service automatically stored in SNAME instead of AL ???
Upvotes: 0
Views: 8922
Reputation: 62048
Check your favorite MSDOS function reference.
You can find there this:
Format of DOS input buffer:
Offset Size Description (Table 01344)
00h BYTE maximum characters buffer can hold
01h BYTE (call) number of chars from last input which may be recalled
(ret) number of characters actually read, excluding CR
02h N BYTEs actual characters read, including the final carriage return
So, 21 sets the maximum number of character that you can read from the keyboard into the buffer.
As for "How Result of Keyboard input interrupt service automatically stored in SNAME instead of AL ???
", the question is unclear.
Upvotes: 2