Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Can someone PLEASE tell me how...

Can someone please tell me how to plot a pixel in DOS, in High/True Color mode using RGB values instead of color numbers? Post or E-mail any links/source code, please.



My e-mail address is [email protected]


Comments

  • : Can someone please tell me how to plot a pixel in DOS, in High/True Color mode using RGB values instead of color numbers? Post or E-mail any links/source code, please.

    :

    : My e-mail address is [email protected]

    :



    Set the mode using the VESA extention of function 10h, then put the bytes of color to memory, starting with segment $a000. For high-color:



    5 bits Red, 6 bits Green, 5 bits Blue



    For true-color:



    8 bits Red, 8 bits Green, 8 bits Blue



    Matthew Gross

    [email protected]






    URL:http://acheronx.resnet.tamu.edu/home/

  • This is relatively easy to find information on, but... oh well



    mov ax, 4f02h ;Function 4F Subfunction 02 SetVideoMode

    mov bx, 112h ;Video mode 112h 640x480x16M colors

    int 10h ;BIOS Video INT



    mov ax, A000h ;Video Segment

    mov es, ax ;load es with video segment

    mov al, 0FFh ;value we'll store

    xor di, di ;point to the beginning of the segment

    stosb ;Store blue es:[di]=al, di++

    stosb ;Store green es:[di]=al, di++

    stosb ;Store red es:[di]=al, di++

    stosb ;Store alpha (usually not used)

    xor ax, ax

    int 16h ;wait for key

    mov ax, 4c00

    int 21h ;outta here



    NOTE: You store the RGB values BACKWARDS.



    All this does is plot a white pixel in the upper left hand corner in 640x480x16 million colors.



    This is an EXTREMELY simple demo, it doesn't go over bank switching or window segments.



    Chances are that this will work on your computer (assuming you have an SVGA video card and a monitor that can handle 640x480x16M). However some things that might make it not work or not work exactly as I said are the segment and the bank.



    Since 640*480 is greater than 64k your video card splits it up into different banks. Newer video cards also support a linear framebuffer, you can look this up for yourself.



    Some cards order their banks 0,1,2,3,4, meaning that the first bank (bank 0) is at the top of the screen, however not all cards do that. To get the correct number you need to do the equation...

    BankNumber=(64/WinGran)*Bank

    where Bank is the number of the bank you'd want if they were ordered 0,1,2,3,4

    WinGran is the window granularity

    BankNumber is the number you'll use when switching banks

    this equation will work for any bank ordering.



    You can get the window granularity by calling int 10 with AX=4f01 cx=mode_you_want_info_on es:di->buffer to hold VESAStructure (see Ralph Brown's Interrupt List, or a search the web)



    you can switch banks by...

    mov ax, 4f05 ;Function 4f subfunction 5 BankSwitch

    xor bx, bx ;BX=Page number (see some VESA site)

    mov dx, BankNumber ;DX=BankNumber

    int 10h ;BIOS Video INT



    Some cards don't use the standard VGA Segment for SVGA.

    You can get the segment you should write to from the VESAStructure. (See Ralph Brown's Interrupt List)



    One place you might want to check out is....



    www.vesa.org which is the homepage of the Video Electronics Standards Association.

    You can download the specifications for the VESA BIOS plus get other information.



    That was a quick overview, but like I said this particular information is very easy to find on the web.






    URL:www.vesa.org

  • StarControl 2 was the best. Though StarControl 3 was pretty good.


Sign In or Register to comment.