hello...

I'm looking for a calculator program written in assembler... it needs to do all the basic functions of a calculator eg add, subract, multiply, devide...

if anyone can point me in the right direction of where to find one it would be greatly apprecitaed...!

thanx...

neil...

asalamu alikom nail,i'm abdalla albakhit if u found anything useful according the term paper( calculator assignment ) please remmeber me i'm lost man.....thanks

hello...

I'm looking for a calculator program written in assembler... it needs to do all the basic functions of a calculator eg add, subract, multiply, devide...

if anyone can point me in the right direction of where to find one it would be greatly apprecitaed...!

thanx...

neil...

Hi,

You can copy simple calc from here..

#make_com#
include 'emu8086.inc'

ORG 100h

JMP start

msg1 DB 'Enter operation number[1~4]: $'
msg2 DB 'Enter 1st No: $'
msg3 DB 'Enter 2nd No: $'
msg4 DB 'The result is: $'
msg5 db 'Thank you for using My Calculator Program ', 13, 10, '$'

calcOP DB '?', 0

num1 DW ?
num2 DW ?
opr DW ?


start:
PRINTN 'Welcome to My Calculator Program'
PRINTN '[Loading...]'
PRINTN ''
PRINTN ''
PRINTN 'Please select type of arithmetic operation:'
PRINTN '1. Addition'
PRINTN '2. Subtraction'
PRINTN '3. Multiplication'
PRINTN '4. Division'

LEA DX, msg1 ; output of a string at DS:DX
MOV AH, 09h
INT 21h

MOV DX, 2
LEA DI, calcOP
CALL GET_STRING

PUTC 13
PUTC 10

LEA DX, msg2 ; first number
MOV AH, 09h
INT 21h
CALL scan_num
MOV num1, CX

PUTC 13
PUTC 10

LEA DX, msg3 ; second number
MOV AH, 09h
INT 21h
CALL scan_num
MOV num2, CX

PUTC 13
PUTC 10

LEA DX, msg4 ; result
MOV AH, 09h
INT 21h

CMP calcOP, '1'
JE do_plus

CMP calcOP, '2'
JE do_minus

CMP calcOP, '3'
JE do_mult

CMP calcOP, '4'
JE do_div

end:
PUTC 13
PUTC 10

LEA DX, msg5
MOV AH, 09h
INT 21h

RET

do_plus:

MOV AX, num1
ADD AX, num2
CALL PRINT_NUM
JMP end

do_minus:

MOV AX, num1
SUB AX, num2
CALL PRINT_NUM
JMP end

do_mult:

MOV AX, num1
IMUL num2
CALL PRINT_NUM
JMP end

do_div:
MOV DX, 0
MOV AX, num1
IDIV num2
CALL PRINT_NUM
JMP end

DEFINE_SCAN_NUM
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS
DEFINE_GET_STRING

END

This article has been dead for over six months. Start a new discussion instead.