SlideShare a Scribd company logo
1 of 6
[15B-145-EL] SamiULLAH
.MODEL SMALL
.STACK 100H
.DATA
MAIN_MENU DB ,0DH,0AH,"Calculater",0DH,0AH
DB "Press 'A' For ADDITION",0DH,0AH
DB "Press 'S' For SUBTRACTION",0DH,0AH
DB "Press 'M' For MULTIPLICATION",0DH,0AH
DB "Press 'D' For DIVISION",0DH,0AH
DB "Press 'E' For EXIT",0DH,0AH
DB "Press 'R' For RETURN to Main Menu",0DH,0AH
DB "*******************************",0DH,0AH
DB "*******************************",0DH,0AH
DB "Enter Your CHOICE",0DH,0AH,'$'
NUM1 DB "Enter First Number",0DH,0AH,'$'
NUM2 DB ,0DH,0AH,"Enter Second
Number",0DH,0AH,'$'
ADD1 DB ,0DH,0AH,"FOR ADDITION",0DH,0AH,'$'
SUB1 DB ,0DH,0AH,"FOR SUBTRACTION",0DH,0AH,'$'
MUL1 DB ,0DH,0AH,"FOR MULTIPLICATION",0DH,0AH,'$'
DIV1 DB ,0DH,0AH,"FOR DIVISION",0DH,0AH,'$'
EX DB ,0DH,0AH,"GOOD BYE AND HAVE A NICE TIME
:)",0DH,0AH,'$'
ANS DB ,0DH,0AH,"ANSWER ",0DH,0AH,'$'
CONTINUE DB ,0DH,0AH,"DO YOU WANT TO
CONTINUE",0DH,0AH,'$'
OP1 DB ?
OP2 DB ?
Operand DB ?
CON DB ?
.CODE
.STARTUP
START:
MOV AH,09H
MOV DX, OFFSET MAIN_MENU
INT 21H
MOV AH,01H
INT 21H
MOV Operand,AL
MOV AL,Operand
CMP AL,'A'
JE ADD
CMP AL,'S'
JE SUB
CMP AL,'M'
JE MUL
CMP AL,'D'
JE DIV
CMP AL,'R'
JE START
CMP AL,'E'
JE EXIT
ADD: ; PERFORMING ADDITION
MOV AH,09H
MOV DX,OFFSET ADD1
INT 21H
;FIRST OPERAND
MOV AH,09H
MOV DX,OFFSET NUM1
INT 21H
MOV AH,01H
[15B-145-EL] SamiULLAH
INT 21H
MOV OP1,AL
;SECOND OPERAND
MOV AH,09H
MOV DX,OFFSET NUM2
INT 21H
MOV AH,01H
INT 21H
MOV OP2,AL
MOV AH,09H
MOV DX, OFFSET ANS
INT 21H
MOV AL,OP1
MOV BL,OP2
ADD AL,BL
AAS
OR AX, 3030H
; PRINT RESULT
MOV AH,0EH
INT 10H
;FOR CONTINUE
MOV AH,09H
MOV DX,OFFSET CONTINUE
INT 21H
MOV AH,01H
INT 21H
MOV CON,AL
MOV AL,CON
CMP AL,'Y'
JE START
CMP AL,'N'
JE EXIT
SUB: ; PERFORMING SUBTRACTION
MOV AH,09H
MOV DX,OFFSET SUB1
INT 21H
;FIRST OPERAND
MOV AH,09H
MOV DX,OFFSET NUM1
INT 21H
MOV AH,01H
INT 21H
MOV OP1,AL
;SECOND OPERAND
MOV AH,09H
MOV DX,OFFSET NUM2
INT 21H
MOV AH,01H
INT 21H
MOV OP2,AL
MOV AH,09H
MOV DX, OFFSET ANS
INT 21H
MOV AL,OP1
MOV BL,OP2
SUB AL,BL
AAS
OR AX, 3030H
; PRINT RESULT
MOV AH,0EH
[15B-145-EL] SamiULLAH
INT 10H
;FOR CONTINUE
MOV AH,09H
MOV DX,OFFSET CONTINUE
INT 21H
MOV AH,01H
INT 21H
MOV CON,AL
MOV AL,CON
CMP AL,'Y'
JE START
CMP AL,'N'
JE EXIT
MUL: ; PERFORMING MULTIPLICATION
MOV AH,09H
MOV DX,OFFSET MUL1
INT 21H
;FIRST OPERAND
MOV AH,09H
MOV DX,OFFSET NUM1
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV OP1,AL
;SECOND OPERAND
MOV AH,09H
MOV DX,OFFSET NUM2
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV OP2,AL
MOV AH,09H
MOV DX, OFFSET ANS
INT 21H
MOV AL,OP1
MOV BL,OP2
MUL BL
ADD AL,30H
; PRINT RESULT
MOV AH,0EH
INT 10H
;FOR CONTINUE
MOV AH,09H
MOV DX,OFFSET CONTINUE
INT 21H
MOV AH,01H
INT 21H
MOV CON,AL
MOV AL,CON
CMP AL,'Y'
JE START
CMP AL,'N'
JE EXIT
DIV: ; PERFORMING DIVISION
MOV AH,09H
MOV DX,OFFSET DIV1
INT 21H
;FIRST OPERAND
[15B-145-EL] SamiULLAH
MOV AH,09H
MOV DX,OFFSET NUM1
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV OP1,AL
;SECOND OPERAND
MOV AH,09H
MOV DX,OFFSET NUM2
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV OP2,AL
MOV AH,09H
MOV DX, OFFSET ANS
INT 21H
MOV AX,0000H
MOV AL,OP1
MOV BL,OP2
DIV BL
ADD AL,30H
; PRINT RESULT
MOV AH,0EH
INT 10H
;FOR CONTINUE
MOV AH,09H
MOV DX,OFFSET CONTINUE
INT 21H
MOV AH,01H
INT 21H
MOV CON,AL
MOV AL,CON
CMP AL,'Y'
JE START
CMP AL,'N'
JE EXIT
EXIT: ; SAY GOOD BYE AND THEN EXIT
MOV AH,09H
MOV DX,OFFSET EX
INT 21H
.EXIT
END
[15B-145-EL] SamiULLAH
OUTPUT
ADDITION
SUBTRACTION
MULTIPLICATION
DIVISION
[15B-145-EL] SamiULLAH

