News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Masm video memory

Started by death-tree, August 14, 2006, 12:49:10 PM

Previous topic - Next topic

death-tree

I'm totally new to Masm and tryed to find some examples of how to write to the the video memory to write or draw pixels onto the screen. Could someone help me and explain how I would achieve this and also how to make a EXE file that runs but without a window.

Thanks to anyhow who replies.

hutch--

Hi death-tree,

Welcome on board. I move the topic to the Campus so you would get more answers.

Writing to video memory in 32 bit protected mode is very different to DOS graphics. Your options are use the GDI Windows API functions or alternatiively use OpenGL or DirectX where you can get direct access to video memory. Have a look in the OpenGL forum as "hitch" knows a lot about this stuff.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

death-tree

Would you know how to just simply set a pixel onto the screen like in C++: SetPixel(hwnd,X,Y,RGB(255,255,255));

mnemonic

Quote from: death-tree on August 14, 2006, 03:04:07 PM
Would you know how to just simply set a pixel onto the screen like in C++: SetPixel(hwnd,X,Y,RGB(255,255,255));

With SetPixel maybe?  :wink

If you do not know how to obtain an HDC and the like. I would suggest you use the forum search as that question comes up very regularly.
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

death-tree

Mhh yes I know how to set a pixel in C++ (I did post the code?!?). I was wondering how to do it in masm.

mnemonic

That is not much more difficult.

; Macro borrowed from Iczelions tutorials
RGB macro red,green,blue
    xor    eax,eax
    mov  ah,blue
    shl     eax,8
    mov  ah,green
    mov  al,red
endm

invoke SetPixel, hwnd, X, Y, RGB(255,255,255)


:8)
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

Mark Jones

Quote from: death-tree on August 14, 2006, 12:49:10 PM
...also how to make a EXE file that runs but without a window.

May I ask why you want to do this?

If there is no window, the user cannot close it easily.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

ToutEnMasm

Hello,
With graphics all begin with getting the graphic space of the object.
If the object is a window whose handle is Hwnd
Quote
     invoke GetDC,Hwnd        ;or other simular functions specified for the painting object
     mov Hdc,eax
     ........
     invoke SetPixel,Hdc, X, Y, RGB(255,255,255)

You can also have to create the object to draw with,for example a pen
Quote
      invoke CreatePen,PS_SOLID,1,couleur
      mov Hpen,eax      
and draw with it when he is created

Quote
invoke MoveToEx,Hdc,10,300,NULL

But cannot do it on the desk,you need a window .
                     
                                         ToutEnMasm



death-tree

Nvm about how to make a programme without window.

Anyways thx for the replies, going to give them a try now. Thanks

dicky96

...also how to make a EXE file that runs but without a window.


I've managed to do that quite a few times by accident while trying to learn win32asm so it can't be that difficult  :bg :lol :bg

death-tree

Yeah i found out how to do it, it's the same as in C++.