🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

how do you plot a pixel in turbo c++, 13h?

Started by
0 comments, last by farmersckn 24 years, 7 months ago
i did this:

_AH = 0;
_AL = 13;
geninterrupt(0x10);

and i know i set the screen to mode 13 because my mouse cursor(this is in a mouse program) showed up as a cursor, and the text is all blocky(8x8). however, when i tried to set a pointer to 0xA000, which (i believe)is the address of the screen, and change a pixel...
*(pointer_to_screen + x + 320 * y) = color
... it did nothing. is there a way to do this? ive tried doing it the way the tutorials said in the tutorial section, but it didn't work. can anyone help? maybe there's a way to plot pixels w/ interrupts?
im sure someone out there knows, so im thanking you for your help in advance.

Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.
Advertisement
Maybe you haven't declared the pointer to A000:0000 correctly... Here's some example code which will show you how to do it under Turbo C++.
===========================================
#include
#include
#include

typedef unsigned char byte;
typedef unsigned int word;

byte far* vga = (byte far *) 0xA0000000L;

void PutPixel(word x, word y, byte color)
{
*(vga+(y<<8)+(y<<6)+x) = color;
}

void SetMode(word mode)
{
_AX = mode;
geninterrupt(0x10);
}

int main(void)
{
SetMode(0x0013);

srand((word) time(NULL));

for (int i = 0; i < 256; i++)
PutPixel(rand()%320, rand()%200, rand()%256
);

getch();

SetMode(0x0003);

return 0;
}
===========================================
Good Luck!

..-=ViKtOr=-..

This topic is closed to new replies.

Advertisement