Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 farmersckn   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 November 1999 - 08:14 PM

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.


Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 13 November 1999 - 08:14 PM

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=-..





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS