All pastes #36578 Raw Edit

Untitled

public text v1 · immutable
#36578 ·published 2006-01-12 11:41 UTC
rendered paste body
;imprt user32.dll, MessageBoxA
%macro imprt 2 
   extern %2
   import %1 %2
%endmacro

imprt kernel32.dll, ExitProcess
imprt kernel32.dll, GetStdHandle
imprt kernel32.dll, WriteFile

section text USE32
global ..start
..start:

   push sOutputlen
   push sOutput
   call output

   ;VOID ExitProcess(
   ;  UINT uExitCode
   ;);
   push byte 0
   call ExitProcess

output:
   pop ebx     ;output string pointer
   pop ecx     ;output string length
   
   ;HANDLE GetStdHandle(
   ;  DWORD nStdHandle
   ;);
   push dword -11
   call GetStdHandle
   
   ;BOOL WriteFile(
   ;  HANDLE hFile,
   ;  LPCVOID lpBuffer,
   ;  DWORD nNumberOfBytesToWrite,
   ;  LPDWORD lpNumberOfBytesWritten, ;docs says it can't be NULL but it looks like it can
   ;  LPOVERLAPPED lpOverlapped
   ;);
   push 0
   push 0 
   push ecx       ;output string length
   push ebx       ;output string pointer
   push eax       ;STDOUT return from GetStdHandle
   call WriteFile
   ret

section data USE32
sOutput DB "En test i assembler", 0
sOutputlen equ $-sOutput

section bss USE32