Familiarization of Masm
Familiarization of Masm
The Microsoft Macro Assembler (MASM) is an x86 assembler that uses the Intel syntax
for MS-DOS and Microsoft Windows. Beginning with MASM 8.0, there are two versions
of the assembler: One for 16-bit & 32-bit assembly sources, and another (ML64) for 64-
bit sources only. MASM is maintained by Microsoft, but since version 6.12 it has not
been sold as a separate product. It is instead supplied with various Microsoft SDKs and
C compilers. Recent versions of MASM are included with Microsoft Visual Studio.
i. Take notepad
ii. Type an 8086 program
iii. Save the file as <filename>.asm and save in All files at 8086 folder
5. Run Assembly file (.asm) in Windows
6. Open DOSBox by clicking on it.
Enter the following command in DOSBox
Z:> mount c c:\8086
Copy your Assembly file to the “C:/8086” folder (remember the name)
Then execute the following to run that fileC:> masm your_file_here.asm
C:> link your_file_here.obj
C:> your_file_here.exe
9. To debug :
debug <filename>.exe
10. To quit
-q
8. <filename>.exe
9. To debug :
debug <filename>.exe
10. To quit
-q
INT 21H
Int 21h is a dos interrupt. It is one of the most commonly used interrupt while writing code in 8086
assembly language. To use the dos interrupt 21h load ah with the desired sub-function. load
other required parameters in other registers. and make a call to int 21h.
Some common int 21h functions:
Function
Description
Number
AH=01h READ CHARACTER FROM STANDARD INPUT, WITH ECHO
AH=02h WRITE CHARACTER TO STANDARD OUTPUT
AH=05h WRITE CHARACTER TO PRINTER
AH=06h DIRECT CONSOLE OUTPUT
AH=07h DIRECT CHARACTER INPUT, WITHOUT ECHO
AH=08h CHARACTER INPUT WITHOUT ECHO
AH=09h WRITE STRING TO STANDARD OUTPUT
AH=0Ah BUFFERED INPUT
AH=0Bh GET STDIN STATUS
AH=0Ch FLUSH BUFFER AND READ STANDARD INPUT
AH=0Dh DISK RESET
AH=0Eh SELECT DEFAULT DRIVE
AH=19h GET CURRENT DEFAULT DRIVE
AH=25h SET INTERRUPT VECTOR