News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

VGA Driver

Started by Farabi, May 29, 2012, 09:48:05 PM

Previous topic - Next topic

Farabi

Anyone have refference for using the VGA port to change resolution or something? I want to create a driver for the VGA.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

qWord

There is a nice series of articles about driver development on CodeProjects:
Driver Development Part 6: Introduction to Display Drivers
MREAL macros - when you need floating point arithmetic while assembling!

Tedd

Potato2

dedndave

also - qWord pointed you to a nice set of articles by Toby Opferman
but - they apply to (32-bit) NT drivers

you want to read up on DOS drivers
they may seem a little odd, at first, but they are really simple
they assemble as a 16-bit TINY model program with an entry point of 0

hutch--

Scrat (Toby Opferman) was always a funny guy, talented too.

Farabi

I found this on the BIOS old code, but doesnt seem worked onmy system. Could it be each BIOS installed on each computers had a different code?


VBE_DISPI_INDEX_ID              equ 0
VBE_DISPI_INDEX_XRES            equ 1
VBE_DISPI_INDEX_YRES            equ 2
VBE_DISPI_INDEX_BPP             equ 3
VBE_DISPI_INDEX_ENABLE          equ 4
VBE_DISPI_INDEX_BANK            equ 5
VBE_DISPI_INDEX_VIRT_WIDTH      equ 6
VBE_DISPI_INDEX_VIRT_HEIGHT     equ 7
VBE_DISPI_INDEX_X_OFFSET        equ 8
VBE_DISPI_INDEX_Y_OFFSET        equ 9
VBE_DISPI_INDEX_NB              equ 0xa

VBE_DISPI_ID0                   equ 0xB0C0
VBE_DISPI_ID1                   equ 0xB0C1
VBE_DISPI_ID2                   equ 0xB0C2

VBE_DISPI_DISABLED              equ 000h
VBE_DISPI_ENABLED               equ 001h
VBE_DISPI_LFB_ENABLED           equ 040h
VBE_DISPI_NOCLEARMEM            equ 080h


fVBE_OutW proc index:dword,val:dword

mov eax,index
mov edx,01ceh
out dx,ax

mov eax,val
mov edx,01d0h
out dx,ax

ret
fVBE_OutW endp

fvga_vbe_set_mode proc _width:dword,height:dword,depth:dword

mov al,0
mov edx,03c0h
out dx,al

invoke fVBE_OutW,VBE_DISPI_INDEX_ENABLE,VBE_DISPI_DISABLED
    invoke fVBE_OutW,VBE_DISPI_INDEX_X_OFFSET, 0;
    invoke fVBE_OutW,VBE_DISPI_INDEX_Y_OFFSET, 0;
    invoke fVBE_OutW,VBE_DISPI_INDEX_XRES, _width;
    invoke fVBE_OutW,VBE_DISPI_INDEX_YRES, height;
    invoke fVBE_OutW,VBE_DISPI_INDEX_BPP, depth;
    invoke fVBE_OutW,VBE_DISPI_INDEX_ENABLE,VBE_DISPI_ENABLED
   
    mov al,0
mov edx,03c0h
out dx,al

mov al,20h
mov edx,03c0h
out dx,al

ret
fvga_vbe_set_mode endp
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

dedndave

looks like VESA stuff to me   :P

in the old days, what was different was every video card - lol
you had to have a set of VESA drivers that matched the video chip-set

Farabi

I want to make a driver for my own toys OS. I had everything from reading file, changing video mode alocating memory, create thread, but I want to know it deeper. I want to toying with the port.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

dedndave

for playing around - you can do a lot, because you don't have to support 300 different video cards   :P
also - you don't have to follow any conventions as far as driver format

if you want to learn about the video card hardware, Tedd gave you some nice links
VGA chipsets are roughly based on the motorola 6845 CRT controller that was used in the original IBM MDA and CGA cards

FORTRANS

Hi,

   Well, programming at the chip/port level can be problematic at
times.  The best reference I own is "Programmer;s Guide to the
EGA, VGA, and Super VGA Cards" by Richard F. Ferraro, Third
Edition, 1994.  It is more a reference than a tutorial, and by now
a bit outdated.

   For you learning the basics I would use the video BIOS for the
standard video modes, and VESA (VBE) BIOS for extended video
modes.  You will still want to write your own set pixel and other
low level routines, but setting the modes and other setup is best
handled by BIOS functions.  Text for instance is well supported
by the video BIOS for the standard video modes.  On my
computers, the VESA BIOS does not handle text acceptably, so
I would need to write my own routines when I wanted to use text.
The best book I have for learning about the standard video modes
is "Programmer's Guide to PC Video Systems" by Richard Wilton,
Second Edition, 1994.  I think you can find a file that contains
the text of the book (or the first edition) by searching the web.

   I did want extended support for video functions on my palmtop
computer, so I wrote a fair amount of code to support non-
standard operations for Mode 6 video display.  But most of the
time I try to use BIOS routines for anything other than pixel
operations.

HTH,

Steve N.