.model small
.data
moinhap db 10,13,"Moi nhap 1 ho ten:$"
hienthi db 10,13,"$"
hienthi1 db 10,13,"Ten cua ban la: $"
hienthi2 db 10,13,"Ho cua ban la: $"
hovaten db 50 dup("$")
ten db 8 dup("$")
s1 db 13,10,'********************************',13,10
s2 db '*LAM QUEN NHA MINH LA PHAM LAM NHAT' ,13,10
s4 db '************************************$'
t db 10,13,'nhap vao mot chuoi:chu y(chu hoa thi doi thanh chu thuong,chu thuong thi doi thanh chu hoa):$'
hoathuong db 10,13,'chuoi ban nhap da duoc doi:$'
s db 99,?,100 dup (?)
nhapkt db 10,13,'cho biet kt dau tien cua ten nguoi ban can:$'
sai db 10,13,'ban nhap sai roi!$'
nhlai db 10,13,'moi ban nhap lai:$'
hien db 10,13,'ban chu cai:$'
het db 10,13,'ban nhap qua so lan quy dinh!hen ban lan sau!$'
nhdung db 10,13,'chuc mung ban!$'
cviec db 10,13,'Ban da vao duoc nhat ki cua lamnhat!$'
lviec db 10,13,'bat dau:$'
nhapmk db 10,13,'moi ban nhap mat khau:$'
ms1 db 10,13,'moi nhap chuoi kt:$'
ms2 db 10,13,'chuoi da nhap la:$'
ms3 db 10,13,'chuoi doi thanh chu hoa:$'
ms4 db 10,13,'chuoi doi thanh chu thuong:$'
hoten db 123 dup('$')
hotenchuan db 123 dup ('$')
ln db 5 dup('$')
mk1 db 15 dup('$')
mk2 db 15 dup('$')
.code
batdau:
mov ax,@data
mov ds,ax
call l\n
call kq1
call m\k
call kq2
call l\v
call nhap
call xuat1
call xuat2
call ae
call hoten1
call nhap
call xuat1
call xuat2
call inho
call inten
call az
call h\t
call thoat
l\n proc
mov ah,09h
lea dx,nhapkt
int 21h
mov cx,3
lap:
mov ah,01h
int 21h
cmp al,'n'
je n
mov ah,09h
lea dx,nhlai
int 21h
loop lap
jmp chiabuon
jmp hengaplai
l\n endp
kq1 proc
n:mov ah,09h
lea dx,nhdung
int 21h
jmp m\k
chiabuon:mov ah,09h
lea dx,sai
int 21h
hengaplai:mov ah,09h
lea dx,het
int 21h
jmp thoat
kq1 endp
m\k proc
mov dl,'l'
mov mk1[0],dl
mov dl,'a'
mov mk1[1],dl
mov dl,'m'
mov mk1[2],dl
mov dl,'n'
mov mk1[3],dl
mov dl,'h'
mov mk1[4],dl
mov dl,'a'
mov mk1[5],dl
mov dl,'t'
mov mk1[6],dl
nhaplaimk:mov ah,09h
lea dx,nhapmk
int 21h
mov cx,7
mov si,0
lapnhap: mov ah,01h
int 21h
mov mk2[si],al
inc si
loop lapnhap
mov cx,7
mov si,0
lapsosanh:mov dl,mk2[si]
mov al,mk1[si]
cmp al,dl
jne kq2
inc si
loop lapsosanh
mov ah,09h
lea dx,nhdung
int 21h
jmp l\v
m\k endp
kq2 proc
mov ah,09h
lea dx,sai
int 21h
jmp nhaplaimk
kq2 endp
l\v proc
mov ah,09h
lea dx,cviec
int 21h
mov ah,09h
lea dx,lviec
int 21h
ae proc
mov ax,@data
mov ds,ax
lea dx,s1
mov ah,09H
int 21h
ae endp
az proc
mov ah,09h
lea dx,hien
int 21h
mov cx,26
mov ah,02h
mov dl,'A'
lap1:
int 21h
inc dl
loop lap1
az endp
h\t proc
mov ah,09
lea dx, t
int 21h
mov ah,0ah
lea dx, s
int 21h
lea si,s+2
buoc3:
mov al,[si]
cmp al,0dh
je buoc10
cmp al,'a'
jb buoc7
cmp al,'z'
ja buoc7
sub al,32
mov [si],al
jmp buoc9
buoc7:
cmp al,'A'
jb buoc9
cmp al,'Z'
ja buoc9
add al,32
mov [si],al
jmp buoc9
buoc9:
inc si
jmp buoc3
buoc10:
mov al,'$'
mov [si],al
mov ah,09h
lea dx,hoathuong
int 21h
mov ah,02
mov dl,0dh
int 21h
mov ah,02
mov dl,0ah
int 21h
mov ah,09
lea dx, s+2
int 21h
h\t endp
hoten1 proc
mov ah,09h
lea dx,moinhap
int 21h
mov cx,50
mov si,0
lapnhap1:
mov ah,01h
int 21h
mov hovaten[si],al
inc si
cmp al,13
loopne lapnhap1
jmp inten
hoten1 endp
inten proc
mov cx,50
mov di,0
lapdem:
mov al,hovaten[si]
mov ten[di],al
inc di
dec si
cmp al,32
loopne lapdem
mov ah,09h
lea dx,hienthi1
int 21h
mov cx,50
dec di
hienthiten:
mov dl,ten[di]
mov ah,02h
int 21h
dec di
loopne hienthiten
inten endp
inho proc
mov ah,09h
lea dx,hienthi2
int 21h
inc si
mov cx,si
mov si,0
hienthiho:
mov dl,hovaten[si]
mov ah,02h
int 21h
inc si
loop hienthiho
inho endp
nhap proc
mov ah,09h
lea dx,ms1
int 21h
mov cx,120
mov si,0
lapnhap2:mov ah,01h
int 21h
mov hoten[si],al
inc si
cmp al,13
loopne lapnhap2
nhap endp
xuat1 proc
mov ah,09h
lea dx,ms2
int 21h
lea dx,hoten
int 21h
xuat1 endp
xuat2 proc
mov cx,si
mov di,0
copy:
mov al,hoten[di]
mov hotenchuan[di],al
inc di
loop copy
mov al,hotenchuan[0]
sub al,32
mov hotenchuan[0],al
dec si
mov cx,si
mov si,1
mov di,2
lapdoichuan:
mov al,hotenchuan[si]
cmp al,32
je doi
inc si
inc di
loop lapdoichuan
doi:
mov dl,hotenchuan[di]
sub dl,32
mov hotenchuan[di],dl
mov ah,09h
lea dx,ms3
int 21h
lea dx,hotenchuan
int 21h
xuat2 endp
thoat proc
mov ah,4ch
int 21h
thoat endp
end batdau
.data
moinhap db 10,13,"Moi nhap 1 ho ten:$"
hienthi db 10,13,"$"
hienthi1 db 10,13,"Ten cua ban la: $"
hienthi2 db 10,13,"Ho cua ban la: $"
hovaten db 50 dup("$")
ten db 8 dup("$")
s1 db 13,10,'********************************',13,10
s2 db '*LAM QUEN NHA MINH LA PHAM LAM NHAT' ,13,10
s4 db '************************************$'
t db 10,13,'nhap vao mot chuoi:chu y(chu hoa thi doi thanh chu thuong,chu thuong thi doi thanh chu hoa):$'
hoathuong db 10,13,'chuoi ban nhap da duoc doi:$'
s db 99,?,100 dup (?)
nhapkt db 10,13,'cho biet kt dau tien cua ten nguoi ban can:$'
sai db 10,13,'ban nhap sai roi!$'
nhlai db 10,13,'moi ban nhap lai:$'
hien db 10,13,'ban chu cai:$'
het db 10,13,'ban nhap qua so lan quy dinh!hen ban lan sau!$'
nhdung db 10,13,'chuc mung ban!$'
cviec db 10,13,'Ban da vao duoc nhat ki cua lamnhat!$'
lviec db 10,13,'bat dau:$'
nhapmk db 10,13,'moi ban nhap mat khau:$'
ms1 db 10,13,'moi nhap chuoi kt:$'
ms2 db 10,13,'chuoi da nhap la:$'
ms3 db 10,13,'chuoi doi thanh chu hoa:$'
ms4 db 10,13,'chuoi doi thanh chu thuong:$'
hoten db 123 dup('$')
hotenchuan db 123 dup ('$')
ln db 5 dup('$')
mk1 db 15 dup('$')
mk2 db 15 dup('$')
.code
batdau:
mov ax,@data
mov ds,ax
call l\n
call kq1
call m\k
call kq2
call l\v
call nhap
call xuat1
call xuat2
call ae
call hoten1
call nhap
call xuat1
call xuat2
call inho
call inten
call az
call h\t
call thoat
l\n proc
mov ah,09h
lea dx,nhapkt
int 21h
mov cx,3
lap:
mov ah,01h
int 21h
cmp al,'n'
je n
mov ah,09h
lea dx,nhlai
int 21h
loop lap
jmp chiabuon
jmp hengaplai
l\n endp
kq1 proc
n:mov ah,09h
lea dx,nhdung
int 21h
jmp m\k
chiabuon:mov ah,09h
lea dx,sai
int 21h
hengaplai:mov ah,09h
lea dx,het
int 21h
jmp thoat
kq1 endp
m\k proc
mov dl,'l'
mov mk1[0],dl
mov dl,'a'
mov mk1[1],dl
mov dl,'m'
mov mk1[2],dl
mov dl,'n'
mov mk1[3],dl
mov dl,'h'
mov mk1[4],dl
mov dl,'a'
mov mk1[5],dl
mov dl,'t'
mov mk1[6],dl
nhaplaimk:mov ah,09h
lea dx,nhapmk
int 21h
mov cx,7
mov si,0
lapnhap: mov ah,01h
int 21h
mov mk2[si],al
inc si
loop lapnhap
mov cx,7
mov si,0
lapsosanh:mov dl,mk2[si]
mov al,mk1[si]
cmp al,dl
jne kq2
inc si
loop lapsosanh
mov ah,09h
lea dx,nhdung
int 21h
jmp l\v
m\k endp
kq2 proc
mov ah,09h
lea dx,sai
int 21h
jmp nhaplaimk
kq2 endp
l\v proc
mov ah,09h
lea dx,cviec
int 21h
mov ah,09h
lea dx,lviec
int 21h
ae proc
mov ax,@data
mov ds,ax
lea dx,s1
mov ah,09H
int 21h
ae endp
az proc
mov ah,09h
lea dx,hien
int 21h
mov cx,26
mov ah,02h
mov dl,'A'
lap1:
int 21h
inc dl
loop lap1
az endp
h\t proc
mov ah,09
lea dx, t
int 21h
mov ah,0ah
lea dx, s
int 21h
lea si,s+2
buoc3:
mov al,[si]
cmp al,0dh
je buoc10
cmp al,'a'
jb buoc7
cmp al,'z'
ja buoc7
sub al,32
mov [si],al
jmp buoc9
buoc7:
cmp al,'A'
jb buoc9
cmp al,'Z'
ja buoc9
add al,32
mov [si],al
jmp buoc9
buoc9:
inc si
jmp buoc3
buoc10:
mov al,'$'
mov [si],al
mov ah,09h
lea dx,hoathuong
int 21h
mov ah,02
mov dl,0dh
int 21h
mov ah,02
mov dl,0ah
int 21h
mov ah,09
lea dx, s+2
int 21h
h\t endp
hoten1 proc
mov ah,09h
lea dx,moinhap
int 21h
mov cx,50
mov si,0
lapnhap1:
mov ah,01h
int 21h
mov hovaten[si],al
inc si
cmp al,13
loopne lapnhap1
jmp inten
hoten1 endp
inten proc
mov cx,50
mov di,0
lapdem:
mov al,hovaten[si]
mov ten[di],al
inc di
dec si
cmp al,32
loopne lapdem
mov ah,09h
lea dx,hienthi1
int 21h
mov cx,50
dec di
hienthiten:
mov dl,ten[di]
mov ah,02h
int 21h
dec di
loopne hienthiten
inten endp
inho proc
mov ah,09h
lea dx,hienthi2
int 21h
inc si
mov cx,si
mov si,0
hienthiho:
mov dl,hovaten[si]
mov ah,02h
int 21h
inc si
loop hienthiho
inho endp
nhap proc
mov ah,09h
lea dx,ms1
int 21h
mov cx,120
mov si,0
lapnhap2:mov ah,01h
int 21h
mov hoten[si],al
inc si
cmp al,13
loopne lapnhap2
nhap endp
xuat1 proc
mov ah,09h
lea dx,ms2
int 21h
lea dx,hoten
int 21h
xuat1 endp
xuat2 proc
mov cx,si
mov di,0
copy:
mov al,hoten[di]
mov hotenchuan[di],al
inc di
loop copy
mov al,hotenchuan[0]
sub al,32
mov hotenchuan[0],al
dec si
mov cx,si
mov si,1
mov di,2
lapdoichuan:
mov al,hotenchuan[si]
cmp al,32
je doi
inc si
inc di
loop lapdoichuan
doi:
mov dl,hotenchuan[di]
sub dl,32
mov hotenchuan[di],dl
mov ah,09h
lea dx,ms3
int 21h
lea dx,hotenchuan
int 21h
xuat2 endp
thoat proc
mov ah,4ch
int 21h
thoat endp
end batdau