Click to See Complete Forum and Search --> : SVGA Coding


schnarf283
12-15-2001, 01:57 PM
The following code does nothing. I'm compiling in Borland C++.
#include <conio.h>

void SetVideoMode(int mode)
{
asm {
mov ah, 0x0
mov al, byte ptr mode
int 0x10
}
}

void InitSVGA(int mode=0x116)
{
// 0x116 = 1024x786x32k
asm {
mov ax, 0x4f02
mov bx, byte ptr mode
int 0x10
}
}

void WritePixel(int x, int y, long int color)
{
asm {
mov ah, 0x0C
mov al, byte ptr color
mov bh, 0x01
mov cx, byte ptr x
mov dx, byte ptr y
int 0x10
}
}

void main(void)
{
InitSVGA(0x116);
for(int x=0;x<1024;x++) {
for(int y=0;y<768;y++) {
WritePixel(x, y, 0x50);
}
}
getch();
SetVideoMode(0x3);
}
----END CODE----
After setting windows to run it in fullscreen, it does set the graphics mode, but does no pixel plotting, and seems to make my screen sleep. Any ideas?

------------------
Specs:
Computer 1
------------
PII 450mHz
128 MB SDRAM
14.4 and 75.5 GB 7200 RPM Hard Drives
Riva TNT w/ 16 MB Video RAM
Windows 98/Windows 2000

Computer 2
------------
PI 200mHz
32 MB SDRAM
3 GB 2400 RPM Hard Drive
Matrox Something or Other
Debian 2.2r4, Kernel 2.4.16

Gomez Addams
12-18-2001, 09:07 PM
The Int10 functions are the VESA video function extensions. Are you sure that your video card's BIOS supports them ?

Also, are you sure that byte ptr is the correct type of variable for parameters passed on the stack ? I thought they were referenced off of EBP : EBP+8 for the first argument.

Lastly, are really sure you want to do this kind of stuff ? It will be much more useful in the long run to learn Win32 GDI programming.

schnarf283
12-22-2001, 02:58 PM
I got it working, nt doesn't have very good dos emulation at times. I already know the GDI, I'm just playing around with SVGA.

------------------
EPoX 8KHA+
Athlon XP 1900+
512 MB DDR-SDRAM
PNY GeForce3 TI 200