Reputation: 319
Count the number of characters in an input line and terminate if enter is pressed.
MOV AX, 1
MOV AL, 0
INPUT: INT 21H
INC AL
CMP DL,'\n'
JE OUT
LOOP INPUT
OUT:
In the above code I have used \n
. I am curious if we can use it or I would have to use the ascii code of it? Please help.
Upvotes: 0
Views: 8486
Reputation: 57794
'\n'
is not an assembly language constant. At least not in most assembly languages.
You will have to convert it directly using the character set in use. You can safely assume ASCII on almost all modern processors, so \n
will be 10 (decimal) on most operating systems. On Windows the two-character sequence 13 and 10 is used.
Upvotes: 2
Reputation: 22415
It depends entirely on your assembler. Probably yes, otherwise use an ascii table to translate it (to 0x0A
or 10
) yourself.
You should probably just try assembling it and see whether it works.
Upvotes: 2