| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | movsb |
On Dec 27 12:56, 1995, Paul Edwards of 3:711/934.9 wrote:
PE> Hi Matthew. I have the following code...
PE> #include
PE> int main(void)
PE> {
PE> register char *t = NULL;
PE> register char *u = NULL;
PE> while ((*t++ = *u++) != '\n') ; /* This is the only line of interest */
PE> if (*t == 37) printf("hello\n");
PE> return (0);
PE> }
PE> Which produces various assembler on my various compilers, but it
PE> is fairly similar, along the lines...
PE> 002c 8a 01 L2 mov al,[ecx]
PE> 002e 88 02 mov [edx],al
PE> 0030 41 inc ecx
PE> 0031 42 inc edx
PE> 0032 3c 0a cmp al,0aH
PE> 0034 75 f6 jne L2
This is untested. This assumes ds=es and that they are loaded with
the correct values.
cld
mov al,0ah
mov edi,[u]
mov ecx,-1
repne scasb
not ecx
mov edi,[t]
mov esi,[u]
rep movsb
mov [t],edi
when finished t will point to the byte after the line feed. The code
might have to save some registers depending on how you're using the code.
Also under os2 what is in the segment registers, does ds=es or what as
ds and es must contain the selector of the data to be searched. I'll need more
details if you want fully working code as edi and ecx might have a variable
in it. Are you going to make it inline assembly.
Matthew Parker
@EOT:
--- MsgedSQ 3.30
* Origin: Blueee Lilly Snowy (3:711/934.31)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™.