VESA plotting pixel issue

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

VESA plotting pixel issue

Post by NickJohnson »

I have VM86 working as well as a method for calling various VBE functions, which at the very least gives sane data for controller and mode info blocks. However, I'm having trouble properly plotting pixels. I set mode 0x112 (640x480x24 direct color, according to the mode info block), switch to bank 0 for window A (which is at 0xA0000), and set the first byte to 0xFF. I would expect this to make a single blue pixel at the top left corner of the screen, but instead, I get eight white pixels in a line from the top left corner of the screen. Nothing I do seems to be able to create color; at best, I can mostly fill the screen with white. What could the problem be?

I'm using QEMU, and I get the same problem with all other direct color modes that I can set (I haven't tried any of the packed pixel modes.)
User avatar
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

Re: VESA plotting pixel issue

Post by Karlosoft »

The blocks are very slow, why don't you use the LBA? (if you are on a version of vesa 1.2 or better i think)
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: VESA plotting pixel issue

Post by Chandra »

Karlosoft wrote:The blocks are very slow, why don't you use the LBA? (if you are on a version of vesa 1.2 or better i think)
LBA?
It's LFB, and that too on VESA 2.0 or higher.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: VESA plotting pixel issue

Post by Chandra »

Now, onto the point
NickJohnson wrote:I have VM86 working as well as a method for calling various VBE functions, which at the very least gives sane data for controller and mode info blocks. However, I'm having trouble properly plotting pixels. I set mode 0x112 (640x480x24 direct color, according to the mode info block), switch to bank 0 for window A (which is at 0xA0000), and set the first byte to 0xFF. I would expect this to make a single blue pixel at the top left corner of the screen, but instead, I get eight white pixels in a line from the top left corner of the screen. Nothing I do seems to be able to create color; at best, I can mostly fill the screen with white. What could the problem be?

I'm using QEMU, and I get the same problem with all other direct color modes that I can set (I haven't tried any of the packed pixel modes.)
Hmm... the mode no. might be wrong. You should never rely on the standard mode numbers because they are no longer STANDARD. Rather, you have to query for the available video modes and then set the mode you want, if available.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Combuster
Member
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:

Re: VESA plotting pixel issue

Post by Combuster »

I noticed your screen behaves as 640x480x4, VGA mode 0x12 (the lower byte of 0x112) - have you tried dumping the register values before calling the INT?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: VESA plotting pixel issue [SOLVED]

Post by NickJohnson »

@Chandra: I am reading the mode numbers from the controller info block, not using standard ones. It just so happens that QEMU's video card's mode numbers match the obsolete standard numbers.

@Combuster: Yep, that was the problem. It turns out that I was casting the mode number to a uint8_t at one point, because I misread the spec as saying it was 8 bits wide instead of 9 bits. #-o Everything works fine now.
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: VESA plotting pixel issue [SOLVED]

Post by Chandra »

NickJohnson wrote: I am reading the mode numbers from the controller info block, not using standard ones. It just so happens that QEMU's video card's mode numbers match the obsolete standard numbers.
You're right. I missed that myself though I use QEMU and VESA everyday. It just happened, never mind.
Good to hear you got that solved. Cheers.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

Re: VESA plotting pixel issue

Post by Karlosoft »

@Chandra Sorry it was 6 AM here when I wrote that post -.-. I think I was a bit tired because I misunderstood all the meaning of the original post. XD Please forgive me!
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: VESA plotting pixel issue

Post by Chandra »

Karlosoft wrote:@Chandra Sorry it was 6 AM here when I wrote that post -.-. I think I was a bit tired because I misunderstood all the meaning of the original post. XD Please forgive me!
That's OK. After all, we all are here to learn.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Post Reply