assume cs:code, ds:data data segment
b db 100 dup(?)
data ends code segment
start:
mov ax, data
mov ds, ax lea si, b
mov ah, 1
nx:
int 21h
cmp al, 13
jz ok
mov byte ptr [si], al
inc si
jmp nx
ok:
mov ah, 2
mov dl, 13
int 21h
mov dl, 10
int 21h
mov byte ptr [si], 0
lea si, b
nx2:
mov dl, [si]
cmp dl, 0
jz done
int 21h
inc si
jmp nx2 done:
mov ax, 4c00h
int 21h
code ends
end start
b db 100 dup(?)
data ends code segment
start:
mov ax, data
mov ds, ax lea si, b
mov ah, 1
nx:
int 21h
cmp al, 13
jz ok
mov byte ptr [si], al
inc si
jmp nx
ok:
mov ah, 2
mov dl, 13
int 21h
mov dl, 10
int 21h
mov byte ptr [si], 0
lea si, b
nx2:
mov dl, [si]
cmp dl, 0
jz done
int 21h
inc si
jmp nx2 done:
mov ax, 4c00h
int 21h
code ends
end start