datasg SEGMENT
str1 db 11,10 dup(?);11缓冲区容量,10为最大元素个数
str2 db 'Enter a string:$'
datasg ENDS
stacksg segment stack
db 128 dup (?)
stacksg ends
code segment
assume cs:code, ss:stacksg,ds:datasg
START:
MOV AX,datasg
mov ds,ax
mov ax,stacksg
mov ss,ax
mov dx,offset str2
mov ah,9
int 21h
mov dx,offset str1
mov ah,10
int 21h
mov dl,10
mov ah,2
int 21h
mov dl,13
mov ah,2
int 21h
mov bx,1
mov bl,[bx]
add bl,2
mov bh,0
mov byte ptr [bx],'$'
mov dx,2
mov ah,9
int 21h
MOV AH,4CH
INT 21H
CODE ENDS
END START