Hi,
My OS (PM) is able to configurate the VGA card to mode 320x200, but I've heard VGA is compatible to mode 640x480. So which command should I send to which port to enter this mode?
Thx!
VGA: How to set 640x480 ?
You just need to send the correct register values, just like you did for entering 300x200, as far as I know.
I don't know if I have them handy; or else, try to find their correct values on the Internet, or put it in 640x480x16color mode using BIOS and read each register value, save them in a text/binary file and then integrate them in your OS.
I don't know if I have them handy; or else, try to find their correct values on the Internet, or put it in 640x480x16color mode using BIOS and read each register value, save them in a text/binary file and then integrate them in your OS.
Simple example here: http://www.frontiernet.net/~fys/modex.htm
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
640x480
Code: Select all
#define CLK_25 0x00
#define CLK_28 0x04
{
.info = {
.infoType = PICTURE_GFX4BPP6BPC,
.vMemSize = (640*480/2),
.infoWidth = 640,
.infoHeight = 480,
.infoRefresh = 0
},
.extReg = {0x03|0xC0|CLK_25},
.crtReg = {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,0x0,0x80,0xe,0xf,0x0,0x0,0x0,0x20,0x9c,0x8e,0x8f,0x28,0x7f,0x96,0xb9,0xff,0xff},
.seqReg = {0xff, 0x0, 0xff, 0x0, 0x0},
.atrReg = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0x1,0x0,0xff,0x00},
.gfxReg = {0xff,0,0,0,0,0,0x01,0x00,0xff}
},
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
The function for writing to the attribute registers look a little weird.
I could not find a point in the code to enable the palette registers which point into the digital to analog controller. Is this okay, or does it work on real hardware anyway?
http://www.osdever.net/FreeVGA/vga/attrreg.htm
Code: Select all
' Function: Write3C0
' Writes an index/value pair to VGA register 3C0 (Attribute Control Register)
'
' in:
' index - the AC register to access
' value - the value to write
'
Sub Write3C0 Cdecl Alias "Write3C0" (index as byte, value as Unsigned byte)
inportb &H3DA
outportb &H3C0, index
outportb &H3C0, value
End Sub
http://www.osdever.net/FreeVGA/vga/attrreg.htm
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
The code has a safe-guard: it will always reset the flip-flop (the byte inport) before writing to the attribute controller (the two byte outports).
Both the palette and RAMDAC seem to be initialized at boot so there is no direct need to change their contents, although it is a good thing if you want to be sure of the exact colors.
Both the palette and RAMDAC seem to be initialized at boot so there is no direct need to change their contents, although it is a good thing if you want to be sure of the exact colors.