_head
    << "; Thanks to NAGOA made by PedroGC Aka  Nguga and everyone that\n"
       "; contributed to nagoa+.inc.\n"
       "; Site: http://sapp.telepac.pt/win32asm\n"
       "\n"
       "%define WINDOWS_CUI\n"
       "%define ONLY_NASM\n"
       "\n"
       "\n"
       "\n"
       "%define wcall call_\n"
       "\n"
       "\n"
       "%imacro call_ 1-*\n"
       "%assign i  %0\n"
       " %if %0 > 1\n"
       "   %rep %0 - 1\n"
       "     %rotate -1\n"
       "     %assign i i-1\n"
       "     %rotate -1\n"
       "     %ifidni %1,\"ADDR_\"\n"
       "     %rotate 1\n"
       "     lea eax,  [%1]\n"
       "     push  eax\n"
       "     %rotate -1\n"
       "     %assign i i-1\n"
       "     %else\n"
       "     %rotate 1\n"
       "     STDPUSH {%1}\n"
       "     %endif\n"
       "     %if i <=1\n"
       "     %exitrep\n"
       "     %endif\n"
       "   %endrep\n"
       "   %rotate -1\n"
       " %endif\n"
       " %ifid %1\n"
       "   %ifdef %1_definida\n"
       "\n"
       "     CALL %1\n"
       "   %else\n"
       "     %ifdef ONLY_NASM\n"
       "       CALL [%1]\n"
       "     %else\n"
       "       extern %1\n"
       "       CALL [%1]\n"
       "     %endif\n"
       "   %endif\n"
       " %else\n"
       "   CALL %1\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "%macro STDPUSH 1\n"
       " %ifnum %1\n"
       "\n"
       "   %if %1 >= -128 && %1 <= 127\n"
       "     push byte %1\n"
       "   %else\n"
       "     push dword %1\n"
       "   %endif\n"
       " %else\n"
       "   %ifstr %1\n"
       "     CONST %%str, db %1, 0\n"
       "     push dword %%str\n"
       "   %else\n"
       "     push dword %1\n"
       "   %endif\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       " %imacro CONST 2+\n"
       " jmp near %%skip\n"
       " %1 %2\n"
       " %%skip:\n"
       " %endm\n"
       "\n"
       "\n"
       "  BITS 32\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "  %define  NATIVE_       1\n"
       "  %define  WINDOWS_GUI_  2\n"
       "  %define  WINDOWS_CUI_  3\n"
       "  %define  POSIX_CUI_    7\n"
       "\n"
       "  %define  PAGE    1000h\n"
       "  %define  SECTOR    200h\n"
       "\n"
       "  %define  drvbase   00010000h\n"
       "  %define  dllbase   10000000h\n"
       "  %define  exebase   00400000h\n"
       "\n"
       "  %define  HDRSIZE   hdr_end\n"
       "\n"
       "  %define  CODEPAGES ( ( PAGE + (code_end - code - 1) ) / PAGE )\n"
       "  %define  BSSPAGES  ( ( PAGE + (bss_end  - bss  - 1) ) / PAGE )\n"
       "\n"
       "\n"
       "\n"
       "  %define     PEFILE\n"
       "\n"
       "\n"
       "\n"
       " %ifdef  BSS\n"
       "         %define       OBJECTS 2\n"
       " %else\n"
       "         %define       OBJECTS 1\n"
       " %endif\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       " %ifdef DRIVER\n"
       "    %define    IMAGEBASE   drvbase\n"
       "    %define    SECTION     20h\n"
       "    %define    FILEAL    SECTION\n"
       "    %define    CODE_BASE   HDRSIZE\n"
       "    %define    DATA_BASE   iat___\n"
       "    %define    CHARACTERISTICS 10Eh\n"
       "    %define    IMGSIZE   end_reloc\n"
       "    %define    CODESIZE    (code_end - code)   + (end_init  - init)\n"
       "    %define    DATASIZE    (end_iat  - iat___) + (end_reloc - reloc_)\n"
       "    %define    CODEVSIZE   code_raw_end-code\n"
       "    %define    STACKRESERVE  40000h\n"
       "    %define    SUBSYS    NATIVE\n"
       "    %define    OBJECTS     4\n"
       "    %define    TSCHARACTERISTICS 068000020h\n"
       " %else\n"
       "    %ifdef DLL\n"
       "     %define  IMAGEBASE        dllbase\n"
       "     %define  CHARACTERISTICS    210Eh\n"
       "     %define  DLL__\n"
       "\n"
       "    %else\n"
       "     %define  IMAGEBASE      exebase\n"
       "     %define  CHARACTERISTICS    103h\n"
       "    %endif\n"
       "\n"
       "\n"
       "\n"
       "    %ifdef BSS\n"
       "   %ifdef DLL\n"
       "    %define  BCHARACTERISTICS  0D0000080h\n"
       "   %else\n"
       "    %define  BCHARACTERISTICS  0C0000080h\n"
       "   %endif\n"
       "   %define   BSS_SIZE    BSSVSIZE\n"
       "    %else\n"
       "         %define   BSS_SIZE    0\n"
       "    %endif\n"
       "\n"
       "\n"
       "\n"
       "        %define    IMGSIZE     vsize_\n"
       "    %define    CODE_BASE   PAGE\n"
       "    %define    DATA_BASE   CODE_BASE\n"
       "    %define    SECTION     PAGE\n"
       "    %define    FILEAL    SECTOR\n"
       "    %define    CODESIZE    data_vsize_\n"
       "    %define    CODEVSIZE   CODEPAGES*1000h\n"
       "    %define    BSSVSIZE    BSSPAGES*1000h\n"
       "    %define    TSCHARACTERISTICS 0E0000020h\n"
       "    %define    DATASIZE    CODESIZE\n"
       " %endif\n"
       "\n"
       "\n"
       "\n"
       " %ifdef WINDOWS_CUI\n"
       "    %define  SUBSYS     WINDOWS_CUI_\n"
       " %elifdef NATIVE\n"
       "    %define  SUBSYS     NATIVE_\n"
       " %else\n"
       "    %define  SUBSYS     WINDOWS_GUI_\n"
       " %endif\n"
       "\n"
       "\n"
       "\n"
       " %define    RVADIFF      CODE_BASE-HDRSIZE\n"
       " %define    reloc  RVADIFF+IMAGEBASE\n"
       " %define    reloc_bss  "
       "(CODE_BASE+CODEVSIZE+IMAGEBASE)-(code_end-code)\n"
       "\n"
       "\n"
       "  Section_setup:\n"
       "\n"
       " section .head   vstart=IMAGEBASE  start=0\n"
       " head_start_:\n"
       "\n"
       " section .text   vfollows=.head    follows=.head valign=SECTION\n"
       " text_start_:\n"
       "\n"
       " section .data vfollows=.text    follows=.text valign=1  align=1\n"
       " data_start_:\n"
       "\n"
       " section .bss    vfollows=.data    valign=SECTION\n"
       " bss_start_:\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%macro    rva  1\n"
       "     dd  rva__(%1)\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%define round_(size) (( size + SECTION-1 ) & ~(SECTION-1))\n"
       "\n"
       "\n"
       "%define rva__(label) head_vsize_ + label - text_start_\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       " %ifdef DRIVER\n"
       "   %define ENTRY DriverEntry\n"
       " %else\n"
       "   %define ENTRY rva__(start)\n"
       " %endif\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "  header:\n"
       "   section .head\n"
       "   bits  32\n"
       "\n"
       "  mz_header:\n"
       "\n"
       " .magic                    dw  \"MZ\"\n"
       " .cblp                     dw  90h\n"
       " .cp                       dw  3\n"
       " .crlc                     dw  0\n"
       " .cparhdr                  dw  4\n"
       " .minalloc                 dw  0\n"
       " .maxalloc                 dw  -1\n"
       " .ss                       dw  0\n"
       " .sp                       dw  0B8h\n"
       " .csum                     dw  0\n"
       " .ip                       dw  0\n"
       " .cs                       dw  0\n"
       " .lfarlc                   dw  40h\n"
       " .ovno                     dw  0\n"
       " .res                      times   4 dw 0\n"
       " .oemid                    dw  0\n"
       " .oeminfo                  dw  0\n"
       " .res2                     times   10 dw 0\n"
       " .lfanew                   dd  pe_header-IMAGEBASE\n"
       "\n"
       "  stub:\n"
       "\n"
       "         CALL  .@W\n"
       "         db  \"must on win32!$\"\n"
       "       .@W\n"
       "         pop dx\n"
       "         mov ah, 9\n"
       "         int 21h\n"
       "\n"
       "         mov ah, 4ch\n"
       "         int 21h\n"
       "\n"
       "         align   16, DB 0\n"
       "\n"
       "  pe_header:\n"
       "\n"
       " .Signature                dd  \"PE\"\n"
       " .Machine                  dw  14Ch\n"
       " .NumberOfSections         dw  OBJECTS\n"
       " .TimeDateStamp            dd  0\n"
       " .PointerToSymbolTable     dd  0\n"
       " .NumberOfSymbols          dd  0\n"
       " .SizeOfOptionalHeader     dw  0E0h\n"
       " .Characteristics          dw  CHARACTERISTICS\n"
       "\n"
       "  OptionalHeader:\n"
       "\n"
       " .Magic                    dw  10Bh\n"
       " .MajorLinkerVersion       db  0\n"
       " .MinorLinkerVersion       db  0\n"
       " .SizeOfCode               dd  CODESIZE\n"
       " .SizeOfInitializedData    dd  DATASIZE\n"
       " .SizeOfUninitialzedData   dd  BSS_SIZE\n"
       " .AddressOfEntryPoint      dd  ENTRY\n"
       " .BaseOfCode               dd  CODE_BASE\n"
       " .BaseOfData               dd  DATA_BASE\n"
       " .ImageBase                dd  IMAGEBASE\n"
       " .SectionAlignment         dd  SECTION\n"
       " .FileAlignment            dd  FILEAL\n"
       " .MajorOperSystemVersion   dw  4\n"
       " .MinorOperSystemVersion   dw  0\n"
       " .MajorImageVersion        dw  0\n"
       " .MinorImageVersion        dw  0\n"
       " .MajorSubsystemVersion    dw  4\n"
       " .MinorSubsystemVersion    dw  0\n"
       " .Reserved1                dd  0\n"
       " .SizeOfImage              dd  vsize_\n"
       " .SizeOfHeaders            dd  head_size_\n"
       " .CheckSum                 dd  0\n"
       " .Subsystem                dw  SUBSYS\n"
       " .DllCharacteristics       dw  0\n"
       " .SizeOfStackReserve       dd  100000h\n"
       " .SizeOfStackCommit        dd  1000h\n"
       " .SizeOfHeapReserve        dd  100000h\n"
       " .SizeOfHeapCommit         dd  1000h\n"
       " .LoaderFlags              dd  0\n"
       " .NumberOfRvaAndSizes      dd  10h\n"
       "\n"
       "  DataDirectories:\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "   .export     times 2 dd 0\n"
       "\n"
       "\n"
       "\n"
       "\n"
       " .import     dd  rva__(import), end_import_ - import\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       " .rsrc     times 2 dd 0\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "   .exception    times 2 dd 0\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "   .certificate    times 2 dd 0\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       " .reloc      times 2 dd 0\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       " .misc_sectionz    times 10*2 dd 0\n"
       "\n"
       "\n"
       "  SectionTables:\n"
       "\n"
       "\n"
       "%define csize code_end - code\n"
       "\n"
       "text_section:\n"
       " .SectionName              db  \".text\", 0, 0, 0\n"
       " .VirtualSize              dd  data_vsize_\n"
       " .VirtualAddress           dd  head_vsize_\n"
       " .SizeOfRawData            dd  data_size_\n"
       " .PointerToRawData         dd  head_size_\n"
       " .PointerToRelocations     dd  0\n"
       " .PointerToLinenumbers     dd  0\n"
       " .NumberOfRelocations      dw  0\n"
       " .NumberOfLinenumbers      dw  0\n"
       " .Characteristics    dd  TSCHARACTERISTICS\n"
       "\n"
       "%ifdef BSS\n"
       "bss_section:\n"
       " .SectionName              db  \".bss\", 0, 0, 0, 0\n"
       " .VirtualSize              dd  BSSVSIZE\n"
       " .VirtualAddress           dd  CODEVSIZE+PAGE\n"
       " .SizeOfRawData            dd  0\n"
       " .PointerToRawData         dd  0\n"
       " .PointerToRelocations     dd  0\n"
       " .PointerToLinenumbers     dd  0\n"
       " .NumberOfRelocations      dw  0\n"
       " .NumberOfLinenumbers      dw  0\n"
       " .Characteristics          dd  BCHARACTERISTICS\n"
       "%endif\n"
       "\n"
       "\n"
       "%imacro end 0\n"
       "   align FILEAL, db 0\n"
       "   section .head\n"
       "   align FILEAL, db 0\n"
       "head_size_ equ $-$$\n"
       "head_vsize_  equ round_(head_size_)\n"
       "head_end_:\n"
       "\n"
       "\n"
       "   section .text\n"
       "   align 4, db 0\n"
       "text_size_ equ $-$$\n"
       "text_end_:\n"
       "\n"
       "\n"
       "   section .data\n"
       "data_size_ equ $-$$ + text_size_\n"
       "data_end_:\n"
       "\n"
       "\n"
       "   section .bss\n"
       "   alignb  SECTION\n"
       "bss_vsize_ equ $-$$\n"
       "bss_end_:\n"
       "\n"
       "\n"
       "data_vsize_  equ round_(text_size_ + data_size_) + bss_vsize_\n"
       "vsize_   equ head_vsize_ + data_vsize_\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%macro library 2\n"
       "    dd   0\n"
       "           dd   0\n"
       "           dd   -1\n"
       "    rva  %1\n"
       "           rva  %2\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%define endlibrary times 5 dd 0\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%macro  api_import 3\n"
       " %1 rva %2\n"
       "    %if  %3=1\n"
       "   dw   0\n"
       "    %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro MOD_ 2-4\n"
       "  %rep %0/2\n"
       "    ModuleNames %1, %2\n"
       "    %rotate 2\n"
       "  %endrep\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro ModuleNames 2\n"
       " %1_i DB %2, 0\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%macro IAT 0\n"
       " raw_code_end:\n"
       " align 20h, DB 0\n"
       " code_end:\n"
       " BEGIN_IMPORT ntoskrnl.exe\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro END_IAT 0\n"
       " dd 0\n"
       "end_raw_iat:\n"
       "align 4, DB 0\n"
       "%ifdef RDATA__\n"
       "align 20h, DB 0\n"
       "%endif\n"
       "end_iat:\n"
       "%undef RDATA__\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%macro MODULES 0\n"
       " %ifnctx module\n"
       "  ALIGN 16, DB 0\n"
       "  %push module\n"
       "  import:\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro LIB 2\n"
       " %ifnctx lib\n"
       "  %assign %$z_ 0\n"
       "  %push lib\n"
       " %endif\n"
       " %define fi_%$z_ %1\n"
       " %define gi_%$z_ %2\n"
       " %assign %$z_ %$z_+1\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro LIBS___ 2-*\n"
       "MODULES\n"
       " %rep  %0/2\n"
       "   LIB %1, %2\n"
       "   %rotate 2\n"
       " %endrep\n"
       "ENDM\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro ENDM 0\n"
       " %ifctx lib\n"
       "  %define LIB__\n"
       "  %assign %$y_ 0\n"
       "  %rep %$z_\n"
       "     LIBRARY fi_%$y_\n"
       "     %assign %$y_ %$y_+1\n"
       "  %endrep\n"
       "     times 5 DD 0\n"
       "     end_import_desc:\n"
       "  %assign %$y_ 0\n"
       "  %rep %$z_\n"
       "     MOD_ fi_%$y_, gi_%$y_\n"
       "     %assign %$y_ %$y_+1\n"
       "  %endrep\n"
       "  %pop\n"
       " %else\n"
       "\n"
       " %endif\n"
       " END_MOD\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro LIBRARY 1-2\n"
       " %ifdef LIB__\n"
       "   %ifctx lib\n"
       "     IMPDESCRIPTOR %1\n"
       "     %if %0=2\n"
       "       times 5 DD 0\n"
       "       end_import_desc:\n"
       "     %endif\n"
       "   %endif\n"
       " %else\n"
       "   %ifctx module\n"
       "     IMPDESCRIPTOR %1\n"
       "     %if %0=2\n"
       "       times 5 DD 0\n"
       "       end_import_desc:\n"
       "     %endif\n"
       "   %endif\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro LIBRARIES 2-3\n"
       " %ifdef LIB__\n"
       " %ifctx lib\n"
       "    %rep 2\n"
       "     IMPDESCRIPTOR %1\n"
       "     %rotate 1\n"
       "    %endrep\n"
       "    %if %0=3\n"
       "     times 5 DD 0\n"
       "    %endif\n"
       "   %rotate 1\n"
       " %endif\n"
       " %else\n"
       " %ifctx module\n"
       "    %rep 2\n"
       "     IMPDESCRIPTOR %1\n"
       "     %rotate 1\n"
       "    %endrep\n"
       "    %if %0=3\n"
       "     times 5 DD 0\n"
       "    %endif\n"
       "   %rotate 1\n"
       " %endif\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro IMPDESCRIPTOR 1\n"
       "  %ifdef DRV__\n"
       "   dd   %1_c\n"
       "  %else\n"
       "   dd   0\n"
       "  %endif\n"
       "   dd   0\n"
       "   dd   0\n"
       "   rva  %1_i\n"
       "   rva  %1\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro END_MOD 0\n"
       " %ifdef LIB__\n"
       "   %undef LIB__\n"
       " %endif\n"
       " %ifdef DRV__\n"
       "   ALIGN 4, DB 0\n"
       "   end_raw_init:\n"
       " %endif\n"
       " %ifctx module\n"
       "   %pop\n"
       " %else\n"
       "\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "\n"
       "%macro BEGIN_IMPORT 1\n"
       " %ifdef DRV__\n"
       "   iat___:\n"
       " %endif\n"
       " %push import\n"
       "    %1:\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro FUNCTION 3\n"
       " %ifnctx fun\n"
       "  %assign %$z_ 0\n"
       "  %push fun\n"
       " %endif\n"
       " %define ai_%$z_ %1\n"
       " %define bi_%$z_ %2\n"
       " %assign ci_%$z_ %3\n"
       " %assign %$z_ %$z_+1\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro ENDI 0\n"
       " %ifctx fun\n"
       "  %assign %$y_ 0\n"
       "  %rep %$z_\n"
       "   api___ ai_%$y_\n"
       "   %assign %$y_ %$y_+1\n"
       "  %endrep\n"
       "  %assign %$y_ 0\n"
       "  %rep %$z_\n"
       "   IMPORT_ ai_%$y_, bi_%$y_, ci_%$y_\n"
       "   %assign %$y_ %$y_+1\n"
       "  %endrep\n"
       "  %pop\n"
       " %endif\n"
       "END_IMPORT\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro  api___ 1-*\n"
       "%ifctx import\n"
       "  %rep %0\n"
       " %ifdef NORMAL\n"
       "   %1_oo: rva %1_k\n"
       "   %1 equ %1_oo+reloc\n"
       " %else\n"
       "         %1: rva %1_k\n"
       " %endif\n"
       "     %rotate 1\n"
       "  %endrep\n"
       "%endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro iat 3\n"
       " %1_k  DW  %3\n"
       "   DB  %2, 0\n"
       "   ALIGN   2, DB 0\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro hints 1-*\n"
       "  %rep %0\n"
       "    rva %1_k\n"
       "    %rotate 1\n"
       "  %endrep\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro api_ord__ 2-*\n"
       "%ifctx import\n"
       "  %rep %0/2\n"
       "    %1:  dd %2+80000000h\n"
       "    %rotate 2\n"
       "  %endrep\n"
       "%endif\n"
       "%ifndef ORD__\n"
       "  %define ORD__\n"
       "%endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro IMPORT_ 3-*\n"
       "   %ifndef endi\n"
       "     DW 0\n"
       "     %define endi\n"
       "   %endif\n"
       "  %rep %0/3\n"
       "    iat %1, %2, %3\n"
       "    %rotate 3\n"
       "  %endrep\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro IMPORT___ 4-*\n"
       "  BEGIN_IMPORT %1\n"
       "  %rotate 1\n"
       "  %assign %%a %0\n"
       "  %assign %%a (%%a-1)/3\n"
       "  %rep %%a\n"
       " api___ %1\n"
       " %if %0 > 4\n"
       "   %rotate 3\n"
       " %endif\n"
       "  %endrep\n"
       "  %if %0 > 4\n"
       "   %rotate 1\n"
       "  %endif\n"
       "  %rep %%a\n"
       " IMPORT_ %1, %2, %3\n"
       " %if %0 > 4\n"
       "   %rotate 3\n"
       " %endif\n"
       "  %endrep\n"
       "  END_IMPORT\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro END_IMPORT 0\n"
       " %ifdef endi\n"
       "  %undef endi\n"
       " %endif\n"
       " %ifdef ORD__\n"
       "   %undef ORD_\n"
       "   DD 0\n"
       " %endif\n"
       " %ifctx import\n"
       "  %pop\n"
       " %endif\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%define BEGIN_IMPORT__ section .text\n"
       "\n"
       "%macro END_IMPORT__ 0\n"
       " end_import_:\n"
       " %define import_size end_import_ - import\n"
       " SECT____\n"
       "%endmacro\n"
       "\n"
       "\n"
       "\n"
       "%macro IMPORT_END 0-*\n"
       "end_import_:\n"
       "%define  import_size end_import_ - import\n"
       "end\n"
       "%endmacro\n"
       "\n"
       "%define IMPORT_BEGIN section .text\n"
       "\n"
       "%define LAST_BEGIN     section .text\n"
       "%define LAST_END       IMPORT_END\n"
       "\n"
       "%macro exit 1\n"
       "wcall  ExitProcess, %1\n"
       "%endmacro\n";

