The built-in routine to set the palette takes 8 milliseconds on my machine;
this is way too slow - it is possible to write the palette entirely during
the vertical blanking period.  This code works for DOS:

        push    ds
        mov     dx, 0x3D6               // Select XR14
        mov     al, 0x14
        out     dx, al

        mov     dx, 0x3D7               // Enable VSYNC, Retrace, and HSYNC
        in      al, dx
        and     al, 0x8F
        or      al, 0x50

        out     dx, al
        in      al, dx

        mov     dx, 0x3DA               // Wait for Vertical retrace

  loop0:

        in      al, dx
        and     al, 0x08
        jz      loop0

        mov     dx, 0x3C8               // Send the palette
        mov     al, 0
        out     dx, al
        mov     cx, 768
        lds     si, pal
        mov     dx, 0x3C9
        rep     outsb
        pop     ds

I've translated it to:

void setPalette( uchar *thePalette )
  {
    uchar   stat;

    outb( 0x3D6, 0x14 );                // Select XR14
    stat    = inb( 0x3D7 ) & 0x8F;      // Enable VSYNC, Retrace, and HSYNC
    outb( 0x3D7, stat | 0x50 );

    while ( inb( 0x3D7 ) & 0x08 )
        continue;

    outb( 0x3C8, 0 );                   // Send the palette

    /* How do I put in the in-line assembly here? */

  }




--
 _
Kevin D. Quitt                                               [EMAIL PROTECTED]
                      96.37% of all statistics are made up



------------------------------------------------------------------
Unsubscribe:  To:   [EMAIL PROTECTED]
              Body: unsubscribe linux-svgalib

Reply via email to