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.
A Simple Scientific Calculator
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.
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.
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.
I have made functions of different operations of the Calculator, such as
….
..code..
….
….
..code..
….
Etc.,
In data segment I have declared some variables as Uninitialized and some strings with string values.
- 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.
When the user runs the program, a main menu will display as below in graphics mode.
The user will now input the operation number he would like to perform, such as 1 for addition, 2 for subtraction and so on,
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.
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.
If the user enters 0 then the program will jump to exit function and then display the message and terminates the program.
After this the emulator will be halted and the program is executed.