Home | History | Annotate | Download | only in dos
      1 #
      2 # memmove.S
      3 #
      4 # Simple 16-bit memmove() implementation
      5 #
      6 
      7 	.text
      8 	.code16gcc
      9 	.globl memmove
     10 	.type memmove, @function
     11 memmove:
     12 	pushw %di
     13 	pushw %si
     14 	movw %ax,%di
     15 	movw %dx,%si
     16 	cmpw %si,%di
     17 	ja 1f
     18 	# The third argument is already in cx
     19 	cld
     20 	rep ; movsb
     21 2:
     22 	popw %si
     23 	popw %di
     24 	ret
     25 
     26 1:	/* si <= di, need reverse copy */
     27 	add %cx,%di
     28 	add %cx,%si
     29 	dec %di
     30 	dec %si
     31 	std
     32 	rep ; movsb
     33 	cld
     34 	jmp 2b
     35 
     36 	.size memmove,.-memmove
     37