Hey I have started learning assembly language
.
I wrote the following code:
.MODEL SMALL
.STACK 1000H
.DATA
MSG db "Hey$"
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOV AH,0AH ; setting the sub function
MOV DX, offset msg ; moving address of msg to dx
INT 21h ; calling interrupt
MOV AH, 09
MOV DX, OFFSET MSG
INT 21h ; for printing
MOV AH, 04Ch ; Select exit function
MOV AL, 00 ; Return 0
INT 21h ; Call Interupt to Terminate program
MAIN ENDP
END MAIN
I am trying to take input, it is working kind of but when I try printing it I do not get the proper string. I used this list to select the interrupt function.
I am attaching a screenshot, I have given input the following string:
Hey this is me taking input
But I got unexpected result.
Screenshot:
Thanks.
You didn't set aside enough space for your input string; when you "declared" MSG
, you gave it room for only 4 characters ("Hey$"
).