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

📄 move.asm

📁 Dos6.0
💻 ASM
字号:
;
; memory routines
;
;   Modifications:
;
;	01-Dec-1986 mz	Optimize odd move using rcl hack
;

.xlist
include ..\h\cmacros.inc
.list

sBegin	code
assumes cs,code

cProc	Move,<PUBLIC>,<DS,SI,DI>
parmD	src
parmD	dst
parmW	count
cBegin
	mov	cx,count
	jcxz	NoByte			; No characters to move
	les	di,dst			; grab pointers
	lds	si,src
	cld
	mov	ax,ds
	cmp	ax,Seg_dst
	jnz	SimpleMove		; segments are NOT the same, no opt
	cmp	si,di			; is the start of source before dest
	jb	TestMove		; yes, try to optimize

SimpleMove:
	shr	cx,1
	rep	movsw
	rcl	cx,1
	rep	movsb
	jmp	short NoByte

TestMove:
	mov	ax,di
	sub	ax,si			; ax = difference between regions
	cmp	ax,cx			; is difference greater than region?
	jae	SimpleMove		; yes, no optimize
	mov	ax,cx			; optimize by copying down from top
	dec	ax
	add	di,ax
	add	si,ax
	std
	rep	movsb			; no word optimization here

	cld
NoByte:
cEnd

cProc	Fill,<PUBLIC>,<DI>
parmD	dst
parmB	value
parmW	count
cBegin
	cld
	les	di,dst
	mov	al,value
	mov	ah,value
	mov	cx,count
	shr	cx,1
	jcxz	fill1
	rep	stosw
fill1:
	jnc	fill2
	stosb
fill2:
cEnd

sEnd

end

⌨️ 快捷键说明

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