CMPS

Hey, I need to compare two strings, does anyone have a a function that will do this?




Comments

  • CMPSB compares a byte at es:di with a byte at ds:si

    CMPSW compares a word and CMPSD compares a dubble-word


    ;-------------------------

    DOSSEG

    .MODEL SMALL

    .STACK 200h

    .DATA

    STRING1 DB "Hallo World !"

    STRING2 DB "How are you ?"

    .CODE

    START:

    MOV AX,@DATA

    MOV DS,AX

    MOV ES,AX

    MOV SI,OFFSET STRING2

    MOV DI,OFFSET STRING1

    MOV CX,13

    REP CMPSB

    JE END

    MOV AX,4C01h

    INT 21h ;Exits with errorcode 1

    END:

    MOV AX,4C00h

    INT 21h

    ;-----------------------


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories