到目前为止,我有这段代码
org 100h
store MACRO str
LOCAL skip_data, endloop, repeat, localdata
jmp skip_data ; Jump over data
localdata db str, '$', 0 ; Store the macro-argument with terminators
skip_data:
mov si, OFFSET localdata
mov di, OFFSET msg
repeat: ; Loop to store the string
cmp byte ptr [si], 0 ; End of string?
je endloop ; Yes: end of loop
movsb ; No: Copy one byte from DS:SI to ES:DI, inc SI & DI
jmp repeat ; Once more
endloop:
ENDM
store2 MACRO str
LOCAL skip_data, endloop, repeat, localdata
jmp skip_data ; Jump over data
localdata db str, '$', 0 ; Store the macro-argument with terminators
skip_data:
mov si, OFFSET localdata
mov di, OFFSET msg
repeat: ; Loop to store the string
cmp byte ptr [si], 0 ; End of string?
je endloop ; Yes: end of loop
movsb ; No: Copy one byte from DS:SI to ES:DI, inc SI & DI
jmp repeat ; Once more
endloop:
ENDM
crlf MACRO
LOCAL skip_data, localdata
jmp skip_data
localdata db 13, 10, '$'
skip_data:
mov dx, offset localdata
mov ah, 09h
int 21h
ENDM
ORG 100h
mov dx, OFFSET msg
mov ah, 09h
int 21h
crlf
store "Hello!"
mov dx, OFFSET msg
mov ah, 09h
int 21h
crlf
store "Good Bye."
mov dx, OFFSET msg
mov ah, 09h
int 21h
;mov ax, 4C00h
;int 21h
msg db "Hello, World!", '$'
msg2 db "Watafak", '$'
mov dx, OFFSET msg
MOV AH, 09H
INT 21H
crlf
msg cmp msg2
je exit
ret
但它没有比较。如果msg是msg2的子字符串,我如何比较?