flat assembler
Message board for the users of flat assembler.
Index
> Windows > Windows C Console Functions? |
Author |
|
TmX 22 Jun 2007, 19:25
This could be some help :
http://board.flatassembler.net/topic.php?t=3195 http://board.flatassembler.net/topic.php?t=3135 |
|||
22 Jun 2007, 19:25 |
|
DJ Mauretto 22 Jun 2007, 19:36
Code: format PE CONSOLE 4.0 entry start Include 'win32a.inc' section ".code" code readable writeable executable start: invoke printf, string invoke getchar invoke ExitProcess,0 section '.data' data readable writeable string db "Hello Word!",13,10,0 section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ msvcrt,'msvcrt.dll' import kernel32,\ ExitProcess,'ExitProcess' import msvcrt,\ getchar,'getchar',\ printf,'printf' |
|||
22 Jun 2007, 19:36 |
|
rhyno_dagreat 22 Jun 2007, 21:04
Thanks for the info! I'll check it out as soon as I finish my work for a C++ class I'm taking.
|
|||
22 Jun 2007, 21:04 |
|
hologram 26 Jun 2007, 20:47
Code: format PE CONSOLE 4.0 entry start Include 'win32a.inc' section ".code" code readable executable start: cinvoke printf, string cinvoke getchar cinvoke exit,0 section '.data' data readable writeable string db "Hello Word!",13,10,0 section '.idata' import data readable writeable library msvcrt,'msvcrt.dll' import msvcrt,\ getchar,'getchar',\ printf,'printf',\ exit,'exit' Use cinvoke instead of invoke or you need to add to esp the number of parameters called * 4 |
|||
26 Jun 2007, 20:47 |
|
vid 26 Jun 2007, 21:07
just look at Examples section on flatassembler.net, there is one example by me how to use them
|
|||
26 Jun 2007, 21:07 |
|
madmatt 29 Jun 2007, 13:18
Quote: Use cinvoke instead of invoke Yeh, and you can use these in normal windows programming too, just include the dll defines like a normal windows .dll, and just remember to use 'cinvoke' instead of 'invoke'. |
|||
29 Jun 2007, 13:18 |
|
Picnic 20 Feb 2008, 19:49
Here's a small pe console script i wrote.
It prints random color pixels using gdi SetPixel function on console window. Tested on Win xp sp2 Code: format pe console entry start include 'win32ax.inc' section '.code' code readable writeable executable start: invoke GetStdHandle,STD_OUTPUT_HANDLE mov [stdout],eax mov [rect.Left],0 mov [rect.Top],0 mov [rect.Right],79 mov [rect.Bottom],39 mov [coord.x],80 mov [coord.y],40 mov [cinfo.dwSize],25 mov [cinfo.bVisible],FALSE cinvoke system,<'cls'> cinvoke srand,<cinvoke time,NULL> invoke SetConsoleTitle,<'Random Pixels'> invoke SetConsoleWindowInfo,[stdout],1,rect invoke SetConsoleScreenBufferSize,[stdout],dword[coord] invoke SetConsoleCursorInfo,[stdout],cinfo invoke FindWindow,NULL,<'Random Pixels'> mov [hWnd],eax invoke GetDC,[hWnd] mov [hdc],eax @@: cinvoke rand shl eax,9 push eax cinvoke rand pop ecx add eax,ecx mov esi,eax invoke SetPixel,[hdc],<stdcall rnd,640>,<stdcall rnd,480>,esi cinvoke _kbhit test eax,eax jz @b invoke ExitProcess,0 proc rnd max cinvoke rand shl eax,17 mul [max] mov eax,edx ret endp section '.data' data readable writeable struc COORD { .x dw ? .y dw ? } struc SMALL_RECT { .Left dw ? .Top dw ? .Right dw ? .Bottom dw ? } struc LPCONSOLE_CURSOR_INFO { .dwSize dd ? .bVisible db ? } cinfo LPCONSOLE_CURSOR_INFO rect SMALL_RECT coord COORD stdout dd ? hWnd dd ? hdc dd ? section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ msvcrt,'msvcrt.dll',\ user32,'user32.dll',\ gdi32,'gdi32.dll' import gdi32,\ SetPixel,'SetPixel' import user32,\ GetDC,'GetDC',\ FindWindow,'FindWindowA' import kernel32,\ ExitProcess,'ExitProcess',\ GetStdHandle,'GetStdHandle',\ SetConsoleTitle,'SetConsoleTitleA',\ SetConsoleCursorInfo,'SetConsoleCursorInfo',\ SetConsoleWindowInfo,'SetConsoleWindowInfo',\ SetConsoleCursorPosition,'SetConsoleCursorPosition',\ SetConsoleScreenBufferSize,'SetConsoleScreenBufferSize' import msvcrt,\ _kbhit,'_kbhit',\ system,'system',\ srand,'srand',\ rand,'rand',\ time,'time' Last edited by Picnic on 20 Feb 2008, 21:31; edited 1 time in total |
|||
20 Feb 2008, 19:49 |
|
revolution 20 Feb 2008, 19:55
I think rnd looks nicer like this:
Code: proc rnd max cinvoke rand shl eax,17 mul [max] mov eax,edx ret endp |
|||
20 Feb 2008, 19:55 |
|
Picnic 20 Feb 2008, 21:33
You're right revolution. I edited my post.
|
|||
20 Feb 2008, 21:33 |
|
Picnic 01 Mar 2008, 18:29
Last edited by Picnic on 21 Mar 2020, 10:11; edited 1 time in total |
|||||||||||
01 Mar 2008, 18:29 |
|
rugxulo 04 Mar 2008, 16:08
re: man.zip, nifty!! And only 3.5k UPXed.
|
|||
04 Mar 2008, 16:08 |
|
Picnic 06 Mar 2008, 20:18
thanks rugxulo.
the animator should get the credits but i don't who is |
|||
06 Mar 2008, 20:18 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.