.model small
.data
tabnames db 'Apple '
db 'Orange'
db 'Peach '
db 'Chikoo'
db 6 dup(' '),'$'
Accept LABEL BYTE
MaxLen db 7
ActLen db ?
Input db 7 dup(' ')
Flag db 0
CR EQU 13
LF EQU 10
Line db CR,LF,'$'
Eq1 db 'Name Is Present','$'
.code
Main PROC NEAR
mov ax,@data
mov ds,ax
mov es,ax
CALL AcceptString
mov BX,0
L1:
mov cx,6
LEA SI,tabnames[BX]
LEA DI,Input
REPE CMPSB
je Equal
add BX,CX
INC BX
cmp BX,19
jle L1
jmp addName
Equal:
mov ax,0900h
LEA DX,Eq1
int 21h
jmp ext
addName:
mov cx,6
mov bx,25
LEA SI,Input
LEA DI,tabnames[BX]
REP MOVSB
mov ax,0900h
LEA DX,tabnames
int 21h
ext:
mov ax,4C00h
int 21h
Main EndP
AcceptString PROC NEAR
mov ax,0A00h
LEA DX,Accept
int 21h
mov cx,6
mov bh,00
mov bl,ActLen
cmp ActLen,6
jge Ok
sub cl,ActLen
L2:
mov Input[BX],20h
Inc BX
Loop L2
Ok:
mov Input[BX],'$'
mov ax,0900h
LEA DX,Line
int 21h
ret
AcceptString EndP
end