While displaying any output on the screen how do we print each statement on a line. For instance we use 'endl' or '\n' to do so in C++. But how do we implement this in assembly ?
You have to add a CR LF at the position of your string where you want it.
0Ah, 0Dh or 10,13
:)
0Ah, 0Dh or 10,13
:)
add how ?
if this how i declare the string :
prompt db 'Enter W or R or E : '
and this is my code to display the string:
mov si,offset prompt
mov cx, 19
again: mov dl,
mov ah,2
int 21h
inc si
loop again
mov dl,0Dh
int 21h
mov dl, 0Ah
int 21h
mov ah,1
int 21h
I get a new line after the string for this code and then I enter value 'W,R or E' now after entering that value I once again want a new line to enter another value.However, that doesn't seem to work.
if this how i declare the string :
prompt db 'Enter W or R or E : '
and this is my code to display the string:
mov si,offset prompt
mov cx, 19
again: mov dl,
mov ah,2
int 21h
inc si
loop again
mov dl,0Dh
int 21h
mov dl, 0Ah
int 21h
mov ah,1
int 21h
I get a new line after the string for this code and then I enter value 'W,R or E' now after entering that value I once again want a new line to enter another value.However, that doesn't seem to work.
First thing: in assembly, you should always zero-terminate your string definitions.
Second thing: in assembly, you need to write the ascii values for the CR (carriage return = 13) and LF (linefeed = 10) ... Those names are older than me, they refer to old fashioned typewriter machines.
You should put them both, each pair of them is going to move the 'print cursor' down one line, and to the start of that line.
prompt db 'Enter W or R or E : ',0
Second thing: in assembly, you need to write the ascii values for the CR (carriage return = 13) and LF (linefeed = 10) ... Those names are older than me, they refer to old fashioned typewriter machines.
You should put them both, each pair of them is going to move the 'print cursor' down one line, and to the start of that line.
prompt db 'Enter W or R or E : ',13,10,0