Created
September 27, 2014 14:38
-
-
Save Fortyseven/cd273d441b6d9cd141fc to your computer and use it in GitHub Desktop.
Move386 assembler code for Turbo Pascal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Procedure _Move386(VAR SRC,DST;CNT:Word); Assembler; | |
{ SRC = Source Buffer, DST = Destination Buffer, } | |
{ CNT = Number of BYTEs to move. Requires 386+. } | |
{ Revision History: } | |
{ 05-06-95 (SJM) Created by Steven J Morales! } | |
{ 06-18-95 (SJM) Removed PUSH and POP for speed.} ASM | |
{ Instructions: Clocks: Comments: } | |
MOV AX, DS; { 08: Save DS in AX. } | |
LDS SI, SRC; { 16: Load Source Buffer. } | |
LES DI, DST; { 16: Load Destination Buffer. } | |
MOV CX, CNT; { 08: Store length in CX. } | |
MOV BX, CX; { 02: Store a copy in BX. } | |
SHR CX, 2; { 09: Number of DWORDs to MOVS. } | |
DB 66h; REP MOVSW; { --: Extended 32-bit REP MOVSD.} | |
MOV CX, BX; { 02: Get Length again. } | |
AND CX, 3; { 04: # of leftover BYTEs (0-3).} | |
REP MOVSB; { --: Store leftover BYTEs. } | |
MOV DS, AX; { 08: Restore DS from AX. } END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment