⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matchpre.asm

📁 ART OF Assembly Language Programming, 很不错
💻 ASM
字号:

MatchPre	proc	far		;Must be far!
		push	bp
		mov	bp, sp
		push	ax
		push	ds
		push	si
		push	di

		lds	si, 2[bp]	;Get the return address.
CmpLoop:	mov	al, ds:[si]	;Get string to match.
		cmp	al, 0		;If at end of prefix,
		je	Success		; we succeed.
		cmp	al, es:[di]	;See if it matches prefix,
		jne	Failure		; if not, immediately fail.
		inc	si
		inc	di
		jmp	CmpLoop

Success:	add	sp, 2		;Don't restore di.
		inc	si		;Skip zero terminating byte.
		mov	2[bp], si	;Save as return address.
		pop	si
		pop	ds
		pop	ax
		pop	bp
		stc			;Return success.
		ret

Failure:        inc	si		;Need to skip to zero byte.
		cmp	byte ptr ds:[si], 0
		jne	Failure
		inc	si
		pop	di
		mov	2[bp], si	;Save as return address.
		pop	si
		pop	ds
		pop	ax
		pop	bp
		clc			;Return failure.
		ret
MatchPre	endp
		end

⌨️ 快捷键说明

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