| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | memcpy |
Hi, Paul. PE> So are you proud of me? :-) Of course! But it's the buffer move problem your solving here, not the move until \n problem. And I'm glad to see you remembered to cld, I assumed/forgot that in my code. However, go back to my Test 9 and Test 10 - the lodsd/stosd loop was slower than loading and storing eax; it may also be slower in the rep movsd version. I think that should be tested. PE> memcpy is designed to copy from a buffer to another buffer, for PE> a length of whatever. No overrun allowed. Destination to be PE> returned to caller. Parameter order is dest, source, length... You should also mention that it returns *dest (if I've read that 'C' code properly). PE> ; stringa.asm - string assembler functions PE> ; PE> ; This program written by Paul Edwards, Fidonet 3:711/934 PE> ; Released to the public domain PE> .386p PE> .model flat PE> _DATA segment dword public use32 "DATA" PE> _DATA ends PE> _BSS segment dword public use32 "BSS" PE> _BSS ends AAMOI why do specify these segments here? PE> DGROUP group _DATA,_BSS PE> assume cs:_TEXT,ds:DGROUP PE> _TEXT segment "CODE" PE> public memcpy PE> memcpy proc PE> push ebp PE> mov ebp, esp PE> pushf PE> push edi PE> push esi PE> push ecx PE> mov edi, [ebp+8] PE> mov esi, [ebp+12] PE> mov ecx, [ebp+16] PE> cld PE> shr ecx, 2 PE> rep movsd PE> mov ecx, [ebp+16] PE> and ecx, 00000003H PE> rep movsb PE> mov eax, [ebp+8] PE> pop ecx PE> pop esi PE> pop edi PE> popf PE> pop ebp PE> ret PE> memcpy endp PE> _TEXT ends PE> end Nice code. Regards, FIM. * * Want the right answer? Ask the right question! @EOT: ---* Origin: Pedants Inc. (3:711/934.24) SEEN-BY: 690/718 711/809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.