Problem using Vesa modes under BOCHS [SOLVED]

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
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Problem using Vesa modes under BOCHS [SOLVED]

Post by Chandra »

Hello, I've been writing DOS like 16 bit operating system with GUI and extended memory support.I am using BOCHS 2.4.5 as the pc-emulator and it had been working fine with all my 16 bit functions. Then came the hiccup.
1. When i initialize the 1024x768x256 vesa mode(using inline assembly) inside the kernel, then I can't get above the first 62 colors. I'm using bank switching(I know it's slow). When i use any color out of the fist 62 colors then my putpixel functions woks fine. But when i try to go above 62 colors then Boch's doesn't show any thing. It simply says "Going to fulscreen mode" and then blank. Surprisingly when i write this code directly to bootloader and actually reboot the pc then my real bios is able to diaplay all the 256 colors. But boch's can't.
2. Secondly, I wrote a mouse handling function to keep track of the mouse button states and position. I've wrritten code to get 3 bytes from the keboard I/O port(also the mouse port) but boch's sends me more than 3 bytes and it also doesn't give me proper bytes as it should be. Apparently, when I use QEMU it woks perfect with no sign of error. Whew!

Qemu is the solution of my second problem but not my first problem. Please help!! I'm desperately looking forward to get out of this trouble.
Last edited by Chandra on Mon Sep 27, 2010 12:43 am, edited 1 time in total.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Problem using Vesa modes under BOCHS

Post by Owen »

Have you actually set the graphics cards palette?
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Problem using Vesa modes under BOCHS

Post by Chandra »

Owen wrote:Have you actually set the graphics cards palette?
No, I haven't setup the graphics cards pallete.I think this is not the problem because my putpixel function works fine when I simply reboot the pc and run my operating system kernel. The problem is bochs can't display more than 62 out of 256 colors wheras, real bios displays all the colors without requiring to setup the pallete.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: Problem using Vesa modes under BOCHS

Post by f2 »

Chandra wrote:
Owen wrote:Have you actually set the graphics cards palette?
No, I haven't setup the graphics cards pallete.I think this is not the problem because my putpixel function works fine when I simply reboot the pc and run my operating system kernel. The problem is bochs can't display more than 62 out of 256 colors wheras, real bios displays all the colors without requiring to setup the pallete.
When you set a 256-colors mode, the video BIOS automatically sets up the palette. I think it is not the case with the video BIOS of Bochs/QEmu. For these emulators, you need to setup the palette yourself.
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Problem using Vesa modes under BOCHS

Post by Chandra »

Yes, I came to know that was exactly what was happening. By setting up the video pallette everything turned out to be fine. But it's quite troublesome. Anyway,thanks alot.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Post Reply