Murugan.com
Murugan Andezuthu Dharmaratnam

  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  



8086 assembly language compare two strings strcmp procedure

Home   8086   8086 assembly language compare two strings strcmp procedure         


Here;'s a simple procedure to compare two string in 8086 assembly language. some one can use these procedures and macros in my library to make a good tutorial 

strcmp proc near                    ;requires the offset of first and second 
    push bx cx dx si di
    loop_strcmp_loop1:              ;string in si and di 
        mov al,byte ptr cs:[si]     ;if s1s2 then al=2
        inc si
        cmp al,bl
        jg loop_strcmp_great
        cmp al,bl
        jl loop_strcmp_less
        cmp al,'$'
        je loop_strcmp_quit
        cmp bl,'$'
        je loop_strcmp_quit
        jmp loop_strcmp_loop1
        loop_strcmp_quit:
        mov al,1
        pop di si dx cx bx
        ret
    loop_strcmp_great:
        mov al,2
        pop di si dx cx bx
        ret
    loop_strcmp_less:
        mov al,0
        pop di si dx cx bx
        ret
endp






  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  

Copyright 2009 @ Murugan Andezuthu Dharmaratnam