datasg segment para 'code'
msg1 db 'what is yourname?',"$"
msg2 db 'You entered this string :',"$"
strlist label byte ;start of parameter list
max db 20
len db ?
buffer db 20 dup(' ')
datasg ends
codesg segment para 'code'
main proc far
assume ds:datasg, cs:codesg
mov ax, datasg
mov ds, ax
mov ah, 6h ;clear screen
mov al, 25 ;number of rows
mov ch, 0
mov cl, 0
mov dh, 24 ;row
mov dl, 79 ;column
mov bh, 7 ;attribute
int 10h
mov ah, 2h ;cursor move
mov dh, 15 ;row
mov dl, 20 ;column
mov bh, 0 ;pagenumber
int 10h
lea dx, msg1
mov ah, 9h
int 21h
mov ah, 0ah
lea dx, strlist
int 21h
mov ah, 2h ;cursor move
mov dh, 17 ;row
mov dl, 20 ;column
mov bh, 0 ;pagenumber
int 10h
mov ah, 0
mov dx, offset msg2
mov ah, 9h
int 21h
; output the string char by char
lea bx, buffer
mov cl, 0
p1: mov dl, [bx]
mov ah, 2h
int 21h
inc bx
inc cl
cmp cl, len
jnz p1
mov ax, 4c00h
int 21h
main endp
codesg ends
end main