.model small
.code
org 100h
jmp main
parlist label byte
maxlen db 30
actlen db ?
kbdata db 30 dup(' ')
intro db 'Enter string: ','$'
first db 'First: ','$'
last db 'Last: ','$'
input:
mov ah,0ah
lea dx,parlist
int 21h
ret
printing:
mov ah,09h
int 21h
ret
clr_scr:
mov ax,0600h
mov bh,07h
mov cx,0000h
mov dx,184fh
int 10h
ret
set_cur:
mov ah,02h
mov bh,00h
int 10h
ret
main proc near
call clr_scr
mov dx,0000h
call set_cur
lea dx,intro
call printing
mov dx,0305h
call set_cur
call input
mov dx,0505h
call set_cur
mov bl,actlen
mov bh,00h
mov al,61h
mov cl,7ah
mov si,00h
mov di,00h
lea dx,first
call printing
call compare1
mov dx,0605h
call set_cur
lea dx,last
call printing
call compare2
main endp
end main
compare1:
mov ch,kbdata[si]
cmp ch,cl
jb below
inc si
cmp si,bx
je print1
jmp compare1
below:
mov cl,ch
mov si,00h
jmp compare1
compare2:
mov ch,kbdata[di]
cmp ch,al
ja above
inc di
cmp di,bx
je print2
jmp compare2
above:
mov al,ch
mov di,00h
jmp compare2
print1:
mov ah,02h
mov dl,cl
int 21h
ret
print2:
mov ah,02h
mov dl,al
int 21h
ret
/*Screen Shot*/
.code
org 100h
jmp main
parlist label byte
maxlen db 30
actlen db ?
kbdata db 30 dup(' ')
intro db 'Enter string: ','$'
first db 'First: ','$'
last db 'Last: ','$'
input:
mov ah,0ah
lea dx,parlist
int 21h
ret
printing:
mov ah,09h
int 21h
ret
clr_scr:
mov ax,0600h
mov bh,07h
mov cx,0000h
mov dx,184fh
int 10h
ret
set_cur:
mov ah,02h
mov bh,00h
int 10h
ret
main proc near
call clr_scr
mov dx,0000h
call set_cur
lea dx,intro
call printing
mov dx,0305h
call set_cur
call input
mov dx,0505h
call set_cur
mov bl,actlen
mov bh,00h
mov al,61h
mov cl,7ah
mov si,00h
mov di,00h
lea dx,first
call printing
call compare1
mov dx,0605h
call set_cur
lea dx,last
call printing
call compare2
main endp
end main
compare1:
mov ch,kbdata[si]
cmp ch,cl
jb below
inc si
cmp si,bx
je print1
jmp compare1
below:
mov cl,ch
mov si,00h
jmp compare1
compare2:
mov ch,kbdata[di]
cmp ch,al
ja above
inc di
cmp di,bx
je print2
jmp compare2
above:
mov al,ch
mov di,00h
jmp compare2
print1:
mov ah,02h
mov dl,cl
int 21h
ret
print2:
mov ah,02h
mov dl,al
int 21h
ret
/*Screen Shot*/

No comments:
Post a Comment