Exemple #1
0
void * VBEAPI VBE_getBankedPointer(VBE_modeInfo *modeInfo)
/****************************************************************************
*
* Function:     VBE_getBankedPointer
* Parameters:   modeInfo    - Mode info block for video mode
* Returns:      Selector to the linear framebuffer (0 on failure)
*
* Description:  Returns a near pointer to the VGA framebuffer area.
*
****************************************************************************/
{
    /* We just map the pointer every time, since the pointer will always
     * be in real mode memory, so we wont actually be mapping any real
     * memory.
     *
     * NOTE: We cannot currently map a near pointer to the banked frame
     *       buffer for Watcom Win386, so we create a 16:16 far pointer to
     *       the video memory. All the assembler code will render to the
     *       video memory by loading the selector rather than using a
     *       near pointer.
     */
    ulong seg = (ushort)modeInfo->WinASegment;
    if (seg != 0) {
	if (seg == 0xA000)
	    return (void*)PM_getA0000Pointer();
	else
	    return (void*)PM_mapPhysicalAddr(seg << 4,0xFFFF,true);
	}
    return NULL;
}
Exemple #2
0
/****************************************************************************
REMARKS:
Read the font data from the VGA character generator RAM
****************************************************************************/
static void vga_saveFont(
    uchar *data)
{
    uchar   *A0000Ptr = PM_getA0000Pointer();
    uchar   save[7];

    /* Enable access to character generator RAM */
    save[0] = (uchar)vga_rdinx(SEQ_I,0x00);
    save[1] = (uchar)vga_rdinx(SEQ_I,0x02);
    save[2] = (uchar)vga_rdinx(SEQ_I,0x04);
    save[3] = (uchar)vga_rdinx(SEQ_I,0x00);
    save[4] = (uchar)vga_rdinx(GRA_I,0x04);
    save[5] = (uchar)vga_rdinx(GRA_I,0x05);
    save[6] = (uchar)vga_rdinx(GRA_I,0x06);
    vga_wrinx(SEQ_I,0x00,0x01);
    vga_wrinx(SEQ_I,0x02,0x04);
    vga_wrinx(SEQ_I,0x04,0x07);
    vga_wrinx(SEQ_I,0x00,0x03);
    vga_wrinx(GRA_I,0x04,0x02);
    vga_wrinx(GRA_I,0x05,0x00);
    vga_wrinx(GRA_I,0x06,0x00);

    /* Copy character generator RAM */
    memcpy(data,A0000Ptr,FONT_C);

    /* Restore VGA state */
    vga_wrinx(SEQ_I,0x00,save[0]);
    vga_wrinx(SEQ_I,0x02,save[1]);
    vga_wrinx(SEQ_I,0x04,save[2]);
    vga_wrinx(SEQ_I,0x00,save[3]);
    vga_wrinx(GRA_I,0x04,save[4]);
    vga_wrinx(GRA_I,0x05,save[5]);
    vga_wrinx(GRA_I,0x06,save[6]);
}
Exemple #3
0
/****************************************************************************
REMARKS:
Downloads the font data to the VGA character generator RAM
****************************************************************************/
static void vga_restoreFont(
    const uchar *data)
{
    uchar   *A0000Ptr = PM_getA0000Pointer();

    /* Enable access to character generator RAM */
    vga_wrinx(SEQ_I,0x00,0x01);
    vga_wrinx(SEQ_I,0x02,0x04);
    vga_wrinx(SEQ_I,0x04,0x07);
    vga_wrinx(SEQ_I,0x00,0x03);
    vga_wrinx(GRA_I,0x04,0x02);
    vga_wrinx(GRA_I,0x05,0x00);
    vga_wrinx(GRA_I,0x06,0x00);

    /* Copy font back to character generator RAM */
    memcpy(A0000Ptr,data,FONT_C);
}