Questions tagged [masm]

MASM is Microsoft's Macro Assembler tool for converting assembly language to object code. It processes x86 instructions and pseudo instructions written in "Intel syntax". MASM is the standard low-level language for all MSDOS and Windows environments and is currently being supported in the 32-bit and 64-bit versions.

This tag is for questions related specifically to MASM. General questions about assembly language should be tagged or . Questions specifically about the CPU should be tagged and/or . Further, questions about the SDK and IDE should also be tagged accordingly. Other competing assemblers include and : Check the documentation of the respective softwares to verify the degree of compatibility with MASM specific source code.

MASM has been available since MSDOS 1.0 in 1981 and was a separate product until about 1999; since then it has been packaged with other tools, primarily Visual Studio. While the most current version is no longer available for download, it is provided with Visual C++ and accessible via the command line.

MASM contains a powerful macro capability, a preprocessor with access to program symbols and can string manipulation, conditional assembly, and some C-like syntax (if...elseif...else...endif, while..endw, and repeat..until). Other features include variable typing, type casting and argument type checking.

Much of the difficulty of using MASM is related to the complexity and non-orthogonality of Intel's CPU architecture. Because of advances in processor technology, the assembly language has similarly expanded and advanced, though sometimes haphazardly. For example, the LOOP and REP instructions are implicitly only able to use the register CX (or ECX in 32-bit mode), owed to the design of the instruction set.

Expect extensive pre-planning and graduate level research to be required for usage of MASM to be fruitful.

Resources:

2258 questions
42
votes
2 answers

MASM/NASM Differences

What are the syntax differences between the NASM and MASM assemblers?
joek1975
  • 3,303
  • 5
  • 36
  • 44
32
votes
2 answers

ASM: MASM, NASM, FASM?

I have done ARM assembly programming and I would like to learn the Intel Assembler. I keep hearing all these different F/M/N/ASMs mentioned- but I am unsure how they related to what I wish to achieve? Could somebody please help me identify what I…
user997112
  • 25,084
  • 34
  • 143
  • 278
25
votes
3 answers

x86, difference between BYTE and BYTE PTR

What is the difference between these two lines? What PTR changes here? ;first mov BYTE [ecx], 0 ;second mov BYTE PTR [ecx], 0
Linkas
  • 826
  • 2
  • 9
  • 24
23
votes
1 answer

external assembly file in visual studio

I searched and found I can not use __asm in x64 in visual studio. Instead I have to use an external assembly file. How can I add external assembly file to my win32 console project? How can compile them? Can you explain step by step.
user3864147
  • 245
  • 1
  • 2
  • 9
21
votes
4 answers

MOV src, dest (or) MOV dest, src?

MOV is probably the first instruction everyone learns while learning ASM. Just now I encountered a book Assembly Language Programming in GNU/Linux for IA32 Architectures By Rajat Moona which says: (broken link removed) But I learnt that it is MOV…
claws
  • 47,010
  • 55
  • 140
  • 185
19
votes
6 answers

What does OFFSET in 16 bit assembly code mean?

I am going through some example assembly code for 16-bit real mode. I've come across the lines: mov bx, cs mov ds, bx mov si, OFFSET value1 pop es mov di, OFFSET value2 what is this doing? What does having…
Without Me It Just Aweso
  • 3,745
  • 10
  • 30
  • 52
18
votes
2 answers

dword ptr usage confusion

In assembly language if we use mov eax, dword ptr[ebx] then it means copy the value pointed by ebx (ebx contains the address value, not the actual value, this instruction copies the actual value in the address)? If we use mov eax, dword…
George2
  • 42,353
  • 103
  • 307
  • 447
18
votes
3 answers

Difference between lea and offset

ar db "Defference $" What's the difference between mov dx,offset ar and lea dx,ar I think both are doing same work, but what is the difference between these two
userBI
  • 347
  • 1
  • 5
  • 15
14
votes
2 answers

Floating Point Program gives Invalid Result

RECENT EDIT I am trying to run this floating point Quadratic Equation program on x86 MASM. This code is found in the Kip Irvine x86 textbook and I want to see how it works visually. The following code is below: include irvine32.inc .DATA a REAL4…
gordon sung
  • 545
  • 1
  • 6
  • 24
14
votes
7 answers

MASM under Linux?

Is there a way that I use MASM under Linux. Even tough NASM is quite popular under Linux, it still differs for some instruction style on code.
None
13
votes
1 answer

MASM Fixing 64 bit Truncation in a DLL

I am working with the Adobe Flash ocx by loading it into my C++ program. The ocx is supposed to be 64 bit but for some reason it has issues when I compile with the x64 platform. I have read up on this and found that it is likely that some function…
M. Laing
  • 1,567
  • 10
  • 24
12
votes
2 answers

error LNK2001: unresolved external symbol _MessageBox

I am trying to create a helloworld program using only masm and not masm32 libs. Here is the code snippet: .386 .model flat, stdcall option casemap :none extrn MessageBox : PROC extrn ExitProcess : PROC .data HelloWorld db "Hello There!",…
Jumbo
  • 513
  • 3
  • 8
  • 14
11
votes
1 answer

NASM is pure assembly, but MASM is high level Assembly?

I'm learning assembly, motivation being able to reverse engineer. I'm trying to find the assembler I should begin with, so that I can then find tutorials and start writing some assembly. I came to know that MASM has a lot of built in constructs, so…
questions
  • 2,197
  • 4
  • 21
  • 37
11
votes
5 answers

Force visual studio to always 'rebuild all' when debugging

Edit: Basically what I need is for visual studio to always rebuild all when I hit debug. I'm currently using visual studio to compile my assembly programs, using MASM and in general it's working fine. However I've run into an annoying issue: If I…
Cam
  • 13,963
  • 16
  • 70
  • 121
10
votes
2 answers

Infected compiler, or malfunction?

I've encountered something very strange, and things just don't add up. First of all, I posted this here because I'm not sure if this has anything to do with computer virusses at all. And if it does, could you please direct me to a place to find…
Rick
  • 103
  • 4
1
2 3
99 100