delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/01/16:36:34

From: "Brian Drum" <drum AT ix DOT netcom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Inline ASM Question
Date: 1 Jan 1997 21:08:10 GMT
Organization: Netcom
Lines: 41
Message-ID: <01bbf827$af3f6100$998bb8cd@drum>
NNTP-Posting-Host: knx-tn5-25.ix.netcom.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello,

I was looking at the VESA 2.0 code in Allegro module vesa.c and had a
question about the syntax of the follwing asm statement:

/* vesa_scroll:
 *  Hardware scrolling routine.
 */
static int vesa_scroll(int x, int y)
{
   int ret, seg;
   long a;

   if (_pm_vesa_scroller) {            /* use protected mode interface? */
      seg = _mmio_segment ? _mmio_segment : _my_ds();
      a = (x + (y * VIRTUAL_W)) / 4;

      asm (
	 "  pushw %%es ; "
	 "  movw %w1, %%es ; "         /* set the IO segment */
	 "  call *%0 ; "               /* call the VESA function */
	 "  popw %%es "

      :                                /* no outputs */

      : "S" (_pm_vesa_scroller),       /* function pointer in esi */
	"a" (seg),                     /* IO segment in eax */
	"b" (0x80),                    /* mode in ebx */
	"c" (a & 0xFFFF),              /* low word of address in ecx */
	"d" (a >> 16)                  /* high word of address in edx */

      : "memory", "%edi", "%cc"        /* clobbers edi and flags */
      );

.. . .

What does the %w1 do in the asm statement?

Thanks,

Brian

- Raw text -


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