delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/01/07:36:09

From: ajps AT mail DOT telepac DOT pt (aperes)
Newsgroups: comp.os.msdos.djgpp
Subject: Assembly routine
Date: Thu, 01 Jul 1999 07:33:02 GMT
Lines: 54
Message-ID: <377b163a.2813653@news.telepac.pt>
NNTP-Posting-Host: 194.65.181.247
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

Please help me!

I'm trying to write a routine that transfers the contents of a buffer
to video memory. This is my routine:

int main(void)
{
    unsigned char virtual_screen[64000];


    set_mode_13h();
    .....

    FlipAsm(_my_ds(), (int) virtual_screen);

    ....

   set_text_mode();

}

void FlipAsm(short buffer, int source)
{
  short video;

  video = _dos_ds;

  asm("
       PUSHL %%ES
       PUSHL %%DS
       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 */
       MOVW $32000, %%CX
       REP
       MOVSW
       POPL %%DS
       POPL %%ES
      "
      :
      : "g" (video), "g" (buffer), "g" (source)
      : "eax", "ecx", "edi", "esi"
      );

}

The problem is that i can't pass to FlipAsm routine the correct adress
of variable virtual_screen. How can i do that?
(sorry my poor english)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019