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
0
votes
0 answers

Why can we MOV the address of a 64-bit value into a 32 bit register?

list QWORD 1234567812345678h .code main proc mov eax ,offset list Why 32 bit register accept the 64 bit. MOV is flexible in using operands, as long as the following rules are observed:  Both operands must be the same size. all register…
salem
  • 9
  • 3
0
votes
0 answers

How to modify a character in a string with null

I am making an assembly language program which takes as input a string and two indexes and removes the substring between these two indexes The approach I am using is to increment the offset to the last index and then print edx This will print second…
bittu
  • 67
  • 1
  • 6
0
votes
0 answers

Masm visual studio 2019. Taking users name and converting to Uppercase

I am writing an assembly code on visual studios that takes the input of a users name and is suppose to covert the name to upper case and display it. Could you please help me. Here is what I got so far. Unfortunately the assembly code must stay in 32…
0
votes
0 answers

Making a copy of a string in assembly

How do I copy two strings in assembly. I found that there is function called str_copy. But that seems to only available in irvine64 library. I want to achieve this in irvine32.inc Do I need to manually write a code to make copy of a string or there…
rohit sharma
  • 171
  • 1
  • 9
0
votes
0 answers

Procedure not getting called

In the following code if I comment the line call str_copy then the procedure compare_strings get's invoked. Otherwise It doesn't. I tried putting more WriteString statements to debug it. But nothing gets printed if call str_copy is there. what could…
bittu
  • 67
  • 1
  • 6
0
votes
1 answer

Creating an assembly code without any proc declaration

I am trying to define a simple empty file in assembly. But this throws errors Severity Code Description Project File Line Suppression State Error LNK2001 unresolved external symbol _mainCRTStartup Project1 …
rohit sharma
  • 171
  • 1
  • 9
0
votes
0 answers

x86 Assembly - Error A2022: instruction operands must be the same size

So, from my understanding DB can be used to create a string in x86 Assembly. I am trying to move my index pointer to be at the beginning of the string so I can iterate through it. I am getting this error, "instruction operands must be the same…
Suezzeus
  • 31
  • 4
0
votes
0 answers

Fetching integer and decimal part of a floating number in assembly

Given a floating point number like -102.123. How do I separate the integer part which is -102 and the decimal part which is 123. Is there some special instruction to do it or it needs to be done thru some manual methods ? My ultimate aim is to…
bittu
  • 67
  • 1
  • 6
0
votes
0 answers

Using stack in assembly program

I have to write a program which asks the user to enter a floating point number and pop the number from the stack into a variable and then push the variable onto the stack as a parameter to a function called twice I don't understand the part pop…
bittu
  • 67
  • 1
  • 6
0
votes
0 answers

Assembly int 13h ah=42h crashes

I have an x86 assembly code which calls a proc to read master boot record. STACKSEG SEGMENT PARA STACK 'stack' DW 512 DUP(?) STACKSEG ENDS DATASEG1 SEGMENT PARA 'data' mbr db 512 dup(?) DAP db 10h ;size of DAP z db 0 …
Pouria
  • 49
  • 8
0
votes
0 answers

Invalid use of register error when using inc with esi

I have the following assembly code : .data string_2 BYTE "Please enter the name of the file:",0 filename BYTE 80 DUP(0) fileHandle HANDLE ? byteCount DWORD ? ; holds counter buffer BYTE BUFFER_SIZE DUP(?) freq_array dw 256 dup(0) ;ARRAY OF…
bittu
  • 67
  • 1
  • 6
0
votes
0 answers

`call WriteString` causing multiply defined symbols error

I have the following assembly program which on build is giving the error- _IsDigit@0 already defined one or more multiply defined symbols defined INCLUDE Irvine32.inc .data string_2 BYTE "ABCDE",0 .code IsDigit PROC cmp al,'0' jb ID1 cmp…
nidhi
  • 37
  • 6
0
votes
0 answers

Register value not getting updated properly

I have written the following assembly language program to determine if the value in al is a digit INCLUDE Irvine32.inc .data randVal DWORD ? .code main PROC IsDigit PROC cmp al,'0' jb ID1 cmp al,'9' ja ID1 test ax,0 ID1: ret IsDigit ENDP mov…
nidhi
  • 37
  • 6
0
votes
0 answers

unmatched block nesting : main [ASM]

I searched up the error and it says that it does not have a matching end. I've been trying to fix it for quite awhile now, but I don't see what it means by it doesn't have a matching end when I just ended it at the end. INCLUDE…
hellokev
  • 1
  • 1
0
votes
1 answer

Fractions and percentages in MASM - Floating point?

I'm extremely new to assembly and I don't think my class has covered floating-point at all. Been searching for solutions for the past few days to display my answer correctly but it won't work. Here's the snippet of my code: marks1 DWORD ? …
1 2 3
99
100