Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include '%fasmi%\win32ax.inc'
- section '.ven' code readable executable writeable
- ;Returns the size of the string
- strlength dd _strlength
- _strlength:
- mov edi, [esp+4]
- xor eax, eax
- xor ecx, ecx
- not ecx
- repne scasb
- not ecx
- dec ecx
- mov eax, ecx
- retn 4
- ;Writes text to the screen - write( 'Text with null-terminator' )
- write dd _write
- _write:
- push dword [esp+4]
- call _strlength
- push eax
- invoke GetStdHandle, -11
- pop ecx
- invoke WriteConsole, eax, dword [esp+4*4], ecx, ' ', 0
- retn 4
- ;Writes text to the screen breaking a line - writeln( 'Text with null-terminator' )
- writeln dd _writeln
- _writeln:
- push dword [esp+4]
- call _write
- call @f
- db 0x0A, 0x0D, 0x00
- @@:
- call _write
- retn 4
- ;Set cursor position on the console - setpos( x, y )
- setpos dd _setpos
- _setpos:
- shl dword [esp+8], 16
- mov eax, [esp+4]
- or [esp+8], eax
- push dword [esp+8]
- invoke GetStdHandle, -11
- pop ecx
- push ecx
- push eax
- call [SetConsoleCursorPosition]
- retn 8
- ;Writes a chunk of data to overwrite what is on the screen - CLS()
- clearscr dd _clearscr
- _clearscr:
- invoke setpos, 0, 0
- call @f
- rb 10240
- db 0x00
- @@:
- pop edi
- push edi
- mov al, 20h
- mov ecx, 10240
- rep stosb
- call [write]
- invoke setpos, 0, 0
- retn
- ;Set text color (foreground/background) pattern is described as:
- ;where I=Intensity, R=Red, G=Green, B=Blue. 11110000 is Background and 1111 is Foreground
- ;IRGBIRGB
- setcolor dd _setcolor
- _setcolor:
- invoke GetStdHandle, -11
- invoke SetConsoleTextAttribute, eax, dword [esp+4]
- retn 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement