📄 dstr004.asm
字号:
;************************************************************************
;* MODULE INFORMATION*
;**********************
;* FILE NAME: dstr004.asm
;* SYSTEM NAME: devlib
;* ORIGINAL AUTHOR(S): Paul Lemmers
;* VERSION NUMBER:
;* CREATION DATE: 1990/8/14
;*
;* DESCRIPTION: Contains dev_strcpy
;*
;************************************************************************
;* CHANGES INFORMATION **
;************************
;* REVISION: $Revision: 1.1 $
;* WORKFILE: $Workfile: dstr004.asm $
;* LOGINFO: $Log: D:/CPROG/MYDEV/DEVLIB/VCS/DSTR004.ASV $
;*
;* Rev 1.1 17 Dec 1990 14:35:30 PAUL
;* Function headers added
;*
;* Rev 1.0 14 Aug 1990 14:41:58 PAUL
;* Initial revision.
;************************************************************************/
;
INCLUDE cdev.inc
_TEXT SEGMENT
;************************************************************************
;* NAME: dev_strcpy
;* SYNOPSIS: char far *dev_strcpy(char far *dest, char far *src);
;* DESCRIPTION: See C-runtime strcpy
;* UNMODIFIED REGISTERS:
;* ds bp si di
;* RETURNS: See C-runtime strcpy
;* TIMING:
;* This implementation (scasb ; movsw/b ) is O( 10*N ),
;* an implementation with a load, compare and store instructions
;* is O( 17*N ). Where N is the string length.
;************************************************************************
PUBLIC _dev_strcpy
dest = 4
src = 8
_dev_strcpy PROC NEAR
push bp
mov bp,sp
push ds
push di
push si
les di,[bp+src] ; get ptr to src string
mov cx,0FFFFh
xor ax,ax ; search for '\0'
repne scasb
not cx ; cx := # nonzero+1
lds si,[bp+src]
les di,[bp+dest]
mov ax,di
mov dx,es ; prepare return value
shr cx,1 ; calculate # of words
rep movsw
jnc $L001 ; jump if no last byte
movsb
$L001: pop si
pop di
pop ds
pop bp
ret
_dev_strcpy ENDP
_TEXT ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -