SlideShare a Scribd company logo
1 of 16
MASM-Microsoft Macro
Assembler
• To download dosbox,use the following link
https://www.dosbox.com/download.php?main=1
• To download 8086 zip file use the following link
http://www.mediafire.com/file/mm7cjztce9efj4w/8
086.zip/file
Note: After downloading both, save into c drive
1. Install DosBox directly into your C Drive.
2. Extract files from ZIP folder, it will contains multiple
exe files. Place this folder into your C drive and rename
it to 8086( if its name is not 8086)
3. Run DosBox and write the following:
mount c c:8086
4. Create a file with .asm extension e.g. hello.asm using
notepad in 8086 folder.
Write a MASM program to display “Hello
World”
• data segment
• str db 0ah,0dh,"Hello World$"
• data ends
• code segment
• assume cs:code,ds:data
• start:
• mov ax,data
• mov ds,ax
• mov dx,offset str
• mov ah,09h
• int 21h
• mov ah,4ch
• int 21h
• code ends
• end start
To make your directories available as drives in DOSBox
by using the "mount" command
Command for assembling
Command for link
Command for execution
Write a MASM program to add two
numbers(nos initialized in the program itself)
data segment
opr1 dw 1234h
opr2 dw 0023h
result dw 01 dup(?)
data ends
code segment
start: mov ax, data
mov ds ,ax
mov ax, opr1
mov bx, opr2
clc
add ax,bx
• mov di, offset result
• mov [di],ax
• mov ah,4ch
• int 21h
code ends
end start
DOS function calls
• By calling INT 21h with a sub function
number in the AH processor register and other
parameters in other registers, various DOS
services can be invoked.
• These include handling keyboard input, video
output, disk file access, program execution,
memory allocation, and various other
activities.
Mov ah, 01h
int 21h (read char from std input device)
Mov ah, 02h
int 21h (Write char to std device)
LEA dx,str // ( str db oah,odh, “Hello$”)//
Mov ah, 09h
int 21h //(display string)//
LEA dx,str // ( str db 24h dup(?) )//
Mov ah, 0ah
int 21h // (Buffered str input)//
Mov ah, 4Ch
int 21h (Program to exit)
Syntax of MACRO
i) Defining a Macro
MACRO can be defined anywhere in a program using
derivatives MACRO and ENDM
Eg: display macro
mov dx,offset str
mov ah,09h
int 21h
endm
(for invoking this in program just write display)
• ii) Passing parameter to macro
display macro msg
mov dx,offset msg
mov ah,09h
int 21h
Endm
(for invoking it
Display opr1
Display opr2
Display result)

More Related Content

Similar to MASM.pptx

Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackironSource
 
Bootloader and MMU (english)
Bootloader and MMU (english)Bootloader and MMU (english)
Bootloader and MMU (english)Sneeker Yeh
 
BOOTABLE OPERATING SYSTEM
BOOTABLE OPERATING SYSTEMBOOTABLE OPERATING SYSTEM
BOOTABLE OPERATING SYSTEMShahzeb Pirzada
 
Mac Forensics
Mac ForensicsMac Forensics
Mac ForensicsCTIN
 
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsDumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsVishal Kumar
 
Lab 5 - String Manipulation usingTASM Environment-1.docx
Lab 5 - String Manipulation usingTASM Environment-1.docxLab 5 - String Manipulation usingTASM Environment-1.docx
Lab 5 - String Manipulation usingTASM Environment-1.docxCCSSenatorAbogadoAj
 
44 con slides
44 con slides44 con slides
44 con slidesgeeksec80
 
44 con slides (1)
44 con slides (1)44 con slides (1)
44 con slides (1)geeksec80
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
 
Lec 47.48 - stream-files
Lec 47.48 - stream-filesLec 47.48 - stream-files
Lec 47.48 - stream-filesPrincess Sam
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly LanguageAhmed M. Abed
 
Ataques dirigidos contra activistas
Ataques dirigidos contra activistasAtaques dirigidos contra activistas
Ataques dirigidos contra activistasDavid Barroso
 

Similar to MASM.pptx (20)

How to setup MateriApps LIVE!
How to setup MateriApps LIVE!How to setup MateriApps LIVE!
How to setup MateriApps LIVE!
 