More Related Content

What's hot

8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
jemimajerome
 

What's hot (20)

Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
Verilog coding of demux 8 x1
Verilog coding of demux  8 x1Verilog coding of demux  8 x1
Verilog coding of demux 8 x1
 
K map
K mapK map
K map
 
Representation of numbers and characters
Representation of numbers and charactersRepresentation of numbers and characters
Representation of numbers and characters
 
15 bitwise operators
15 bitwise operators15 bitwise operators
15 bitwise operators
 
assembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YU
 
K map
K mapK map
K map
 
Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++
 
Array and string
Array and stringArray and string
Array and string
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programming
 
Parallel Adder
Parallel Adder Parallel Adder
Parallel Adder
 
ROL ROR SHL SHR Assembly Language Programmin 8086
ROL ROR SHL SHR Assembly Language Programmin 8086ROL ROR SHL SHR Assembly Language Programmin 8086
ROL ROR SHL SHR Assembly Language Programmin 8086
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
NFA and DFA
NFA and DFANFA and DFA
NFA and DFA
 
358 33 powerpoint-slides_6-strings_chapter-6
358 33 powerpoint-slides_6-strings_chapter-6358 33 powerpoint-slides_6-strings_chapter-6
358 33 powerpoint-slides_6-strings_chapter-6
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Organization of the ibm personal computers
Organization of the ibm personal computersOrganization of the ibm personal computers
Organization of the ibm personal computers
 
Assembly language (coal)
Assembly language (coal)Assembly language (coal)
Assembly language (coal)
 

Similar to Calculator 8086 Assembly Language Programming

Topviewsimulator
TopviewsimulatorTopviewsimulator
Topviewsimulator
Rashmi
 
Applications of microcontroller(8051)
Applications of microcontroller(8051) Applications of microcontroller(8051)
Applications of microcontroller(8051)
vijaydeepakg
 

Similar to Calculator 8086 Assembly Language Programming (13)

Assembly Language Voltage Divider Bias Program 8086
Assembly Language Voltage Divider Bias Program 8086Assembly Language Voltage Divider Bias Program 8086
Assembly Language Voltage Divider Bias Program 8086
 
