Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

farmersckn

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

This topic is 6916 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
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=-..

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!