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:

2604 questions
56
votes
2 answers

MASM/NASM Differences

What are the syntax differences between the NASM and MASM assemblers?
joek1975
  • 3,573
  • 5
  • 40
  • 44
37
votes
1 answer

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
  • 29,025
  • 43
  • 182
  • 361
28
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
  • 906
  • 2
  • 10
  • 26
27
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
  • 285
  • 1
  • 3
  • 9
24
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
  • 52,236
  • 58
  • 146
  • 195
23
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
  • 4,593
  • 10
  • 35
  • 53
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
  • 44,761
  • 110
  • 317
  • 455
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
  • 345
  • 1
  • 5
  • 15
16
votes
1 answer

Multiple line comments in MASM assembly

Is there a way to comment multiple lines in assembly? I am using Masm32 v9.
nunos
  • 20,479
  • 50
  • 119
  • 154
15
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
14
votes
2 answers

What is meaning of .model small in 8086 programs?

I am a beginner in 8086 assembly language. I can understand the logic used in the program and write small programs myself. But I just want to know what this does: .model small .stack 300h What is explanation for .model small? I am using masm.
Sakil Mallick
  • 177
  • 1
  • 1
  • 9
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
  • 605
  • 2
  • 8
  • 27
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,607
  • 11
  • 25
13
votes
3 answers

Making assembly function inline in x64 Visual Studio

I know that MSVC compiler in x64 mode does not support inline assembly snippets of code, and in order to use assembly code you have to define your function in some external my_asm_funcs.asm file like that: my_asm_func PROC mov rax, rcx …
user1483597
  • 540
  • 2
  • 4
  • 20
13
votes
2 answers

Assembly Segments in opcodes

I noticed that in Assembly segments are used in opcodes. Example: MOV DWORD PTR SS:[EBP-30],30 I think that "PTR SS:" is used to specify that EBP-30 comes from the stack? (SS: stack segment) Am I right or am I completely wrong? :) And, could you…
user1365914
  • 858
  • 2
  • 18
  • 32
1
2 3
99 100