Microprocessor and micro-controller lab (assembly programming)
Microprocessor and micro-controller lab (assembly programming)Microprocessor and micro-controller lab (assembly programming)
Microprocessor and micro-controller lab (assembly programming)
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086
 
Assembler
AssemblerAssembler
Assembler
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
Topviewsimulator
TopviewsimulatorTopviewsimulator
Topviewsimulator
 
جميع اوامر لغة الاسمبلي
جميع اوامر لغة الاسمبلي جميع اوامر لغة الاسمبلي
جميع اوامر لغة الاسمبلي
 
Applications of microcontroller(8051)
Applications of microcontroller(8051) Applications of microcontroller(8051)
Applications of microcontroller(8051)
 
Programs using Microcontrollers.ppt
Programs using Microcontrollers.pptPrograms using Microcontrollers.ppt
Programs using Microcontrollers.ppt
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086
 
Instalación de emu8086 y compilados
Instalación de emu8086 y compiladosInstalación de emu8086 y compilados
Instalación de emu8086 y compilados
 
8255
82558255
8255
 
Compiladores emu8086
Compiladores emu8086Compiladores emu8086
Compiladores emu8086
 

Recently uploaded

Online crime reporting system project.pdf
Online crime reporting system project.pdfOnline crime reporting system project.pdf
Online crime reporting system project.pdf
Kamal Acharya
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 
Seizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksSeizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networks
IJECEIAES
 
electrical installation and maintenance.
electrical installation and maintenance.electrical installation and maintenance.
electrical installation and maintenance.
benjamincojr
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
BalamuruganV28
 
Microkernel in Operating System | Operating System
Microkernel in Operating System | Operating SystemMicrokernel in Operating System | Operating System
Microkernel in Operating System | Operating System
Sampad Kar
 

Recently uploaded (20)

Online crime reporting system project.pdf
Online crime reporting system project.pdfOnline crime reporting system project.pdf
Online crime reporting system project.pdf
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 
Seizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksSeizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networks
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 
Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...
Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...
Vip ℂall Girls Karkardooma Phone No 9999965857 High Profile ℂall Girl Delhi N...
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
electrical installation and maintenance.
electrical installation and maintenance.electrical installation and maintenance.
electrical installation and maintenance.
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
Microkernel in Operating System | Operating System
Microkernel in Operating System | Operating SystemMicrokernel in Operating System | Operating System
Microkernel in Operating System | Operating System
 

