flat assembler
Message board for the users of flat assembler.
Index
> Windows > Direct access to video memory |
Author |
|
revolution 18 Feb 2014, 00:22
A$M wrote: Yes, I know it's impossible to do like this: |
|||
18 Feb 2014, 00:22 |
|
A$M 18 Feb 2014, 00:30
revolution wrote:
|
|||
18 Feb 2014, 00:30 |
|
typedef 18 Feb 2014, 01:25
Wouldn't hurt debugging a Windows graphics driver in VMware Then try to make your own. But exposing your hardware like that could lead to system instability.
What makes your program so special that you need DMA? There have been successful video games that use DirectX and never did they complain of the "lack" of DMA. |
|||
18 Feb 2014, 01:25 |
|
A$M 18 Feb 2014, 02:27
Well, I think GDI is easier.
Code: format PE GUI 4.0 entry start XRES = 800 YRES = 600 include "win32ax.inc" section '.text' code readable executable start: invoke GetModuleHandle, 0 mov [wc.hInstance], eax invoke LoadIcon, 0, IDI_APPLICATION mov [wc.hIcon], eax mov [wc.hIconSm], eax invoke LoadCursor, 0, IDC_ARROW mov [wc.hCursor], eax invoke GetStockObject, GRAY_BRUSH mov [wc.hbrBackground], eax invoke RegisterClassEx, wc invoke AdjustWindowRect, winrect, WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_MINIMIZEBOX + WS_VISIBLE, FALSE mov eax, [winrect.left] sub [winrect.right], eax mov eax, [winrect.top] sub [winrect.bottom], eax invoke CreateWindowEx, NULL, class, title, WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_MINIMIZEBOX + WS_VISIBLE, 100, 50, [winrect.right], [winrect.bottom], 0, 0, [wc.hInstance], 0 test eax, eax jz winerror msg_loop: invoke GetMessage, wMsg, 0, 0, 0 cmp eax, 1 jb exit jne msg_loop invoke TranslateMessage, wMsg invoke DispatchMessage, wMsg jmp msg_loop winerror: invoke MessageBox, 0, WinError, 0, MB_ICONERROR+MB_OK exit: mov eax, [wMsg.wParam] invoke ExitProcess, [wMsg.wParam] proc WindowProc uses ebx esi edi ecx, hWnd, uMsg, wParam, lParam mov eax, [uMsg] cmp eax, WM_CREATE je wmCreate cmp eax, WM_TIMER je wmTimer cmp eax, WM_PAINT je wmPaint cmp eax, WM_CLOSE je wmClose cmp eax, WM_DESTROY je wmDestroy invoke DefWindowProcA, [hWnd], [uMsg], [wParam], [lParam] ret wmCreate: invoke malloc, XRES*YRES*4 mov [pSCREEN], eax invoke SetTimer, [hWnd], 1, 1000/60, NULL ret wmTimer: invoke GetTickCount mov ecx, XRES*YRES mov edi, [pSCREEN] rep stosd invoke sprintf, title, title_format, eax invoke SetWindowText, [hWnd], title invoke InvalidateRect, [hWnd], NULL, FALSE ret wmPaint: invoke BeginPaint, [hWnd], psPaint mov [hDC], eax invoke SetDIBitsToDevice, [hDC], 0, 0, XRES, YRES, 0, 0, 0, YRES, [pSCREEN], BITMAPINFO, 0 ;DIB_RGB_COLORS invoke EndPaint, [hWnd], psPaint ret wmClose: invoke free, [pSCREEN] invoke DestroyWindow, [hWnd] ret wmDestroy: invoke PostQuitMessage, WM_QUIT ret endp section '.data' data readable writeable winrect RECT 0,0,XRES,YRES wc WNDCLASSEX wcend-wc, 0, WindowProc, 0, 0, 0, 0, 0, 0, 0, class, 0 wcend: class db "MAIN",0 title db "This is your computer's tick count (...)",0,0,0,0,0,0 title_format db "This is your computer's tick count (%08x)",0 WinError db "Could not create window.",0 BITMAPINFO BITMAPINFOHEADER sizeof.BITMAPINFOHEADER,\ ; biSize XRES,\ ; biWidth -YRES,\ ; biHeight 1,\ ; biPlanes 32,\ ; biBitCount BI_RGB,\ ; biCompression 0,\ ; biSizeImage 0, \ ; biXPelsPerMeter 0, \ ; biYPelsPerMeter 0, \ ; biClrUsed 0 ; biClrImportant section '.bss' data readable writeable wMsg MSG psPaint PAINTSTRUCT hDC dd ? pSCREEN dd ? section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL',\ gdi32,'GDI32.DLL',\ crtdll,'CRTDLL.DLL' include 'api\kernel32.inc' include 'api\user32.inc' include 'api\gdi32.inc' import crtdll,\ malloc,'malloc',\ sprintf,'sprintf',\ free,'free' PS: revolution wrote: www: http://justfuckinggoogleit.com/ EDIT: Well, but if I get access to Ring 1 and I get where Windows places the VESA screen buffer, I could do this? |
|||
18 Feb 2014, 02:27 |
|
revolution 18 Feb 2014, 13:30
A$M wrote: EDIT: Well, but if I get access to Ring 1 and I get where Windows places the VESA screen buffer, I could do this? A$M wrote: PS: |
|||
18 Feb 2014, 13:30 |
|
Melissa 18 Feb 2014, 15:14
You have open source nvidia,amd,intel drivers for Linux. Just download
Linux kernel source and look up how they did it. |
|||
18 Feb 2014, 15:14 |
|
A$M 18 Feb 2014, 18:06
Thanks.
|
|||
18 Feb 2014, 18:06 |
|
nmaps 16 Apr 2014, 03:27
You can use a DIB window (CreateDIBSection() WinAPI).
|
|||
16 Apr 2014, 03:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.