MASM64 is a 64-bit version of the MASM32 software development environment (SDK) for programmers using Microsoft's Assembler (MASM) to target 64-bit Windows. DO NOT USE THIS TAG FOR REGULAR 64-BIT ASSEMBLY PROGRAMMING (instead use [x86-64] and [assembly]).
Questions tagged [masm64]
60 questions
0
votes
1 answer
How to compute the sum of the odd numbers from the Fibonacci numbers between zero to 1x10^6
I am having trouble creating a x64 masm program that computes the result of the sum of the odd values. The answer is in RAX as 109E82h (1089154d). I am having difficulty trying to figure out how masm works, but it is so confusing. This is what I…

denisse galvan
- 11
- 1
0
votes
1 answer
The difference between .lib and .dll + .def
I have some questions about dynamic and static libraries.
I know that a dll is a dynamic library whose image is loaded into memory and all processes can call functions and use them. And .lib is just an archive of object files, is this really the…

mantissa
- 132
- 7
0
votes
0 answers
SSE loop over array gets the wrong value (dot product of two arrays of doubles)
I have problem with my assembly code: I need to multiply two arrays, then add up the result and get a square root out of it. I've did the code and looks like it works fine, but I need to receive 9.16, but instead I'm getting 9.0.
I guess problem…

hyen
- 11
- 1
0
votes
0 answers
'printf' function and 'proc' directive behaving weird in ml64(masm x64)?
;this file -> test1.asm
includelib msvcrt.lib
includelib legacy_stdio_definitions.lib
extern _CRT_INIT: proc ;custom entrypoint needs c-runtime to be initialised by the programmer.
extern printf: proc
extern ExitProcess: proc
.data
msg db…

Aniket Bose
- 1
- 2
0
votes
1 answer
How to set an exception using masm64?
How can i access the exception chain (SEH) using masm64?
Using masm32, I get the first exception looking into fs:[0]
But when I checked in Windbg if fs:[0] still pointed at the first exception in x64, I figured that it wasn't.
I'd like to set an…

ginko
- 47
- 5
0
votes
0 answers
CreateFileA, CreateFileW don't work in masm64 (Russian Variant)
I'm using a Russian variant of the MASM64 SDK that can be found here. My code is:
OPTION DOTNAME
option casemap:none
include G:\Programs\Soft\Coding\MASM\masm64\Include\win64.inc
include…

OSPFv3
- 33
- 5
0
votes
1 answer
In MASM can you do this PUSH 0xFFFF0820CADBA78D
I'm building a KMDF device driver (64 bit) project with assembly code which is located in a separate .ASM file. I'm using the MASM (ml64.exe) compiler integrated within Visual Studio 2019 Community to build the .ASM into an object file and linked to…

JbG
- 57
- 7
0
votes
1 answer
How to import a Unsigned Long (ULONG64) into x64 ASM File in Visual Studio 2019
OK so I'm using Visual Studio Community 2019 with MASM enabled and I'm trying to declare a variable in my ASM file that is defined outside of the .ASM file but in the same project. How can I do this ?
I've tried the following:
EXTERN…

user121309
- 1
- 4
0
votes
1 answer
Calling printf or puts from MASM64 assembly does nothing, but calling WriteConsoleA works?
I am currently trying to learn assembly programming with MASM64. I have managed to get WriteConsoleA to work, but am stuck trying to use C functions like printf or puts. It should be noted that I am using ml64.exe and link.exe outside of Visual…

Mikolmisol
- 1
- 1
0
votes
1 answer
why procedure need stack frame or shadow stack?
(Sorry for my bad english, because i am from South Korea)
i tried this code
lea rcx, QWORD PTR [message]
call [print_message] ;it covered return address to bad address
xor rcx, rcx
ret
and crashed... after that happen, i tried another way
sub…

Guy Cool
- 3
- 3
0
votes
0 answers
Is there a way to do vector multiplication and horizontal sum (dot product) on signed 8-bit elements?
I have the following code in x64 Microsoft Macro Assembler (simplified example):
.DATA
First BYTE -4, -3, -2, -1, 0, 1, 2, 3
Second BYTE 1, 2, 3, 4, 5, 6, 7, 8
.CODE
MultiplyAndSum PROC
; move First and Second to vectors
; multiply corresponding…

assemblyhelp
- 1
- 1
0
votes
0 answers
CreateProcessA function fail on Access Violation in MASM64 (ml64.exe)
Very similar issue like CreateProcessA function doesn't work in MASM64 (ml64.exe) , but in my case I think its not case with alignment or pointer data types in 64x. So the code is
;ml64.exe CreateProcessA.asm /link /subsystem:console /entry:main…

Slava
- 13
- 1
- 3
0
votes
3 answers
In MASM64, is there an instruction for pushing a 16-bit immediate on the stack?
In MASM64, if I write the instruction push 0, it will push a 64-bit immediate on the stack (i.e. RSP = RSP - 8).
So if I just want to push a 16-bit immediate to set FLAGS, I have no idea but write the machine code, such as:
.code
FlagFunction PROC
…

Kozue Mukai
- 45
- 2
0
votes
0 answers
What is the problem with this code in x64? It doesn't return 0 in VS2019
The snippet below doesn't return 0 in VS2019 version 16.11.3. Why?
_text SEGMENT
;.486
;.model flat,stdcall
;.stack 4096
.code
main PROC
mov al, 0
add al, 5
ret
main ENDP
_text ENDS
END
The console window is shown below:

João Afonso
- 1,934
- 13
- 19
0
votes
0 answers
VS2019 Cannot open file .obj when compiling asm
While trying to setup Visual Studio 2019 to compile a .asm project, I am getting an error.
I created an empty c++ project and added a Main.asm file. I tried both MASM and NASM and get the same error:
LNK1104 cannot open file 'C:\Users\Serge…

Serge Fonville
- 304
- 2
- 4