Calculator 8086 Assembly Language Programming

  • 1. [15B-145-EL] SamiULLAH .MODEL SMALL .STACK 100H .DATA MAIN_MENU DB ,0DH,0AH,"Calculater",0DH,0AH DB "Press 'A' For ADDITION",0DH,0AH DB "Press 'S' For SUBTRACTION",0DH,0AH DB "Press 'M' For MULTIPLICATION",0DH,0AH DB "Press 'D' For DIVISION",0DH,0AH DB "Press 'E' For EXIT",0DH,0AH DB "Press 'R' For RETURN to Main Menu",0DH,0AH DB "*******************************",0DH,0AH DB "*******************************",0DH,0AH DB "Enter Your CHOICE",0DH,0AH,'$' NUM1 DB "Enter First Number",0DH,0AH,'$' NUM2 DB ,0DH,0AH,"Enter Second Number",0DH,0AH,'$' ADD1 DB ,0DH,0AH,"FOR ADDITION",0DH,0AH,'$' SUB1 DB ,0DH,0AH,"FOR SUBTRACTION",0DH,0AH,'$' MUL1 DB ,0DH,0AH,"FOR MULTIPLICATION",0DH,0AH,'$' DIV1 DB ,0DH,0AH,"FOR DIVISION",0DH,0AH,'$' EX DB ,0DH,0AH,"GOOD BYE AND HAVE A NICE TIME :)",0DH,0AH,'$' ANS DB ,0DH,0AH,"ANSWER ",0DH,0AH,'$' CONTINUE DB ,0DH,0AH,"DO YOU WANT TO CONTINUE",0DH,0AH,'$' OP1 DB ? OP2 DB ? Operand DB ? CON DB ? .CODE .STARTUP START: MOV AH,09H MOV DX, OFFSET MAIN_MENU INT 21H MOV AH,01H INT 21H MOV Operand,AL MOV AL,Operand CMP AL,'A' JE ADD CMP AL,'S' JE SUB CMP AL,'M' JE MUL CMP AL,'D' JE DIV CMP AL,'R' JE START CMP AL,'E' JE EXIT ADD: ; PERFORMING ADDITION MOV AH,09H MOV DX,OFFSET ADD1 INT 21H ;FIRST OPERAND MOV AH,09H MOV DX,OFFSET NUM1 INT 21H MOV AH,01H
  • 2. [15B-145-EL] SamiULLAH INT 21H MOV OP1,AL ;SECOND OPERAND MOV AH,09H MOV DX,OFFSET NUM2 INT 21H MOV AH,01H INT 21H MOV OP2,AL MOV AH,09H MOV DX, OFFSET ANS INT 21H MOV AL,OP1 MOV BL,OP2 ADD AL,BL AAS OR AX, 3030H ; PRINT RESULT MOV AH,0EH INT 10H ;FOR CONTINUE MOV AH,09H MOV DX,OFFSET CONTINUE INT 21H MOV AH,01H INT 21H MOV CON,AL MOV AL,CON CMP AL,'Y' JE START CMP AL,'N' JE EXIT SUB: ; PERFORMING SUBTRACTION MOV AH,09H MOV DX,OFFSET SUB1 INT 21H ;FIRST OPERAND MOV AH,09H MOV DX,OFFSET NUM1 INT 21H MOV AH,01H INT 21H MOV OP1,AL ;SECOND OPERAND MOV AH,09H MOV DX,OFFSET NUM2 INT 21H MOV AH,01H INT 21H MOV OP2,AL MOV AH,09H MOV DX, OFFSET ANS INT 21H MOV AL,OP1 MOV BL,OP2 SUB AL,BL AAS OR AX, 3030H ; PRINT RESULT MOV AH,0EH
  • 3. [15B-145-EL] SamiULLAH INT 10H ;FOR CONTINUE MOV AH,09H MOV DX,OFFSET CONTINUE INT 21H MOV AH,01H INT 21H MOV CON,AL MOV AL,CON CMP AL,'Y' JE START CMP AL,'N' JE EXIT MUL: ; PERFORMING MULTIPLICATION MOV AH,09H MOV DX,OFFSET MUL1 INT 21H ;FIRST OPERAND MOV AH,09H MOV DX,OFFSET NUM1 INT 21H MOV AH,01H INT 21H SUB AL,30H MOV OP1,AL ;SECOND OPERAND MOV AH,09H MOV DX,OFFSET NUM2 INT 21H MOV AH,01H INT 21H SUB AL,30H MOV OP2,AL MOV AH,09H MOV DX, OFFSET ANS INT 21H MOV AL,OP1 MOV BL,OP2 MUL BL ADD AL,30H ; PRINT RESULT MOV AH,0EH INT 10H ;FOR CONTINUE MOV AH,09H MOV DX,OFFSET CONTINUE INT 21H MOV AH,01H INT 21H MOV CON,AL MOV AL,CON CMP AL,'Y' JE START CMP AL,'N' JE EXIT DIV: ; PERFORMING DIVISION MOV AH,09H MOV DX,OFFSET DIV1 INT 21H ;FIRST OPERAND
  • 4. [15B-145-EL] SamiULLAH MOV AH,09H MOV DX,OFFSET NUM1 INT 21H MOV AH,01H INT 21H SUB AL,30H MOV OP1,AL ;SECOND OPERAND MOV AH,09H MOV DX,OFFSET NUM2 INT 21H MOV AH,01H INT 21H SUB AL,30H MOV OP2,AL MOV AH,09H MOV DX, OFFSET ANS INT 21H MOV AX,0000H MOV AL,OP1 MOV BL,OP2 DIV BL ADD AL,30H ; PRINT RESULT MOV AH,0EH INT 10H ;FOR CONTINUE MOV AH,09H MOV DX,OFFSET CONTINUE INT 21H MOV AH,01H INT 21H MOV CON,AL MOV AL,CON CMP AL,'Y' JE START CMP AL,'N' JE EXIT EXIT: ; SAY GOOD BYE AND THEN EXIT MOV AH,09H MOV DX,OFFSET EX INT 21H .EXIT END