About the Virtual Flat-Framebuffer Device

The virtual flat-framebuffer device (VFLATD) is a nonreplaceable VxD that virtualizes the video frame-buffer for video adapters that map bytes of video memory in 64K blocks to the physical framebuffer. The VFLATD functions are called by display drivers that do not use a flat memory model and that require a framebuffer that is larger than 64K bytes in length. Early video adapters worked efficiently within the 64K frame buffer provided by Windows. However, as resolution and color capabilities increased, the 64K limit presented unique problems. For example, if a VGA video adapter is set at a resolution of 640 by 480 pixels and uses an 8-bit per pixel format, it requires a 300K frame buffer. In order to work within the constraints of the system, it was necessary to devise a method of mapping bytes from the larger buffer required by an adapter to the smaller buffer allocated by the system. This method of mapping is known as a bank switching. Using this VxD, a Chicago display driver obtains access to a logical flat framebuffer. The size of this buffer is specified by the display driver. (The maximum allowable size is 1Mb.)

VFLATD supports two protected mode functions; it does not support any services or real-mode functions. The functions are Get_Ver and Get_Video_Base. A display driver calls the Get_Ver function to verify that the correct version of VFLATD has been loaded. A display driver calls the Get_Video_Base function to register its bank-switching function and to obtain a selector identifying the logical framebuffer. The bank-switching function maps a 64K block of video data into the physical framebuffer. The function must be written using 32-bit code and must be a maximum of 100 bytes in length. When the procedure is called, EAX must identify the new bank to be swapped into the physical framebuffer. The procedure must save all registers and must not return a value.

Reference

This section provides details about the functions that VFLATD must support.

Get_Ver


mov     dx, Get_Ver      ; Function number
mov     ebx, VMHandle
call    VFlatDApiProcAdr
jz      errorhandler

Retrieves the VFLATD version number. Uses Flags.

VMHandle

Handle of the virtual machine.

Get_Video_Base


mov     dx, Get_Video_Base  ; Function number
mov     ebx, VMHandle
push    ds
pop     es
lea     di, BankSwitchProc
movzx   edi, di
mov     cx, BankSwitchProcLength
call    VFlatDApiProcAdr
jz      errorhandler
mov     VideoSelector, ax
mov     VideoAddress, dx

Registers a display driver's bank-switch function and retrieves a selector for a logical frame buffer. Uses Flags.

VMHandle

Handle of the virtual machine.

BankSwitchProc

Address of display driver's bank-switch procedure.

BankSwitchProcLength

Length of display driver's bank-switch procedure.

The bank-switch procedure must be written using 32-bit code and must be a maximum of 100 bytes in length. When the procedure is called, EAX must identify the new bank to be swapped into the physical framebuffer. The procedure must save all registers and it must not have a ret instruction (since the code is copied inline).