home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 1998 November (Bonus)
/
GAMESTAR11B.ISO
/
Diverses
/
QPV17E
/
INSTALL.DAT
/
DRVSRC
/
DRVSRC.ZIP
/
DRV.DOC
< prev
next >
Wrap
Text File
|
1995-10-21
|
4KB
|
90 lines
QPV/386 video driver files
~~~~~~~~~~~~~~~~~~~~~~~~~~
If you have a video card which is not supported by QPV/386 (i.e. there is no
*.DRV file for your card), you can write a driver yourself. You have to know
how the bank switching is done with your card, and you must know how to
program in assembler.
First, write a TASM source file named XXXX.ASM (instead of 'XXXX', choose
something descriptive for your VGA card). It has to look like the
following:
----------------------------------------------
| .286 |
| Code Segment Para 'Code' |
| Assume cs:Code |
| Org 100h |
| |
| Procs dw Bank,Init,Exit,0 |
| |
| Bank: ... |
| ... |
| retf |
| |
| Init: ... |
| ... |
| retf |
| |
| Exit: ... |
| ... |
| retf |
| |
| Code Ends |
| End Procs |
----------------------------------------------
If you want to use 386 instructions, don't forget to add USE16 to the
Segment statement.
IMPORTANT: All routines (Bank, Init, and Exit) must end with 'retf'
(far return). You may use the memory from [cs:0] up to [cs:0ffh] for
variables. If you need more memory, you can reserve some using DB,
DW etc. Note: you must initialize the memory! It is NOT allowed to
use 'DB ?' or 'DW ?'! Don't use the data segment, the contents of DS
are undefined and must not be changed. Example:
Tmp dw 0,1,2,3
...
mov ax,cs:[Tmp]
The Init part is called after QPV/386 has switched into graphics mode.
The values for AX and BX which were used to switch to the current mode
are given in AX and BX, respectively.
In CX the number of bytes per line is stored. You may modify it if
necessary. If you don't want to modify it, you must save CX on the stack
if you're using it for other purposes. The default value for CX is
taken from the CFG file; it's usually calculated like this:
16 color modes: width/8 (for a single plane)
256 color modes: width
32K color modes: width*2
16M color modes: width*3 or width*4
This routine may modify any registers without saving them, exept CS, DS,
SS, SP, BP and CX (see above). Most cards don't need an initialization
(because it is done by the BIOS at the mode switch), in this case 'retf'
is the only instruction.
The Exit part is called when the mode is not needed anymore, i.e. before
switching to another mode, or before switching back to text mode.
You must save CS, DS, SS, SP and BP if they're modified.
Again, most cards don't need any exit code, so there's usually only a
'retf'.
The Bank part is called every time a bank switch is necessary.
The bank number is given in AL. The routine may modify AL and DX without
saving them. If other registers are used, they must be saved on the
stack.
The bank switching routine needn't be very fast, since it's called only
when it's really necessary (not very often).
To make the driver file:
TASM /M XXXX.ASM
TLINK /T XXXX.OBJ
REN XXXX.COM XXXX.DRV
Then copy the driver file to the directory which holds QPV/386.EXE.
Finally you have to write a config file. It's best to copy one of the
other config files and make the necessary changes. The first line
should go like 'XXXX BGR' or 'XXXX RGB'.
For more information on the configuration files, please read CFG.DOC.