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.

Filter by
Sorted by
Tagged with
56 votes
2 answers
42k views

MASM/NASM Differences

What are the syntax differences between the NASM and MASM assemblers?
joek1975's user avatar
  • 3,573
37 votes
1 answer
33k views

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? ...
user997112's user avatar
  • 29.1k
28 votes
3 answers
49k views

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's user avatar
  • 906
27 votes
1 answer
27k views

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 ...
user3864147's user avatar
24 votes
4 answers
22k views

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: (...
claws's user avatar
  • 52.3k
23 votes
6 answers
113k views

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 ...
Without Me It Just Aweso's user avatar
18 votes
3 answers
20k views

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's user avatar
  • 345
18 votes
2 answers
31k views

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 ...
George2's user avatar
  • 44.8k
16 votes
1 answer
31k views

Multiple line comments in MASM assembly

Is there a way to comment multiple lines in assembly? I am using Masm32 v9.
nunos's user avatar
  • 20.5k
15 votes
7 answers
20k views

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.
user avatar
15 votes
2 answers
31k views

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 ...
Sakil Mallick's user avatar
14 votes
2 answers
1k views

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 ...
gordon sung's user avatar
13 votes
2 answers
11k views

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 ...
user1365914's user avatar
13 votes
3 answers
14k views

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 ...
user1483597's user avatar
13 votes
1 answer
676 views

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 ...
M. Laing's user avatar
  • 1,607
12 votes
2 answers
23k views

Referencing the contents of a memory location. (x86 addressing modes)

I have a memory location that contains a character that I want to compare with another character (and it's not at the top of the stack so I can't just pop it). How do I reference the contents of a ...
DrakeJacks's user avatar
12 votes
2 answers
11k views

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 : ...
Jumbo's user avatar
  • 533
12 votes
1 answer
4k views

Confusing brackets in MASM32

I am trying to get to grips with MASM32 and am confused by the following: I thought that brackets were used for indirection so if I have the a pre-defined variable .data item dd 42 then mov ...
Penguino's user avatar
  • 2,136
12 votes
1 answer
10k views

NASM is pure assembly, but MASM is high level Assembly? [closed]

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 ...
questions's user avatar
  • 2,337
11 votes
3 answers
19k views

masm division overflow

I'm trying divide two numbers in assembly. I'm working out of the Irvine assembly for intel computers book and I can't make division work for the life of me. Here's my code .code main PROC call ...
Help I'm in college's user avatar
11 votes
5 answers
16k views

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....
Cam's user avatar
  • 15k
10 votes
3 answers
42k views

JMP to absolute address (op codes)

I'm trying to code a exe packer/protector as a way of learning more about assembler, c++, and how PE files work. I've currently got it working so the section containing the EP is XORed with a key and ...
Christopher Tarquini's user avatar
10 votes
2 answers
16k views

Difference between `bx` and `bp`?

What is the difference between bx and bp in assembly? Example here: mov bx, 1h mov bp, 1h Do they reference to the same memory? Is it the same with ss and sp?
tina nyaa's user avatar
  • 991
10 votes
1 answer
6k views

Assembly programming - WinAsm vs Visual Studio 2017

I'm here to ask you some stuff about VS2017. In the past I had used WinAsm for MASM and I never got problems with it. However, when I'm trying to do something with MASM in VS2017, I always gonna get ...
Gregan Dark's user avatar
10 votes
1 answer
9k views

x86 assembly equ vs =

I am taking a class in x86 assembly language and it's starting to move rather fast. There is one thing that the book keeps doing without mentioning how it works, and that is using the equ and = ...
Backwardsman's user avatar
10 votes
2 answers
542 views

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, ...
Rick's user avatar
  • 103
10 votes
3 answers
32k views

Outputting Hello World in MASM using WIN32 Functions

Contents Intro Code Assembling and Running Miscellaneous Question 1. Intro This isn't a question per se (though there is one at the bottom) but a HelloWorld app for people on StackOverflow to ...
Zimm3r's user avatar
  • 3,369
10 votes
2 answers
2k views

Why doesn't MS-DOS initialize the DS and ES registers?

Why does the initialization of the DS and ES registers has to be done manually by the programmer? For example: MOV AX, DTSEG MOV DS, AX On the other hand, the CS and SS registers are initialized ...
mohammad mahed's user avatar
9 votes
3 answers
5k views

Assembly language for Reverse Engineering [closed]

What should I choose NASM or MASM for learning assembly. I want to learn assembly, motivation being Reverse Engineering. So that when I disassemble some executable, I can understand the code by ...
questions's user avatar
  • 2,337
9 votes
3 answers
4k views

How are dw and dd different from db directives for strings?

Let's say I want to define a initialized variable string before running my assembly program (in section .data). The variable I chose to create is called Digits and it is a string that contains all the ...
Pichi Wuana's user avatar
9 votes
1 answer
543 views

Returning a __m128d from MASM procedure to a C caller

I am porting a function from inline assembly to MASM in Visual Studio 2013 and am having trouble getting a return value out of it. Here is the C caller and the assembly function prototype: extern "...
jaket's user avatar
  • 9,152
8 votes
2 answers
7k views

Quick, beginner MASM register question - DX:AX

I am currently studying for an exam I'll have on x86 assembly. I didn't have much luck googling for ":", too common of a punctuation mark :/ IDIV - Signed Integer Division Usage: IDIV ...
F. P.'s user avatar
  • 5,028
8 votes
3 answers
4k views

Detecting architecture at compile time from MASM/MASM64

How can I detect at compile time from an ASM source file if the target architecture is I386 or AMD64? I am using masm(ml.exe)/masm64(ml64.exe) to assemble file32.asm and file64.asm. It would be nice ...
botismarius's user avatar
  • 2,977
8 votes
8 answers
3k views

Taking an Assembly Course, Stuck in DOS!

I'm taking a course on Microprocessor Programming as part of my Electronic Engineering degree. Unfortunately, in the labs, we have to work in DOS using MASM. Now, I don't really find DOS a hindrance, ...
Saad's user avatar
  • 81
8 votes
3 answers
2k views

Assembly language - Stack machine

I am learning assembly language in my spare time to become a better developer. I understand the difference between stack-based machines and register-based machines at a conceptual level, but I am ...
w0051977's user avatar
  • 15.1k
8 votes
2 answers
6k views

__cdecl, __stdcall and __fastcall are all called the exact same way?

I am using Visual C++ 2010, and MASM as my x64-Assembler. This is my C++ code: // include directive #include "stdafx.h" // functions extern "C" int Asm(); extern "C" int (convention) sum(int x, int ...
Name's user avatar
  • 2,037
8 votes
2 answers
14k views

bt assembly instruction

I have quesetion about bt assembly instruction. I have excerpted part of book to provide context. Please see last example, bt Testme, bx. Why does that copy TestMe+8? Shouldn't it copy TestMe+65? ...
tina nyaa's user avatar
  • 991
8 votes
2 answers
2k views

Write a maximum of two instructions to clear, set and complement some bits in the AL register

You are required to write a maximum of two instructions in assembly to do the following: Clear bits 0 and 7 of register AL, i.e. make them 0 Set bits 3 and 4 of register AL, i.e. make them 1. ...
Nick's user avatar
  • 155
8 votes
2 answers
7k views

Why can't I change the value of a segment register? (MASM)

I decided to teach myself assembly language. I have realized that my program will not compile if I attempt to change the value of any segment register. Every article that I have found says that I ...
Ed S.'s user avatar
  • 123k
8 votes
3 answers
9k views

TSL instruction reference

I want to use "TSL" instruction in assembly , but it has no reference for understand .in some articles this instruction is introduced for mutual exclusion problem but it has no reference or complete ...
RF27's user avatar
  • 99
8 votes
1 answer
12k views

Move quadword between xmm and general-purpose register in ml64?

In a simple program written for Microsoft's x64 assembler, I want to move a 64-bit value between an SSE register (say xmm0) and a general-purpose register (say rcx), as in <Intel syntax in MASM>:...
0xbe5077ed's user avatar
  • 4,565
8 votes
2 answers
5k views

What is the difference between MASM.exe and ml.exe?

When i install masm assembler, it asked to install Microsoft visual c++ 2005 express edition. I installed it. Now i can find only "ml.exe". Where is masm.exe? Even i tried in cmd by typing masm.exe, ...
user3718000's user avatar
7 votes
3 answers
7k views

Call C standard library function from asm in Visual Studio

I have a problem with calling C function from asm project created in visual studio (Win10 x64, Visual Studio 2015). Project consist of one asm file: .586 .model flat, stdcall option casemap:none ...
Sunrise's user avatar
  • 1,311
7 votes
3 answers
8k views

Les instruction purpose?

What is purpose of les instruction in assembly? Why do we need to load es segment and a register? Book gives following example: les bx, p ; Load p into ES:BX mov es:[bx], al ; ...
tina nyaa's user avatar
  • 991
7 votes
3 answers
22k views

Assembly Language (x86): How to create a loop to calculate Fibonacci sequence

I am programming assembly language (x86) in MASM using Visual Studio 2013 Ultimate. I am trying to use an array to calculate a Fibonacci sequence for n elements using an array. In other words, I am ...
jshapy8's user avatar
  • 1,983
7 votes
2 answers
3k views

x86 register flag abbreviations

I'm currently studying assembly language. In Microsoft visual studio 2017, I wanted to check the current status of the register flags. I wanted to know what each register flag abbreviation stands ...
Thor's user avatar
  • 9,648
7 votes
2 answers
19k views

Assembly difference between TASM and MASM

I am learning TASM at University, but information regarding TASM on the web seems to be very limited. I have found more information on MASM. My question is, what is the different between MASM and ...
Wizard's user avatar
  • 11k
7 votes
2 answers
4k views

Injecting 64 Bit DLL using code cave

I'm trying to inject a 64 Bit DLL into 64 Bit Process (explorer for the matter). I've tried using Remote-thread\Window Hooks techniques but some Anti-Viruses detects my loader as a false positive. ...
Omer's user avatar
  • 661
7 votes
3 answers
24k views

How do I use a buffer in an assembly procedure?

So, I understand the general abstract concept of a buffer: it's an allocation in memory that holds data before it gets processed. I'm trying to complete a homework problem which requires me to write ...
santeyio's user avatar
7 votes
3 answers
7k views

Difference between masm32 and masm?

I am trying to learn assembly for windows and see that there are 2 assemblers: masm : https://www.microsoft.com/downloads/en/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 masm32 : http:...
Jumbo's user avatar
  • 533

1
2 3 4 5
53