setup vga error
setup vga error
hi, I use Chris Giese code, modes_c.c.
after I set VgaMode320x200x256, I can't draw anything on my video.
the below is my screen.
after I set VgaMode320x200x256, I can't draw anything on my video.
the below is my screen.
- Attachments
-
- my screen after set vga mode
- sc.jpg (34.45 KiB) Viewed 1739 times
Re: setup vga error
Hi.
How about you?If it doesn't hit the point,will you post your code here?
I've come across the similar situation shown in the picture while using a few SVGA modes defined in VESA's VBE(just random pixels in the upper area of the screen).In my case the reason is that I didn't set the bit indicating clearing the video buffer(screen).But I can still set pixels on the screen(maybe you can do it as well but it's hard to find them among the chaosy pixels).wangy414 wrote:hi, I use Chris Giese code, modes_c.c.
after I set VgaMode320x200x256, I can't draw anything on my video.
the below is my screen.
How about you?If it doesn't hit the point,will you post your code here?
- 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:
Assuming you have tried to set pixels already, you're not alone having difficulty with that mode...
I kindof get the same problem that chain-4 modes dont work. I'm still trying to figure how to get the VGA Sequencer to properly address the likes of mode 13h.
It seems most emulators and cards are more comfortable with Mode X addressing.
You can have a look at my code about how this works (BASIC):
Mode setting code
http://dimensionalrift.homelinux.net/co ... vga_io.bas
a Putpixel is near the end of this file
http://dimensionalrift.homelinux.net/co ... st_gfx.bas
I'm still working on getting linear modes to work - you should watch this wiki page. Once i figure what's going on i'll be posting it here as soon as i can: User:Combuster/VGAwip
I kindof get the same problem that chain-4 modes dont work. I'm still trying to figure how to get the VGA Sequencer to properly address the likes of mode 13h.
It seems most emulators and cards are more comfortable with Mode X addressing.
You can have a look at my code about how this works (BASIC):
Mode setting code
http://dimensionalrift.homelinux.net/co ... vga_io.bas
a Putpixel is near the end of this file
http://dimensionalrift.homelinux.net/co ... st_gfx.bas
I'm still working on getting linear modes to work - you should watch this wiki page. Once i figure what's going on i'll be posting it here as soon as i can: User:Combuster/VGAwip
- Steve the Pirate
- Member
- Posts: 152
- Joined: Fri Dec 15, 2006 7:01 am
- Location: Brisbane, Australia
- Contact:
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Michael Abrash's Zen of Graphics Programming is a great book for manipulating the VGA registers directly. It contains code and documentation for the standard VGA modes and various custom (mode-x) vga modes.wangy414 wrote:hi, firstly, thank you help.now, i know little about the vga.
I just reuse other's code. if you have document about the VGA.
Please give me a copy. thanks a lot.
--Jeff
You are talking about the switching of planes thing are you? Virtual PC seems to emulate chain4 nicely, from my experience, but I know that what runs in VPC may not run nicely on hardware. I've never done the BIOS method of VGA, but this code from my kernel seems to switch planes...if that's your problem...Combuster wrote:I kindof get the same problem that chain-4 modes dont work. I'm still trying to figure how to get the VGA Sequencer to properly address the likes of mode 13h.
Code: Select all
void set_chain4(int plane)
//0-3 planes, -1 is all
{
char adr = inportb(0x3c4);
if(plane != -1)
{
outportw(0x3c4, 0x2 | ( (0x1 << 8) << plane));
}
else
{
outportw(0x3c4, 0x0f02);
}
}
Code: Select all
void vga_flush()
{
char * video = 0xA0000;
char * buffer = 0x80000; //Pick your own buffer address!!!
int chain = 0;
for(;chain < 4; chain++)
{
set_chain4(chain);
buffer = (char *)((int)0x80000 + chain);
video = (char *)0xA0000;
while(buffer < (char *)((int)0x80000 + (screen_width * screen_height)))
{
*video = *buffer;
buffer = buffer + 4;
video++;
}
}
}