主题:没语法错误,有一条执行路径不执行,请大家帮忙改一下
data segment
a db 100,0,100 dup('$')
b db 100,0,100 dup('$')
Msg db 0ah,0dh,'$'
Msg1 db "input first character string:$"
Msg2 db "Input second character string:$"
Result1 db "-1$"
Result2 db "1$"
Result3 db "0$"
data ends
stack segment para stack
db 20h dup(0)
stack ends
code segment
Assume ds:data,cs:code,ss:stack
start:mov Ax,data
mov ds,Ax
mov es,Ax
lea dx,Msg1
mov ah,09h
int 21h
lea dx,Msg
mov ah,09h
int 21h
lea dx,a
mov ah,0ah
int 21h
lea dx,Msg
mov ah,09h
int 21h
lea dx,Msg2
mov ah,09h
int 21h
lea dx,Msg
mov ah,09h
int 21h
lea dx,b
mov ah,0ah
int 21h
lea dx,Msg
mov ah,09h
int 21h
call Match
mov ah,4ch
int 21h
Match proc far
push ax
push bx
push dx ;50
;add a[1],1
;add b[1],1
xor si,si
xor di,di
lop1:lea bx,a[2]
mov al,[bx+di]
sub al,30h
lea bx,b[2]
mov dl,[bx+si]
sub dl,30h
cmp al,dl
jne lop2
inc di
inc si
lea bx,a
cmp di,word ptr [bx+1]
jz lop3
lea bx,b
cmp si,word ptr [bx+1]
jz lop4
jmp lop1
;70
lop2:lea bx,b
cmp al,dl
jb lop21 ;a<b
jmp lop22 ;a>b
lop3:lea bx,b
cmp si,word ptr [bx+1]
jz lop5 ;a equal b
jmp lop22 ;a'length<b'length,that,a>b
lop4:lea bx,a
cmp di,word ptr [bx+1]
jz lop5 ;a equal b
jmp lop21 ;a'length<b'length,that,a<b
lop21:lea dx,result1
mov ah,09h
int 21h
pop dx
pop bx
pop ax
ret
lop22:lea dx,result2
mov ah,09h
int 21h
pop dx
pop bx
pop ax
ret
lop5: lea dx,result3
mov ah,09h
int 21h
pop dx
pop bx
pop ax
ret
Match endp
code ends
end start
a db 100,0,100 dup('$')
b db 100,0,100 dup('$')
Msg db 0ah,0dh,'$'
Msg1 db "input first character string:$"
Msg2 db "Input second character string:$"
Result1 db "-1$"
Result2 db "1$"
Result3 db "0$"
data ends
stack segment para stack
db 20h dup(0)
stack ends
code segment
Assume ds:data,cs:code,ss:stack
start:mov Ax,data
mov ds,Ax
mov es,Ax
lea dx,Msg1
mov ah,09h
int 21h
lea dx,Msg
mov ah,09h
int 21h
lea dx,a
mov ah,0ah
int 21h
lea dx,Msg
mov ah,09h
int 21h
lea dx,Msg2
mov ah,09h
int 21h
lea dx,Msg
mov ah,09h
int 21h
lea dx,b
mov ah,0ah
int 21h
lea dx,Msg
mov ah,09h
int 21h
call Match
mov ah,4ch
int 21h
Match proc far
push ax
push bx
push dx ;50
;add a[1],1
;add b[1],1
xor si,si
xor di,di
lop1:lea bx,a[2]
mov al,[bx+di]
sub al,30h
lea bx,b[2]
mov dl,[bx+si]
sub dl,30h
cmp al,dl
jne lop2
inc di
inc si
lea bx,a
cmp di,word ptr [bx+1]
jz lop3
lea bx,b
cmp si,word ptr [bx+1]
jz lop4
jmp lop1
;70
lop2:lea bx,b
cmp al,dl
jb lop21 ;a<b
jmp lop22 ;a>b
lop3:lea bx,b
cmp si,word ptr [bx+1]
jz lop5 ;a equal b
jmp lop22 ;a'length<b'length,that,a>b
lop4:lea bx,a
cmp di,word ptr [bx+1]
jz lop5 ;a equal b
jmp lop21 ;a'length<b'length,that,a<b
lop21:lea dx,result1
mov ah,09h
int 21h
pop dx
pop bx
pop ax
ret
lop22:lea dx,result2
mov ah,09h
int 21h
pop dx
pop bx
pop ax
ret
lop5: lea dx,result3
mov ah,09h
int 21h
pop dx
pop bx
pop ax
ret
Match endp
code ends
end start