Viết chương trình nhập hay chuỗi tối đa 40 ký tự. So sánh chiều dài hai chuỗi, hiển thị kết quả so sánh.
Mã:
.Model Small 
.Stack 
.Data
        S Db "Nhap Chuoi Thu Nhat:$" 
        S1 db 13,10,"Nhap Chuoi Thu Hai:$" 
        S2 db 13,10,"Chuoi 1 Lon Hon:$" 
        S3 db 13,10,"2 Chuoi Bang Nhau:$" 
        S4 db 13,10,"Chuoi 2 Lon Hon:$" 
        Buf1 db 41,?,42 dup('$') 
        Buf2 db 41,?,42 dup('$') 
.Code 
        Begin: 
             ;Khoi Tao Chuong Trinh 
                Mov Ax,@Data 
                Mov Ds,Ax 
                ;Hien Thi Chuoi S 
                Lea Dx,S 
                Mov Ah,09 
                Int 21h 
                ;Nhap Chuoi Thu Nhat 
                Mov Ah,0ah 
                Lea Dx,Buf1 
                Int 21h 
                ;Lay du lieu tu buf1  
                Mov Si,Offset Buf1+2 
                ;Hien Thi Chuoi S1 
                Lea Dx,S1 
                Mov Ah,09 
                Int 21h 
                ;Nhap Chuoi Thu Hai 
                Mov Ah,0ah 
               Lea Dx,Buf2 
                Int 21h 
                ;Lay du lieu tu buf2  
                Mov Di,Offset Buf2+2 
                Cmp Si,Di 
                Ja  Lon 
                Jb  Nho 
                ;Hien Thi Chuoi S3 
                Mov Ah,09 
                Lea Dx,S3 
                Int 21h 
                Lon: 
                        ;Hien Thi Chuoi S2 
                        Mov Ah,09 
                        Lea Dx,S2 
                        Int 21h 
                Nho: 
                        ;Hien Thi Chuoi S4 
                        Mov Ah,09 
                        Lea Dx,S4 
                        Int 21h 
                ;Thoat Chuong Trinh 
                Mov Ax,4c00h 
                Int 21h 
        End Begin