#include "asm_prologue.h"

/***************************************************************************/

/* Win32 specific syscalls */

_lib << "print:\n"
        "  %define STD_OUTPUT_HANDLE -11\n"
        "  %define string ebp+8\n"
        "\n"
        "    %define handle  ebp-4\n"
        "    %define length  ebp-8    \n"
        "    begin 8\n"
        " wcall GetStdHandle, STD_OUTPUT_HANDLE\n"
        " mov   [handle], eax\n"
        "\n"
        " addarg dword [string]\n"
        "    call strlen\n"
        "    clargs 1\n"
        "    mov [length], eax\n"
        "\n"
        "    wcall WriteConsoleA, [handle], [string], [length], 0, 0\n"
        "\n"
        "    return\n"
        "    %undef STD_OUTPUT_HANDLE\n"
        "    %undef string\n"
        "    %undef handle\n"
        "    %undef length\n"
        "\n"
        "readline:\n"
        "    %define STD_INPUT_HANDLE -10\n"
        " \n"
        "    %define buffer   ebp+12\n"
        "    %define size     ebp+8\n"
        "\n"
        "    %define handle ebp-4\n"
        "    %define read ebp-8\n"
        "    begin 4\n"
        "\n"
        "    wcall GetStdHandle, STD_INPUT_HANDLE\n"
        "    mov [handle], eax    \n"
        "\n"
        "    lea eax, [handle]\n"
        "    lea ebx, [buffer]\n"
        "    lea ecx, [size]\n"
        "    lea edx, [read]\n"
        "\n"
        "    wcall ReadConsoleA, [eax], [ebx], [ecx], edx, 0\n"
        "\n"
        "    return\n"
        "    %undef STD_INPUT_HANDLE\n"
        "    %undef buffer\n"
        "    %undef size\n"
        "    %undef handle\n"
        "    %undef read\n";

/* Generic lib */

#include "asm_lib.h"

/* Win32 specific footer */

_lib << "\n"
        "LAST_BEGIN\n"
        "\n"
        "LIBS___         kernel32,  \"kernel32.dll\"\n"
        "\n"
        "IMPORT___       kernel32, \\\n"
        "       GetStdHandle, \"GetStdHandle\",0, \\\n"
        "       WriteConsoleA, \"WriteConsoleA\", 0, \\\n"
        "       ExitProcess, \"ExitProcess\", 0, \\\n"
        "       ReadConsoleA , \"ReadConsoleA\",0\n"
        "       \n"
        "LAST_END\n";
