BIOS plotting vs writing directly to video memory
BIOS plotting vs writing directly to video memory
Which one's the most efficient, and what's the best way for somebody new to this to learn how to do it? Got some tutorials, and they've allowed me to set graphical mode instead of text mode, but the actual plotting of pictures's still a point where I'm doubting wether to go one way or the other. BIOS is said to be easier to do, but alot slower, while writing straight to video memory's said to be alot faster, but harder to do too. I don't know how much it'll influence computers from 486 on, nor do I know exactly how big those differences are, so I have no basis as to what I should make my choice for now. Any help'd be greatly appreciated.
Re:BIOS plotting vs writing directly to video memory
Although using BIOS is nice and easy, writting to video memory it wwwaaaaayyyyyy faster.
Are you in text mode of graphics?
Are you in Protected mode or real mode? In PMode, realistically you MUST go direct to video memory.
srg
Are you in text mode of graphics?
Are you in Protected mode or real mode? In PMode, realistically you MUST go direct to video memory.
srg
Re:BIOS plotting vs writing directly to video memory
Code: Select all
void SetMode (unsigned int Mode) {
union REGS regs;
regs.x.ax = Mode; /* Put the desired mode in register AX */
int86(0x10,®s,®s); /* Showtime! */
}
void Plot_Pixel_BIOS(unsigned int x, unsigned int y, int color) {
union REGS regs;
regs.h.ah = 0x0c;
regs.h.al = color;
regs.x.cx = x;
regs.x.dx = y;
/* Call BIOS function 0x0C (PlotPixel) */
int86(0x10, ®s, ®s);
}
union REGS regs;
regs.h.ah = 0x00; /* function 00h = mode set */
regs.h.al = 0x13; /* 256-color mode 13h */
int86(0x10,®s,®s); /* do it! */
regs.h.ah = 0x00;
regs.h.al = 0x03; /* text mode is mode 3 */
int86(0x10,®s,®s);
return 0;
Re:BIOS plotting vs writing directly to video memory
Looks like PMode code relying on a VM86 task to do the graphics via the standard BIOS int 10.
That'll be MUCH slower than handling things yourself.
That'll be MUCH slower than handling things yourself.
Re:BIOS plotting vs writing directly to video memory
Ok, so according to Srg, I have to do it myself then. Does this mean that both effects neutralize themselves, or is it more like -5 + 1?
Re:BIOS plotting vs writing directly to video memory
Doing it yourself is going to be faster there's no doubt about it.
How complicated it is to program really depends on what graphics mode you're working in. Eg VGA 320x200x256 is very straightforward and simple to do, whilst 640x480x16 is far more of a pain in the neck.
If you can live with drawing using the BIOS interrupts then I'd suggest continuing and doing the rest of whatever your project is first. You can replace the drawing routines with your own at any point.
How complicated it is to program really depends on what graphics mode you're working in. Eg VGA 320x200x256 is very straightforward and simple to do, whilst 640x480x16 is far more of a pain in the neck.
If you can live with drawing using the BIOS interrupts then I'd suggest continuing and doing the rest of whatever your project is first. You can replace the drawing routines with your own at any point.
Re:BIOS plotting vs writing directly to video memory
Hmmm... 256 colors's always better than 16 ;D I'll go with that. This means directly writing, right? Any hints on doing that as simple and efficient as possible?
Re:BIOS plotting vs writing directly to video memory
Look up 'Graphics mode 13' in google.
That should give you some starting links. There are a huge number of tutorials on this mode because a lot of older demos got written in it (Because it's easy/fast).
That should give you some starting links. There are a huge number of tutorials on this mode because a lot of older demos got written in it (Because it's easy/fast).
Re:BIOS plotting vs writing directly to video memory
I got this, and [url=http://mega.ist.utl.pt/~fjds//vga13tut1.html]this. The last two got me as far as I am now, but the first one seems to be able to get me further. It leaves a couple of questions open, though.
How do these lines of code work?
__dpmi_regs rg;
vb = (unsigned char*) (__djgpp_convential_base+0xA0000);
__dpmi_int (0x10, &rg);
What I'm asking is mostly 'bout that Djgpp-specific command (those things starting with __)
Typos in code
As the author made some typos, of which some in the example code (obvious one is: unsigned char *vidoe_buffer), which parts of the example code containts more of them that aren't as obvious (like they could be standard things... inport comes into mind)?
How do these lines of code work?
__dpmi_regs rg;
vb = (unsigned char*) (__djgpp_convential_base+0xA0000);
__dpmi_int (0x10, &rg);
What I'm asking is mostly 'bout that Djgpp-specific command (those things starting with __)
Typos in code
As the author made some typos, of which some in the example code (obvious one is: unsigned char *vidoe_buffer), which parts of the example code containts more of them that aren't as obvious (like they could be standard things... inport comes into mind)?