I really want to be able to use mode13, but for some reason I cant seem to access the video memory at 0xA0000, if I call my plot pixel function the program just exits, here is my plot pixel function:
Code:
void plotPixel(int x, int y, byte color)
{
VGA[y*SCREEN_WIDTH+x] = color;
}
however if I change it to:
Code:
void plotPixel(int x, int y, byte color)
{
union REGS regs;
regs.h.ah = 0x0C;
regs.h.al = color;
regs.x.cx = x;
regs.x.dx = y;
int86(0x10,®s,®s);
}
it does work, but it is too slow. Does anyone know what I can do to access the memory directly? I have a Geforce4 440 mx with the latest drivers if it is important
Here is the complete code.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
typedef unsigned char byte;
byte *VGA = (byte*)0xA0000;
void enterMode13()
{
union REGS regs;
regs.h.ah = 0x00;
regs.h.al = 0x13;
int86(0x10, ®s, ®s);
}
void exitMode13()
{
union REGS regs;
regs.h.ah = 0x00;
regs.h.al = 0x03;
int86(0x10, ®s, ®s);
}
void plotPixel(int x, int y, byte color);
int main()
{
enterMode13();
plotPixel(0, 0, 5);
getch();
exitMode13();
return 0;
}
void plotPixel(int x, int y, byte color)
{
VGA[y*SCREEN_WIDTH+x] = color;
}