From: ajps AT mail DOT telepac DOT pt (aperes) Newsgroups: comp.os.msdos.djgpp Subject: Re: Assembly routine Date: Sat, 03 Jul 1999 08:36:01 GMT Lines: 73 Message-ID: <377dc388.147090@news.telepac.pt> References: <377b163a DOT 2813653 AT news DOT telepac DOT pt> <930893937 DOT 855103 AT kyle DOT inet DOT net DOT nz> NNTP-Posting-Host: 194.65.167.204 X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Fri, 2 Jul 1999 17:12:22 +1200, "David Mitchell" wrote: >aperes wrote in message <377b163a DOT 2813653 AT news DOT telepac DOT pt>... >> >>Please help me! >> >>I'm trying to write a routine that transfers the contents of a buffer >>to video memory. This is my routine: >> >> FlipAsm(_my_ds(), (int) virtual_screen); > >you want to call it by: > FlipAsm(_my_ds(), &virtual_screen); > >also: >> asm(" >> MOVW %0, %%ES /* ES= video (%0) */ >> MOVW %1, %%DS /* DS= buffer (%1) = segmento dados */ >> >> MOVL $0xA0000, %%EAX >> MOVL %%EAX, %%EDI /* EDI = Ax0000, ES:DI >> MOVL %2, %%EAX >> MOVL %%EAX, %%ESI /* ESI = source, DS:SI */ > > >This code is wrong. You are moving the Data segment to ES, whereas you want >to move 0x0a000 to ES, and xorw %%si, %%si >Then it should work. You don't need the video variable. > >David > > Thanks for your help, David but didn't worked or maybe i didn't not understood your explication. Put diferentely, what i want is use the assembly instruction MOVS to move the data in DS:SI (my virtual screen) onto ES:DI (my destiny, the video memory). If in my C program my virtual screen is, for example, VS[64000] how i set up DS, SI to pointer to VS and ES, DI to pointer to video memory? main() { unsigned char VS[64000]; .... .... flip(VS) ; .... } void flip(char *buffer) { ..... /* how to set up DS:SI to pointer to buffer? */ /* how to set up ES:DI to pointer to video memory? */ MOVW $32000, %%CX REP MOVW ... } Excuse me my poor english and thanks for your help and patient. APeres