Can someone tell me how to plot a pixel in asm and then use it in MSVC++ using inline asm. Thank you. Links are welcome.
Can someone tell me how to plot a pixel in asm and then use it in MSVC++ using inline asm. Thank you. Links are welcome.
Well, you are asking a very general question.
There are lots of things you must think about. You say you are using MSVC++, I am guessing that means you are using Win32 because it does not support DOS, except for console mode, which cannot do graphics.
So if you are doing DOS, you better get a different compiler, like Borland.
If you are doing Windows, what API are you using? Windows? DirectX? SDL? OpenGL? In Windows you cannot just plot a pixel using ASM...but you can do that in DOS.
I am going to assume you are using DOS, 13h mode, here is how to do some basic pixel plotting:
[CODE]
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
unsigned char *screen = (char *) 0xA0000000;
void putpixel ( int x, int y, int color, unsigned char *surface )
{
surface[ (y<<8) + (y<<6) + x ] = color;
}
int main ( void )
{
//intialize 13h mode
asm {
mov ax, 13h
int 10h
}
putpixel ( 50, 50, 35, screen );
getch();
//close 13h mode, return to text mode
asm {
mov ax, 03h
int 10h
}
return 0;
}