flat assembler
Message board for the users of flat assembler.
Index
> Windows > Graphics in console mode - demo |
Author |
|
bazizmix 20 Feb 2016, 12:38
Will be usefull for start screen in console applications
|
|||||||||||
20 Feb 2016, 12:38 |
|
Trinitek 21 Feb 2016, 07:17
Using ConEmu instead of the default terminal, the graphic flashes for a fraction of a second, and then says "Check graphics in console window".
|
|||
21 Feb 2016, 07:17 |
|
bazizmix 21 Feb 2016, 09:44
Use the normal terminal and all will be ok
|
|||
21 Feb 2016, 09:44 |
|
JohnFound 21 Feb 2016, 12:14
It does not work in wine terminal as well.
|
|||
21 Feb 2016, 12:14 |
|
bazizmix 21 Feb 2016, 14:32
So, this demo was written exclusively for windows console. Without any clones...
|
|||
21 Feb 2016, 14:32 |
|
JohnFound 21 Feb 2016, 17:01
Hm, I am almost sure, that it should work in WINE. I didn't analyze the source in deep, but Isn't it possible to has some bug inside?
|
|||
21 Feb 2016, 17:01 |
|
bazizmix 21 Feb 2016, 20:14
No bugs. Work fine in Win7-32bit and Win10-64bit
|
|||
21 Feb 2016, 20:14 |
|
JohnFound 21 Feb 2016, 21:46
I mean bug, that reveals itself only in WINE.
|
|||
21 Feb 2016, 21:46 |
|
revolution 21 Feb 2016, 23:22
JohnFound wrote: I mean bug, that reveals itself only in WINE. |
|||
21 Feb 2016, 23:22 |
|
Mikl___ 22 Feb 2016, 02:32
bazizmix,
threre are many console examples in Examples for Win64 Iczelion tutorial |
|||
22 Feb 2016, 02:32 |
|
TmX 22 Feb 2016, 06:10
The executable ran fine on Windows built-in terminal app: there was a dragon displayed.
I'm running 32-bit Windows 10, BTW. ConEmu (the latest nightly build) failed to run it properly, though... |
|||
22 Feb 2016, 06:10 |
|
bazizmix 22 Feb 2016, 11:48
Mikl___ nice examples
Masm was my favorite, until I found out fasm |
|||
22 Feb 2016, 11:48 |
|
Mikl___ 24 Feb 2016, 02:09
bazizmix,
at all respect, but your program has three shortcomings:
|
|||
24 Feb 2016, 02:09 |
|
bazizmix 24 Feb 2016, 10:45
you're right, but I did not set out those goals. This is just an example, and anyone can improve it as part of their requirements
Here screenshort
|
||||||||||
24 Feb 2016, 10:45 |
|
Mikl___ 14 Mar 2016, 07:48
Hi, bazizmix!
Code: ;============ Check graphics in console window format PE console 4.0 entry start include 'win32a.inc' struct CONSOLE_CURSOR_INFO dwSize dd ? bVisible dd ? ends struct SMALL_RECT Left dw ? Top dw ? Right dw ? Bottom dw ? ends section '.data' data readable writeable NameConsole db "For exit press 'Esc'",0 bmp_path db 'dragon.bmp',0 hOut dd ? hWnd dd ? hDC dd ? hbitmap dd ? memDC dd ? ScreenX dd ? ScreenY dd ? bi BITMAP cci CONSOLE_CURSOR_INFO ConsoleWindow SMALL_RECT ;--------------------------------------------- section '.code' code readable executable start: xor ebx,ebx invoke FreeConsole invoke AllocConsole invoke SetConsoleTitle,NameConsole invoke GetStdHandle,STD_OUTPUT_HANDLE mov [hOut],eax invoke LoadImage,400000h,bmp_path,ebx,ebx,ebx,LR_LOADFROMFILE mov [hbitmap],eax lea edi,[bi] invoke GetObject,eax,sizeof.BITMAP,edi movzx eax,[bi.bmBitsPixel] shr eax,3 ; eax=bmBitsPixel/8 mul [bi.bmWidth] mul [bi.bmHeight] push eax ;eax=bmpBitsPixel*bmpWidth*bmBitsPixel/8 invoke GetProcessHeap invoke HeapAlloc,eax,HEAP_NO_SERIALIZE mov eax,[bi.bmWidth] shr eax,3 mov [ScreenX],eax ; eax=bmWidth/8 mov edx,357913941 ; edx=(2^32)/12 mov eax,[bi.bmHeight] mul edx mov [ScreenY],edx ; edx=bmHeight/12 invoke GetLargestConsoleWindowSize,[hOut] lea edi,[ConsoleWindow] mov [edi],ebx sub eax, [ScreenX] sbb edx, edx and ax, dx dec eax add eax, [ScreenX] mov [edi+SMALL_RECT.Right],ax shr eax, 16 sub eax,[ScreenY] sbb edx, edx and eax, edx dec eax add eax, [ScreenY] mov [edi+SMALL_RECT.Bottom],ax invoke SetConsoleWindowInfo,[hOut],TRUE,edi mov eax,[ScreenY] shl eax,16 ; Coord.y=ScreenY add eax,[ScreenX] ; Coord.x=ScreenX invoke SetConsoleScreenBufferSize,[hOut],eax lea edi,[cci] invoke GetConsoleCursorInfo,[hOut],edi mov [edi+CONSOLE_CURSOR_INFO.bVisible],ebx ; FALSE invoke SetConsoleCursorInfo,[hOut],edi invoke CloseHandle,[hOut] invoke GetConsoleWindow mov [hWnd],eax invoke GetDC,eax mov [hDC],eax invoke CreateCompatibleDC,eax mov [memDC],eax invoke SelectObject,eax,[hbitmap] @@: invoke Sleep,150 invoke BitBlt,[hDC],ebx,ebx,[bi.bmWidth],[bi.bmHeight],\ [memDC],ebx,ebx,SRCCOPY invoke GetAsyncKeyState,VK_ESCAPE ; Determine whether a key is up or down test eax, 8000h jz @b exit: invoke DeleteObject,[hbitmap] invoke ReleaseDC,[hWnd],[hDC] invoke DeleteDC,[memDC] invoke FreeConsole invoke ExitProcess,ebx ;--------------------------------------------- section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ user32,'user32.dll',\ gdi32, 'gdi32.dll' include 'include\api\kernel32.inc' include 'include\api\user32.inc' include 'include\api\gdi32.inc'
Last edited by Mikl___ on 07 Jun 2020, 00:18; edited 1 time in total |
||||||||||
14 Mar 2016, 07:48 |
|
bazizmix 15 Mar 2016, 13:20
Mikl___, well done
|
|||
15 Mar 2016, 13:20 |
|
Picnic 24 Apr 2016, 13:05
Nice demo. I think i will include this feature in my Basic. It's kinda cool. I have posted a simillar example some moment in the past.
Parameters are wrong here Code: invoke ReleaseDC,[hDC],[hWnd] Should be Code: invoke ReleaseDC,[hWnd],[hDC] Last edited by Picnic on 24 May 2017, 19:43; edited 1 time in total |
|||
24 Apr 2016, 13:05 |
|
catafest 24 Apr 2016, 19:41
AV told me is infected with TR/Dropper.
I think is section '.data' data problem. @Mikl___ this remember by MIRC with effect of chat window. Maybe this is offtopic but http://cmder.net has a great window ... |
|||
24 Apr 2016, 19:41 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.