How to Perform Arithmetic Operations on Numbers In Assembly Language


What are Arithmetic Operations in Assembly Language?

Mostly all of you know about the arithmetic operations but mostly don't know how to perform it in low level machine language like Assembly Language. I will perform arithmetic operations in Assembly Language using visual Studio 2019 but you can also use any version of Visual Studio.
I will provide you the code of performing arithmetic operations and if you still not get how to perform it you can also watch video here given below. Also is you want to learn assembly Language then you can follow all my articles written on Assembly Language also you can watch my videos for better understanding.

Watch here how to Perform Arithmetic Operations:

Don't forget to subscribe and press the bell icon.


Perform All Arithmetic Operations on Two Numbers In Assembly Language (Code is Given Below):

.386
INCLUDE Irvine32.inc
.model small
.stack 100h
.data
msg db "Enter 1st Number",0
msg1 db "Enter 2nd Number",0
msg2 db "Addition is:",0
msg3 db "Subtraction is:",0
msg4 db "Multiplication is:",0
msg5 db "Division is:",0
var dd ?
var1 dd ?


.code
main proc
; How to perform Arithmetic operations on two numbers with displaying msg

mov edx,offset msg
call writestring
call readint

mov var,eax

mov edx,offset msg1
call writestring
call readint

mov var1,eax

;Addition Section

mov eax,var
add eax,var1
mov edx,offset msg2
call writestring
call writeint
call crlf

;Subtraction

mov eax,var
sub eax,var1
mov edx,offset msg3
call writestring
call writeint
call crlf

;Multiplication Section
;Here Two Registers will be used

mov eax,var
mov ebx,var1
mul ebx
mov edx,offset msg4
call writestring
call writeint
call crlf

;Division Section
;Here two registers will be used for division

mov edx,0 ;to store the remainder of division
mov eax,var
mov ebx,var1
div ebx
mov edx,offset msg5
call writestring
call writeint

;to display remainder
call crlf ;to enter new line
mov eax,edx
call writeint





invoke ExitProcess,0
main endp 
end main

Output:

Output of this program is given below:


Comments

  1. hi was just seeing if you minded a comment. i like your website and the thme you picked is super. I will be back. learn chinese in 5 minutes

    ReplyDelete
  2. There are numerous reasons why it's imperative to check Social Security number data on your representatives, for example, to ensure that you are recruiting legitimate laborers, guaranteeing precise compensation reports, and guaranteeing that your workers' wages are appropriately credited to their SSA income records. A basic grammatical mistake could have sad long haul impacts on a representative. For instance, consider the possibility that a worker's SSN was entered erroneously. Imagine a scenario in which nobody saw this for quite a long time. A basic confirmation could stay away from this possibly terrible bungle.numbersdata.com

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Run Assembly Language Programming Code In Visual Studio 2019

How to Display Table of any Number in Assembly Language

How to Display Character in Assembly language