Skip to content

Latest commit

 

History

History
174 lines (71 loc) · 3.79 KB

README.md

File metadata and controls

174 lines (71 loc) · 3.79 KB

Calculator-Assembly

A Scientific Calculator coded in Assembly Language which takes numbers as input and performs the selected operations and displays the result. Operations include +, -, x, /, %, Square, Cube and some Binary Operations.

Title:

A Simple Scientific Calculator

Objective:

The goal of this project work is to utilize the concepts and knowledge of Assembly Language and use them in the Project. That is what I have learned so far and use the concepts of different Instructions in this project. And to understand the working of instructions and the code of Assembly Language using emulator EMU8086.

Theory:

The calculator that I build performs simple Mathematical Operations such as Addition, Subtraction, Multiplication and Division. Further it can perform NEG operation (changes the sign of the input), find the Modulus, calculate binary OR, binary AND, binary XOR, binary NOT, calculate Square and calculate Cube of the number.

Implementation:

I used EMU8086.inc Library which provides built in functions such as: print ‘STRING’ – For printing String scan_num – For taking Integer Input print_num – For displaying value stored in register printn – For printing New Line 0dh and 0ah as well as print10 and print13 can also be used to move to new line.

Interrupts used:

image image

I have made functions of different operations of the Calculator, such as

Addition:

….

..code..

….

Subtraction:

….

..code..

….

Etc.,

In data segment I have declared some variables as Uninitialized and some strings with string values.

Different Functions of Operations:

  • Addition

Addition of two numbers.

  • Subtraction

Subtraction of two numbers.

  • Multiplication

Multiplication of two numbers.

  • Division

Division of two numbers.

  • Modulus

Modulus of two numbers.

  • Negate

Negation of a number.

  • Square

Square of a number.

  • Cube

Cube of a number.

  • Binary OR

OR of two numbers.

  • Binary AND

AND of two numbers.

  • Binary XOR

XOR of two numbers.

  • Binary NOT

NOT of two numbers.

  • Continue

Asks the user whether to use again or exit.

  • Exit

Exits from the program.

Debugging-Test-Run

When the user runs the program, a main menu will display as below in graphics mode.

image

The user will now input the operation number he would like to perform, such as 1 for addition, 2 for subtraction and so on,

image

Then the user will be asked to enter two numbers to perform the selected operation after entering the number the operation will be performed and the answer will be displayed on the screen.

image

With the answer displayed the option of using the calculator again will also be displayed. If the user enters 1 then the calculator will start again from beginning.

image

If the user enters 0 then the program will jump to exit function and then display the message and terminates the program.

image

After this the emulator will be halted and the program is executed.

image