I have written the following code snippet (working in DOS with masm611) :
.data
msg db 10h,?,10h dup(?)
.code
.startup
lea dx,msg
mov ah,0ah
mov cl,msg
int 21h
mov bl,[msg + 1d]
I am confused as to what the contents of the variable 'msg' is. CL holds the value 10h (assuming i entered 5 characters). But the code [msg+1d] accesses the data stored at the location offset(msg) + 1d. Should it not instead access the location at offset address msg + 1d = 11h ?. Why does it at one place take the contents of the 'msg' but at another the offset of 'msg' ?
The contents of the registers after execution are -
As can be seen , CL = 10H and BL=05H.