Im using dgjpp v2 and it compiles with no errors, it gives me exit code 255 (I have no idea what that means).
But this does nothing, its supposed to draw a pixel and wait for a keypress....
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;
}