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
0
votes
1 answer

Error "Access violation reading location"

I used vs 2015 to write x64 masm program. ExitProcess PROTO MessageBoxA PROTO .data text db "Winter hat", 0Ah, "Upon my head - ", 0Ah, "My head stays warm,", 0Ah, "But my nose is red!;", 0 header db "Task1", 0 .code main proc xor rcx,…
0
votes
0 answers

How to call an enum in an asm file?

I am working on an assignment for class and I have one last part of the assignment before I am done. I am given a C++ file that I am not allowed to edit, and I am writing the .asm for it. My last snag in the project is that: 1. My _Divide function…
Arcadiaen
  • 33
  • 5
0
votes
0 answers

MASM - Read multiple integer data using invoke crt_scanf

I am trying to create an array to store 10 dword integers. To allow users to type in their own integers, I use jumps to implement it. .386 .model flat, stdcall option casemap:none include windows.inc include kernel32.inc include user32.inc include…
Brian Tsui
  • 21
  • 2
0
votes
1 answer

Disabling desktop composition causes flickering on Tab Control

When i disable desktop composition i get flickering/blinking whenever i hover the mouse over the tabs. This only happens when desktop composition is disabled. I have tried to cancel WM_ERASEBKGND message but it doesn't fix the problem. What is the…
a man in love
  • 247
  • 1
  • 5
  • 14
0
votes
0 answers

MASM32 Direct Addressing - A2070 Invalid Instruction Operands

I am new to MASM coding. I found that it is really difficult to handle with registers, due to lack of knowledge in built-in functions. I am trying to write a program to change all letters in input string to CAPITAL letters. Here is my…
Brian Tsui
  • 21
  • 2
0
votes
0 answers

Assembly Language- Exception Thrown error

I just started taking a class in assembly language and we had our first project in class and I just can't seem to understand what is wrong with this code. I have tried everything from the book but to no avail include…
Sam_T
  • 45
  • 1
  • 11
0
votes
1 answer

(MASM) - How important is restoring the stack

I've been learning assembly recently, starting to move into some of the more complex instructions for doing things. I understand how the stack works and the size of it but how important is restoring? Lets say we call a function that takes a 4 byte…
0
votes
1 answer

MASM doesn't recognize my TLS callback

I have produced an assembler listing of my .C source file. And in the C source i have implemented tls like this: char *msg = "callback"; void NTAPI tls_callback(PVOID DllHandle, DWORD dwReason, PVOID lpVd) { MessageBoxA(0,msg,msg,0); } #ifdef…
0
votes
2 answers

Definition of TYPE?

INCLUDE Irvine32.inc .data array DWORD 10,20,30,40,50 sum DWORD 0 .code main PROC mov EDI,offset array mov ECX,5 mov EAX,0 HERE: add eax,[edi] add edi,TYPE array dec ecx jnz HERE mov sum,eax exit main ENDP END main What does TYPE mean inside…
0
votes
0 answers

Assembly integer overflow

On executing div command, it gives an error: integer overflow. first I want to know how this is integer overflow, then obviously how to correct it? Thank you in advance. TITLE My First Program (Test.asm) INCLUDE Irvine32.inc .data cr1grade WORD…
kestrel
  • 120
  • 12
0
votes
1 answer

Resolving undefined symbols externally

Beginner level in Assembly. The error I receive in Visual Studio is: 1>File2.asm(27): error A2006: undefined symbol : sprintf 1>File2.asm(28): error A2006: undefined symbol : MessageBoxA File 1 is what handles calculations File 2 is what prints…
Chris
  • 97
  • 1
  • 8
0
votes
1 answer

How do I use an external EQU in an expression in MASM 5.10

I'm trying to split a very large .ASM file into several external libraries leaving only my main program in main.asm. This is a game, so I was hoping to split my keyboard input code into input.asm, and my Adlib sound card code into music.asm…
0
votes
1 answer

(fldcw [sp]) Control Word issue in assembly code

I am fairly new to assembly & it is my first programming language. I have a question about this line:fldcw [sp]. It causes a build error: error A2031: must be index or base register I am aware that: sp is the 16 bit stack pointer esp is the 32 bit…
Chris
  • 97
  • 1
  • 8
0
votes
0 answers

Instruction ANDN in MASM throws EXCEPTION_ILLEGAL_INSTRUCTION

I am learning x86-64 assembly. Now, I am trying to use ANDN (AND NOT) instruction in MASM 64-bit (ML64.exe) to see in debugger how it works. My code is: extrn ExitProcess : proc .data .code Main proc mov ebx, 01h mov ecx, 01h …
Dave
  • 153
  • 2
  • 11
0
votes
3 answers

Irvine32 and MASM

I would like some help in adding Irvine32 inc/lib support to my asm programs. I added the inc/lib to their folders and added include Irvine32.inc includeLib Irvine32.lib But I get errors when linking with Irvine32.lib. Is there is a place where I…
cria
  • 195
  • 1
  • 4
  • 12
1 2 3
99
100