Assembly fundamentals
Assembly fundamentalsAssembly fundamentals
Assembly fundamentals
 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the Stack
 
MateriApps LIVE! の設定
MateriApps LIVE! の設定MateriApps LIVE! の設定
MateriApps LIVE! の設定
 
Bootloader and MMU (english)
Bootloader and MMU (english)Bootloader and MMU (english)
Bootloader and MMU (english)
 
Mp &mc programs
Mp &mc programsMp &mc programs
Mp &mc programs
 
BOOTABLE OPERATING SYSTEM
BOOTABLE OPERATING SYSTEMBOOTABLE OPERATING SYSTEM
BOOTABLE OPERATING SYSTEM
 
Mac Forensics
Mac ForensicsMac Forensics
Mac Forensics
 
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsDumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
 
Msdnaa and you
Msdnaa and youMsdnaa and you
Msdnaa and you
 
Project eprom progr
Project eprom progrProject eprom progr
Project eprom progr
 
Lab 5 - String Manipulation usingTASM Environment-1.docx
Lab 5 - String Manipulation usingTASM Environment-1.docxLab 5 - String Manipulation usingTASM Environment-1.docx
Lab 5 - String Manipulation usingTASM Environment-1.docx
 
44 con slides
44 con slides44 con slides
44 con slides
 
44 con slides (1)
44 con slides (1)44 con slides (1)
44 con slides (1)
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Lec 47.48 - stream-files
Lec 47.48 - stream-filesLec 47.48 - stream-files
Lec 47.48 - stream-files
 
Installing Aix
Installing AixInstalling Aix
Installing Aix
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
 
Ataques dirigidos contra activistas
Ataques dirigidos contra activistasAtaques dirigidos contra activistas
Ataques dirigidos contra activistas
 
EC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptxEC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptx
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

MASM.pptx

  • 2. • To download dosbox,use the following link https://www.dosbox.com/download.php?main=1 • To download 8086 zip file use the following link http://www.mediafire.com/file/mm7cjztce9efj4w/8 086.zip/file Note: After downloading both, save into c drive
  • 3. 1. Install DosBox directly into your C Drive. 2. Extract files from ZIP folder, it will contains multiple exe files. Place this folder into your C drive and rename it to 8086( if its name is not 8086) 3. Run DosBox and write the following: mount c c:8086 4. Create a file with .asm extension e.g. hello.asm using notepad in 8086 folder.
  • 4.
  • 5. Write a MASM program to display “Hello World” • data segment • str db 0ah,0dh,"Hello World$" • data ends • code segment • assume cs:code,ds:data • start: • mov ax,data • mov ds,ax • mov dx,offset str • mov ah,09h • int 21h • mov ah,4ch • int 21h • code ends • end start
  • 6. To make your directories available as drives in DOSBox by using the "mount" command
  • 10. Write a MASM program to add two numbers(nos initialized in the program itself) data segment opr1 dw 1234h opr2 dw 0023h result dw 01 dup(?) data ends code segment start: mov ax, data mov ds ,ax mov ax, opr1 mov bx, opr2 clc add ax,bx • mov di, offset result • mov [di],ax • mov ah,4ch • int 21h code ends end start
  • 11. DOS function calls • By calling INT 21h with a sub function number in the AH processor register and other parameters in other registers, various DOS services can be invoked. • These include handling keyboard input, video output, disk file access, program execution, memory allocation, and various other activities.
  • 12. Mov ah, 01h int 21h (read char from std input device) Mov ah, 02h int 21h (Write char to std device) LEA dx,str // ( str db oah,odh, “Hello$”)// Mov ah, 09h int 21h //(display string)//
  • 13. LEA dx,str // ( str db 24h dup(?) )// Mov ah, 0ah int 21h // (Buffered str input)// Mov ah, 4Ch int 21h (Program to exit)
  • 14.
  • 15. Syntax of MACRO i) Defining a Macro MACRO can be defined anywhere in a program using derivatives MACRO and ENDM Eg: display macro mov dx,offset str mov ah,09h int 21h endm (for invoking this in program just write display)
  • 16. • ii) Passing parameter to macro display macro msg mov dx,offset msg mov ah,09h int 21h Endm (for invoking it Display opr1 Display opr2 Display result)