This is an Oxygen-independent program - the bare bones without a proper run time library. It has the minimal set of API calls to make it usable.
This program cannot be run directly - it has to be compiled first. The EXE file size is 3.5k.
You can use it for simple Asm with stack-based memory. There is no built in code for memory management or "bind" function.
Charles
#file "t.exe" independent
'------
'PROLOG
'======
push ebx : push esi : push edi : push ebp
mov ebp,esp
sub esp,256
'--------------------------------------------------------------
'MOVE BOOTSTRAP PROCEDURE POINTERS TO RUNTIME LIBRARY POSITIONS
'==============================================================
'
'GET ABSOLUTE ADDRESSES
'
call fwd here
.here
pop eax
sub eax,here
mov ebx,eax : add ebx,bssdata
mov edi,eax : add edi,import_address_table
'
'--------------------------------
'COPY BOOTSTRAP LIBRARY ADDRESSES
'================================
'
mov eax,[edi+00] : mov [ebx+024],eax 'LoadLibrary
mov eax,[edi+04] : mov [ebx+040],eax 'GetProcAddress
mov eax,[edi+08] : mov [ebx+032],eax 'FreeLibrary
mov eax,[edi+12] : mov [ebx+440],eax 'GetModuleHandle
mov eax,[edi+16] : mov [ebx+448],eax 'GetGetCommandLine
mov eax,[edi+20] : mov [ebx+456],eax 'GetExitProcess
mov eax,[edi+24] : mov [ebx+464],eax 'ExitProcess
mov eax,[edi+28] : mov [ebx+480],eax 'CreateFileA
mov eax,[edi+32] : mov [ebx+488],eax 'Readfile
mov eax,[edi+36] : mov [ebx+496],eax 'CloseHandle
mov eax,[edi+44] : mov [ebx+472],eax 'MessageBoxA
'=============
jmp fwd endlib
'=============
'-----------
TestMessage:
'===========
push 0
"title"
push eax
"message"
push eax
push 0
call [ebx+472]
ret
'------------------
DisplayCommandLine:
'==================
push 0
"COMMAND LINE"
push eax
call [ebx+448]
push eax
push 0
call [ebx+472]
ret
'-------
Message:
'=======
pop edi
call [ebx+472]
push edi
ret 16
'======
endlib:
'======
'-----
'TESTS
'=====
'call TestMessage
'call DisplayCommandLine
call Message 0,"message","title",1
'------
'EPILOG
'======
endprog:
mov esp,ebp : pop ebp : pop edi : pop esi : pop ebx
ret