Author Topic: VGA Driver  (Read 4868 times)

Farabi

  • Member
  • ****
  • Posts: 970
  • Neuroscience Fans
VGA Driver
« on: May 29, 2012, 09:48:05 PM »
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

  • Member
  • *****
  • Posts: 1471
  • The base type of a type is the type itself
    • SmplMath macros
Re: VGA Driver
« Reply #1 on: May 29, 2012, 10:06:12 PM »
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

  • Member
  • ***
  • Posts: 353
  • Procrastinor Extraordinaire
Re: VGA Driver
« Reply #2 on: May 31, 2012, 12:56:40 AM »
Potato2

dedndave

  • Member
  • *****
  • Posts: 8749
  • Still using Abacus 2.0
    • DednDave
Re: VGA Driver
« Reply #3 on: May 31, 2012, 02:10:21 AM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 4924
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: VGA Driver
« Reply #4 on: May 31, 2012, 02:28:16 AM »
Scrat (Toby Opferman) was always a funny guy, talented too.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

Farabi

  • Member
  • ****
  • Posts: 970
  • Neuroscience Fans
Re: VGA Driver
« Reply #5 on: May 31, 2012, 03:03:47 PM »
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?

Code: [Select]
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

  • Member
  • *****
  • Posts: 8749
  • Still using Abacus 2.0
    • DednDave
Re: VGA Driver
« Reply #6 on: May 31, 2012, 03:09:27 PM »
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

  • Member
  • ****
  • Posts: 970
  • Neuroscience Fans
Re: VGA Driver
« Reply #7 on: May 31, 2012, 04:18:19 PM »
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

  • Member
  • *****
  • Posts: 8749
  • Still using Abacus 2.0
    • DednDave
Re: VGA Driver
« Reply #8 on: May 31, 2012, 09:45:46 PM »
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

  • Member
  • ****
  • Posts: 946
Re: VGA Driver
« Reply #9 on: May 31, 2012, 11:23:16 PM »
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.