Skip to content

Instantly share code, notes, and snippets.

@nguyendown
Last active October 1, 2019 09:01
Show Gist options
  • Save nguyendown/d28b866934a36509b5823b35aec3e916 to your computer and use it in GitHub Desktop.
Save nguyendown/d28b866934a36509b5823b35aec3e916 to your computer and use it in GitHub Desktop.

build systems

http://masm32.com/download.htm
http://www.masm32.com/download/install64.zip

---------------
bin64 directory
---------------
cvtres.exe
dumpbin.exe
editbin.exe
lib.exe
link.exe
link.exe.config
ml64.exe
msobj140.dll
mspdb140.dll
mspdbcmf.exe
mspdbcore.dll
mspdbsrv.exe
mspdbst.dll
mspft140.dll
msvcdis140.dll
msvcp140.dll
tbbmalloc.dll

-----------
In dir 1033
-----------
bscmakeui.dll
clui.dll
cvtresui.dll
linkui.dll
LocalESPCui.dll
mspdbcmfui.dll
mspft140ui.dll
pgort140ui.dll
pgoui.dll

masmbuild.bat

@echo off
%comspec% /K set PATH=C:\masm32\bin64;%PATH%

build and link

ml /coff a.asm /link /subsystem:console
ml64 a.asm /link /subsystem:console /entry:main

example

.386
.model flat, stdcall
option casemap :none

include \masm32\include\kernel32.inc
include \masm32\include\windows.inc
includelib \masm32\lib\kernel32.lib

.code
start:
    mov ebp, esp
    sub esp, 10h
    push STD_OUTPUT_HANDLE
    call GetStdHandle
    push 0a21h
    push 646c726fh
    push 57202c6fh
    push 6c6c6548h
    mov esi, esp
    push NULL
    lea edx, [ebp-4h]
    push edx
    push 14
    push esi
    push eax
    call WriteConsole
    push 0
    call ExitProcess
end start
include \masm32\include64\masm64rt.inc

.code
main proc
    mov rcx, STD_OUTPUT_HANDLE
    call GetStdHandle
    mov rcx, rax
    push 41414141h
    mov rdx, rsp
    mov r8, 4
    mov r9, 0
    push 0
    call WriteConsole
    mov rcx, 0
    call ExitProcess
main endp
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment