Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.0 KiB

  1. ?PLM=1 ; PASCAL Calling convention is DEFAULT
  2. ?WIN=0 ; Windows calling convention
  3. PMODE=1
  4. .xlist
  5. include cmacros.inc
  6. include windows.inc
  7. .list
  8. externA __WinFlags ; in KERNEL
  9. externA __AHINCR ; in KERNEL
  10. externA __AHSHIFT ; in KERNEL
  11. ; The following structure should be used to access high and low
  12. ; words of a DWORD. This means that "word ptr foo[2]" -> "foo.hi".
  13. LONG struc
  14. lo dw ?
  15. hi dw ?
  16. LONG ends
  17. FARPOINTER struc
  18. off dw ?
  19. sel dw ?
  20. FARPOINTER ends
  21. ; Manually perform "push" dword register instruction to remove warning
  22. PUSHD macro reg
  23. db 66h
  24. push reg
  25. endm
  26. ; Manually perform "pop" dword register instruction to remove warning
  27. POPD macro reg
  28. db 66h
  29. pop reg
  30. endm
  31. ; -------------------------------------------------------
  32. ; DATA SEGMENT DECLARATIONS
  33. ; -------------------------------------------------------
  34. ifndef SEGNAME
  35. SEGNAME equ <_TEXT>
  36. endif
  37. createSeg %SEGNAME, CodeSeg, word, public, CODE
  38. sBegin Data
  39. sEnd Data
  40. sBegin CodeSeg
  41. assumes cs,CodeSeg
  42. assumes ds,DATA
  43. ;---------------------------Public-Routine------------------------------;
  44. ; MemCopy
  45. ;
  46. ; copy memory
  47. ;
  48. ; Entry:
  49. ; lpSrc HPSTR to copy from
  50. ; lpDst HPSTR to copy to
  51. ; cbMem DWORD count of bytes to move
  52. ;
  53. ; Returns:
  54. ; destination pointer
  55. ; Error Returns:
  56. ; None
  57. ; Registers Preserved:
  58. ; BP,DS,SI,DI
  59. ; Registers Destroyed:
  60. ; AX,BX,CX,DX,FLAGS
  61. ; Calls:
  62. ; nothing
  63. ;-----------------------------------------------------------------------;
  64. cProc MemCopy,<NEAR,PASCAL,PUBLIC>,<ds>
  65. ParmD lpDst
  66. ParmD lpSrc
  67. ParmD cbMem
  68. cBegin
  69. .386
  70. PUSHD di ; push edi
  71. PUSHD si ; push esi
  72. cld
  73. mov ecx,cbMem
  74. jecxz mc386_exit
  75. movzx edi,di
  76. movzx esi,si
  77. lds si,lpSrc
  78. les di,lpDst
  79. mov ebx,ecx
  80. shr ecx,2 ; get count in DWORDs
  81. rep movs dword ptr es:[edi], dword ptr ds:[esi]
  82. mov ecx,ebx
  83. and ecx,3
  84. rep movs byte ptr es:[edi], byte ptr ds:[esi]
  85. mc386_exit:
  86. cld
  87. POPD si : pop esi
  88. POPD di ; pop edi
  89. .286
  90. cEnd
  91. sEnd CodeSeg
  92. end