Plot Pixel

This is a discussion on Plot Pixel within the C++ Programming forums, part of the General Programming Boards category; Can someone tell me how to plot a pixel in asm and then use it in MSVC++ using inline asm. ...

  1. #1
    Unregistered
    Guest

    Plot Pixel

    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.

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    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;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing pixel colour
    By redruby147 in forum C Programming
    Replies: 11
    Last Post: 06-09-2009, 05:28 AM
  2. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 08:55 AM
  3. Reading pixel color data from screen
    By JJFMJR in forum Windows Programming
    Replies: 8
    Last Post: 08-22-2008, 12:27 PM
  4. Getting Pixel Colour Screen
    By god_of_war in forum C++ Programming
    Replies: 3
    Last Post: 03-14-2006, 12:17 PM
  5. Set a pixel...
    By tigs in forum C Programming
    Replies: 16
    Last Post: 08-06-2002, 01:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21