Chao SV
.model small
.stack 64
.data
moinhap db 10,13, "moi nhap ho ten sinh vien: $"
sinhvien db 10,13, "ban la sinh vien lop a hay b (A/b)? : $"
lopa db 10,13, "chao ban $"
lopb db " sinh vien lop b $"
loopa db " sinh vien lop a $"
hoa db 10,13, "ho va ten doi thanh in hoa $"
nguoc db 10,13,"ho ten dao nguoc la: $"
chuoi db 31 dup ("$")
thongbao db 10,13,"Nhap Sai! $"
.code
star:
mov ax,@data
mov ds,ax
lea dx,moinhap
mov ah,09h
int 21h
mov si,0
mov cx,31
lapnhap:
mov ah,01h
int 21h
cmp al,13
je hienthi
mov chuoi[si],al
inc si
loop lapnhap
hienthi:
lea dx,sinhvien
mov ah,09h
int 21h
lea dx,chuoi
mov sp,si
mov cx,sp
mov si,0
nhap:
lea dx,sinhvien
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,"a"
je in_a
cmp al,"b"
je in_b
jne nhapsai
thoat:
mov ah,4ch
int 21h
loop thoat
in_a:
lea dx,lopa
mov ah,09h
int 21h
lea dx,chuoi
int 21h
lea dx,loopa
mov ah,09h
int 21h
jmp inhoa
in_b:
lea dx,lopa
mov ah,09h
int 21h
lea dx,chuoi
int 21h
lea dx,lopb
mov ah,09h
int 21h
jmp inhoa
inhoa:
sub chuoi[si],20h
inc si
cmp chuoi[si],"$"
je hienthi1
loop inhoa
hienthi1:
lea dx,hoa
mov ah,09h
int 21h
lea dx,chuoi
mov ah,09h
int 21h
mov ah,4ch
int 21h
nhapsai:
lea dx,thongbao
mov ah,09h
int 21h
jmp nhap
end star
Bạn đang đọc truyện trên: AzTruyen.Top