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

📄 _strncmp.s

📁 操作系统源代码
💻 S
字号:
!	strncmp()					Author: Kees J. Bot!								27 Jan 1994.sect .text; .sect .rom; .sect .data; .sect .bss! int strncmp(const char *s1, const char *s2, size_t cx)!	Compare two strings.!.sect .text.define __strncmp__strncmp:	push	bp	mov	bp, sp	push	si	push	di	xor	ax, ax		! Prepare return value	test	cx, cx		! Max length is zero?	je	equal	mov	si, 4(bp)	! si = string s1	mov	di, 6(bp)	! di = string s2	cldcompare:	cmpsb			! Compare two bytes	jne	unequal	cmpb	-1(si), #0	! End of string?	je	equal	dec	cx		! Length limit reached?	jne	compare	jmp	equalunequal:	ja	after	sub	ax, #2		! if (s1 < s2) ax -= 2;after:	inc	ax		! ax++, now it's -1 or 1equal:	pop	di	pop	si	pop	bp	ret

⌨️ 快捷键说明

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