cmpsb.asm

来自「想学习汇编语言的」· 汇编 代码 · 共 31 行

ASM
31
字号
TITLE Comparing Strings             (Cmpsb.asm)

; This program uses CMPSB to compare two strings
; of equal length.

INCLUDE Irvine.inc
.data
source BYTE "MARTIN  "
dest   BYTE "MARTINEZ"
str1   BYTE "Source is smaller",0dh,0ah,0

.code
main PROC
	startup

	cld	; direction = up
	mov  esi,OFFSET source
	mov  edi,OFFSET dest
	mov  cx,LENGTHOF source
	repe cmpsb
	jb   source_smaller
	jmp  quit

source_smaller:
	mov  edx,OFFSET str1
	call WriteString

quit:
	exit
main ENDP
END main

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?