Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following program is not running in DosBox make the changes needed for the program to work in assembly x86 CODE: .MODEL SMALL .STACK 100H

The following program is not running in DosBox make the changes needed for the program to work in assembly x86

CODE:

.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

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

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

CMP AL,'Y'

JE START

CMP AL,'E'

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

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,'E'

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

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,'E'

JE EXIT

EXIT: ; SAY GOOD BYE AND THEN EXIT

MOV AH,09H

MOV DX,OFFSET EX

INT 21H

.EXIT

END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

1. How does Kiwi Experience maintain a continual customer focus?

Answered: 1 week ago