After int 21h/0Ah returns, the number of bytes actually entered is in [tempx + 1]...
mov ah, 0Ah
mov dx, tempx
int 21h
mov bl, [tempx + 1]
mov bh, 0
mov byte [tempx + 2 + bx], '$'
mov ah, 9
mov dx, tempx + 2
int 21h
I don't recall whether the "count" includes the terminating carriage-return or not - adjust the "[tempx + 2 + bx]" so it comes out right :)
You can use "lea dx, [tempx + 2]" instead of the "mov"... but it's longer... Could use "movzx" to get the byte-sized count into the word-sized register, instead of "mov bh, 0", too...
There are other ways to print a string besides int 21h/9, too. The "write to file" int 21h/40h expects the "count" in cx, instead of the silly $-terminated string (bx wants the file handle to write to - 1 is stdout, 2 is stderr). Or you could display it one character at a time, watching for the terminating CR that int 21h/0Ah puts there...
mov si, tempx + 2
top:
lodsb
cmp al, 13
jz done
int 29h
jmp short top
done:
Pretty inefficient to call the OS for every character like that, though... The int 21h/40h is probably the most flexible...
Best,
Frank