; PROGRAM TITLE GOES HERE - - Compare string
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
data segment ; def ine data segment
string1 db ' Move the cursor backward. '
string2 db ' Move the curs or backward. '
mess1 db ' Match',13,10,' $'
mess2 db ' No match',13,10,' $'
data ends
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
program segment ;def ine code segment
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
main proc far
assume cs:program,ds:data,es:data
start: ;s ta rting execution address
;set up stack for return
push ds ; save o ld data segment
sub ax,ax ;put zero in AX
push ax ;save it on stack
;s et DS register to current data segment
mov ax,data ;datarea segment addr
mov ds,ax ; into DS register
mov es,ax ; in to ES re gi st er
;MAIN PART OF PROGRAM GOES HERE
lea si ,string1
lea di ,string2
cld
mov cx,25
repz cmpsb
jz match
lea dx,mess2
jmp short disp
match:
lea dx,mess1
disp:
mov ah,09
int 21h
ret ; return to DOS
main endp ;end of main par t of program
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
program ends ;end of code segment
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
end start ;end assembly