Extending Bochs / Qemu
Extending Bochs / Qemu
While having problems with getting GRUB to pass me decent VESA info (see some other threads I recently started), I thought of a different approach: what if I developed a simple graphics device to compile with Bochs (or Qemu for that matter) and use that instead of VESA? I have no intentions of running on real hardware for at least the coming year, so a fake gfx card would suite my purposes. Has anyone ever tried that before? Could Bochs plug-ins be used? If so, how (I could find very little info on them while googling)?
JAL
JAL
Re: Extending Bochs / Qemu
What good would that do you most likely have to rewrite a lot of stuff again because of a non existing video. Keeping to VESA will ensure working on real computer afterwards. I'll read the other threads now to see if i can help (doubt it )jal wrote:While having problems with getting GRUB to pass me decent VESA info (see some other threads I recently started), I thought of a different approach: what if I developed a simple graphics device to compile with Bochs (or Qemu for that matter) and use that instead of VESA? I have no intentions of running on real hardware for at least the coming year, so a fake gfx card would suite my purposes. Has anyone ever tried that before? Could Bochs plug-ins be used? If so, how (I could find very little info on them while googling)?
Author of COBOS
I don't want to. Then I'd have to program a Cirrus. Pretty pointless, as Cirrus is dead and not present in a real machine and like I said, I don't want to bother with progamming real video hardware anyway. I want to be able to do a simple out to set the width, one to set the height and one to set bit depth, for example.ucosty wrote:Have you tried using the Bochs Cirrus driver?
JAL
Re: Extending Bochs / Qemu
My video driver could, as long as I'm not leaving Bochs (and that'll be for quite some time), be as simple asos64dev wrote:What good would that do you most likely have to rewrite a lot of stuff again because of a non existing video.
Code: Select all
outb (myVideoPortBase, 0);
outw (myVideoPortBase+2, Width);
outw (myVideoPortBase+4, Height);
outb (myVideoPortBase+6, ColorDepth);
outb (myVideoPortBase, 1);
JAL
Try this code out for size
Code: Select all
class VesaDriver
{
public:
void SetVideoMode(unsigned short width, unsigned short height, unsigned short depth);
void ExitVideoMode();
private:
void WriteCommand(unsigned short index, unsigned short value);
enum VBE_IOPORTS {
VBE_DISPI_IOPORT_INDEX = 0x01CE, VBE_DISPI_IOPORT_DATA = 0x01CF
};
enum VBE_COMMANDS {
VBE_DISPI_INDEX_ID, VBE_DISPI_INDEX_XRES, VBE_DISPI_INDEX_YRES,
VBE_DISPI_INDEX_BPP, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_INDEX_BANK,
VBE_DISPI_INDEX_VIRT_WIDTH, VBE_DISPI_INDEX_VIRT_HEIGHT,
VBE_DISPI_INDEX_X_OFFSET, VBE_DISPI_INDEX_Y_OFFSET
};
enum VBE_FLAGS {
VBE_DISPI_DISABLED, VBE_DISPI_ENABLED, VBE_DISPI_GETCAPS,
VBE_DISPI_8BIT_DAC = 0x20, VBE_DISPI_LFB_ENABLED = 0x40, VBE_DISPI_NOCLEARMEM = 0x80
};
};
void VesaDriver::SetVideoMode(unsigned short width, unsigned short height, unsigned short depth)
{
this->WriteCommand(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED);
this->WriteCommand(VBE_DISPI_INDEX_XRES, width);
this->WriteCommand(VBE_DISPI_INDEX_YRES, height);
this->WriteCommand(VBE_DISPI_INDEX_BPP, depth);
this->WriteCommand(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED );
}
void VesaDriver::ExitVideoMode()
{
this->WriteCommand(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED);
}
void VesaDriver::WriteCommand(unsigned short index, unsigned short value)
{
core::IOPorts::WriteWord(VBE_DISPI_IOPORT_INDEX, index);
core::IOPorts::WriteWord(VBE_DISPI_IOPORT_DATA, value);
}
The cake is a lie | rackbits.com
Well, that's something like I imagined, yes. But I didn't think this was possible, I never heard of VBE having a definition for videoports etc. What specification is this based upon? Or is this just Bochs?ucosty wrote:Try this code out for size
EDIT: I did some Googling, and it seems some Bochs VGA BIOS extension? Can't find much documentation about it though.
JAL
TBH I have no idea what it is based on. I found it while randomly trolling around and found it works nicely in Bochs and QEMU, which is good enough for me at this stage.jal wrote:Well, that's something like I imagined, yes. But I didn't think this was possible, I never heard of VBE having a definition for videoports etc. What specification is this based upon? Or is this just Bochs?ucosty wrote:Try this code out for size
EDIT: I did some Googling, and it seems some Bochs VGA BIOS extension? Can't find much documentation about it though.
JAL
The cake is a lie | rackbits.com
That's what I found, yes, and it serves my purposes for now perfectly. However, it must be something more than just the BIOS, as we're talking direct outs to hardware ports. But I guess the Bochs VGA BIOS creators thought along the same line as I did, i.e. why emulate a piece of hardware when you can do it the easy way...Combuster wrote:AFAIK it is limited to bochs and qemu. The reason that it works on both is that they share a VGA BIOS, and hence the same video interface.
JAL