sstack SEGMENT para stack "stack"
DB 100 dup (?)
sstack ENDS
sdata SEGMENT para "data"
Message DB "Enter the string:",10,13, "$"
MaxLength DB 11
CurrentLehgth DB ?
s1 DB 11 DUP(?)
s2 DB 4 DUP(?)
new_line DB 10,13,"Output :","$"
sdata ENDS
scode SEGMENT para "code"
ASSUME CS:scode, DS:sdata
start:
mov AX, sdata
mov DS, AX
mov AH, 9
mov DX, offset Message
int 21h
mov AH, 0Ah
mov DX, offset MaxLength
int 21h
mov AH, 9
mov DX, offset new_line
int 21h
mov AL, s1
mov s2, AL
mov BL, CurrentLehgth
mov BH, 0
mov AL, s1[0]
mov s2,al
mov AL, s1[1]
mov s2+1,al
mov AL, s1[2]
mov s2+2,al
mov s2+3, "$"
mov s1[BX], "$"
mov ah, 9
mov dx, offset s1
int 21h
mov ah, 9
mov DX, offset new_line
int 21h
mov ah, 9
mov dx, offset s2
int 21h
mov ah, 04ch
int 21h
scode ENDS
END start