What wrong here?
Code:
#include <conio.h>
#include <dos.h>
#define WIDTH 640
#define HEIGHT 480
typedef unsigned char byte;
byte *SCR=(byte *) MK_FP (0xA000,0);
void svga() {
asm mov ax,0x4f02;
asm mov bx,0x101;
asm int 0x10;
}
void textmode() {
asm mov ax,0x03;
asm int 0x10;
}
void putpixel (int x, int y, byte color){
unsigned long pixel_offset = 1.0 * (y * 640 + x);
int bank_num = (pixel_offset >> 16);
asm mov ax, 0x4F05;
asm mov bx, 0x0;
asm mov dx, bank_num;
asm int 0x10;
SCR[(pixel_offset & 0xFFFF)] = color;
}
int main(void) {
svga();
byte color=0;
for (int y=0;y<HEIGHT;y++) {
color=0;
for(int x=0;x<WIDTH;x++)
putpixel(x,y,color++);
}
getch();
textmode();
return 0;
}