Question

In: Electrical Engineering

Develop and test an Intel 8086 assembly program by emu8086 amd dont use any extirnall lib...

Develop and test an Intel 8086 assembly program by emu8086 amd dont use any extirnall lib , that reads two decimal numbers x and y. Your program
should display the result of their:
1) Addition: x+y
2) Subtraction: x-y
3) Multiplication: x*y
4) Division: x / y
Notes:
 x and y are two-digit decimal numbers (i.e. 0-99).
 The program should display an error message if the value of y is zero, in the case of division.
 You can assume only positive numbers but you will get a bonus if your program can read and handle
negative numbers.
 You will get higher mark if your program accepts only two decimal digits (0-9) for each number and
print error message when the user tries to enter non-decimal digits (e.g. A-Z, or a-z, or any special
character).
Your program output should be similar to the following examples:
Example1: (x>y)
Please enter two 2-digit decimal
number:
X= 48
Y= 26
X + Y = 74
X – Y = 22
X * Y = 1248
X /Y = 1 with Remainder 22
Example2: (x<y)
Please enter two 2-digit decimal
number:
X= 12
Y= 37
X + Y = 49
X – Y = -25
X * Y = 444
X /Y = 0 with Remainder 12
Example3: (y=0)
Please enter two 2-digit decimal
number:
X= 56
Y= 00
X + Y = 56
X – Y = 56
X * Y = 00
X /Y = error overflow

Solutions

Expert Solution

TITLE Add and Substact and Multiply and Division (addSubMulDiv.com)

INCLUDE Irvine32.inc

.code

.data

main PROC

szMenu db "Now what do you want to do with those 2 numbers?",12,09

db 'Add (A)',12,09

db 'Subtract (S)',12,09

db 'Divide (D)',12,0

db 'Multiply (M)',12,09

db 'Exit (E)',12,09

db 'Selection: ',0:12,09,0

myMenu db 'Welcome!',12,09

db 'Enter integer 1:',0

myInteger2 db 'Enter integer 2:',0;12,09,0

szInvalidMenu db 12, 09, "Invalid Menu Choice!", 12, 09, 0

myTotal db 'Total:',12,09,0

.data?

Input1 dd ?

Input2 dd ?

Total dd?

.code

Start:

call Clrscr

move edx,offset myMenu

call WriteString

FirstNum:

call Readlnt

test eax,eax

jz Start

mov Input1,eax

SecondNum:

mov edx, offset myInteger2

call WriteString

call ReadInt

test eax,eax

jz SecondNum

mov Input2,eax

Menu:

mov edx, offset szMenu

call WriteString

call ReadChar

# check for addition operation and add input 1 and input 2

.if al=="A"//al=="a",

Call Crlf

mov eax,Total

mov eax, Input1

add eax, Input2

Call WriteInt

Call Crlf

;jmp start

# check for subtraction and subtract input 2 from input 1

.elseif al == "S" // al == "s"

Call Crlf

mov edx, offset myTotal

call WriteString

mov eax, Total

mov eax, Input1

sub eax, Input2

Call WriteInt

Call Crlf

;jmp start

# check for division operation and divide input 1 with input 2

,elseif al == "D" // al == "d"

Call Crlf

mov edx, offset myTotal

call WriteString

mov eax,Total

mov eax, Input1

div eax, Input2

Call WriteInt

Call Crlf

;jmp start

# check for Multplication operation and multiply input 1 and input 2

.elseif al == "M" // al == "m"

Call Crlf

mov edx, offset myTotal

call WriteString

mov eax, Total

mov eax, Input1

mul eax, Input2

Call WriteInt

Call Crlf

;jmp start

# check for operaion E to exit

.elseif al == "E" // al == "e"

exit

.else

mov edx. offset szlnvalidMenu

call WriteString

jmp Menu

.endif

call WaitMsg

exit

end Start

exit

main ENDP

END main

these code uses the Irvine32 library,so make you have it in your system.


Related Solutions

Assignment Description: Develop and test an Intel 8086 assembly program that reads two decimal numbers x...
Assignment Description: Develop and test an Intel 8086 assembly program that reads two decimal numbers x and y. Your program should display the result of their: 1) Addition: x+y 2) Subtraction: x-y 3) Multiplication: x*y 4) Division: x / y Notes:  x and y are two-digit decimal numbers (i.e. 0-99).  The program should display an error message if the value of y is zero, in the case of division.  You can assume only positive numbers but you...
Develop an assembly language program for 89c51 to do following {Marks 10} Store any 8 values...
Develop an assembly language program for 89c51 to do following {Marks 10} Store any 8 values of one byte each anywhere in Scratch Pad area of RAM. You are bound to use loop to store values. Find Mean of these 8 values (use shift operator for division) and send it to port P2 (formula for to find mean is given below) Find the lowest number among the numbers saved in part (1), take its 2’s complement and send it to...
Use Proteus or any other tool to simulate 8086 signals of the following instructions: MOV AL,44H...
Use Proteus or any other tool to simulate 8086 signals of the following instructions: MOV AL,44H MOV BX, [1389H] MOV [BX], AL MOV AL,55H OUT 6EH, AL Add Latches and Buffers to the 8086 bus to get the address and data separately. Use similar code as in part a, but you have to use different numbers. You can add other codes if you wish. You have to include the signals CLK, ALE, M/IO’, RD’, WR’, DT/R’, DEN’, BHE’, Address and...
Develop an x86 assembly language program that properly executes an "x to the y power" function:...
Develop an x86 assembly language program that properly executes an "x to the y power" function: int power(int x, int y) Compute the integer value that is x to the y power Do not concern yourself with the possibility of overflow You may only use only a loop structure to compute the value Remember that the return value must be placed in the EAX register Make sure that any registers (not EAX) used by this function are placed back to...
C++ Create a program that use the linkedbag 3. Develop a program to maintain a list...
C++ Create a program that use the linkedbag 3. Develop a program to maintain a list of homework assignments. When an assignment is assigned, add it to the list, and when it is completed, remove it. You should keep track of the due date. Your program should provide the following services: • Add a new assignment. • Remove an assignment. • Provide a list of the assignments in the order they were assigned. • Find the assignment(s) with the earliest...
Develop a rudimentary Java program that will allow anyone to enter any number of grades and...
Develop a rudimentary Java program that will allow anyone to enter any number of grades and then calculate grade point average. For reference, a grade point average is a weighted average of a set of grades based on the relative number of credits. For example, a 1 credit “A” (4.0) should count twice as much as a .5 credit “C” (3.0), and a 1.5 credit “A+”(4.33) should count three times as much as the “C” and 1.5 times as much...
Develop an x86 assembly language program that properly executes an "is even" function: bool isEven(int value)...
Develop an x86 assembly language program that properly executes an "is even" function: bool isEven(int value) If the value passed in is even, return 1 If the value passed in is odd, return 0 Remember that the return value must be placed in the EAX register Make sure that any registers (not EAX) used by this function are placed back to their initial states prior to exiting Allow an end user to test this function in the following manner: Prompt...
Must use AT&T x64/GNU Assembly syntax. Write an assembly language program that reads in two integers,...
Must use AT&T x64/GNU Assembly syntax. Write an assembly language program that reads in two integers, A and B, and uses them to compute the following expressions. You must use the same values for A and B throughout all three expressions. 1) A * 5 2) (A + B) - (A / B) 3) (A - B) + (A * B)
PLEASE DO NOT OVERRIDE ANY EXCEPTIONS TASK: You want to develop a Java program that will...
PLEASE DO NOT OVERRIDE ANY EXCEPTIONS TASK: You want to develop a Java program that will allow you to keep track of a set of employees. In reviewing your employee list, you notice that your employees fall into two categories: Salaried and Hourly. The following table shows the information that you keep in your employee list for each type of employee. Field Type Salaried Hourly id int Yes Yes name String Yes Yes title String Yes No position String No...
Write a program with an array that is initialized with test data. Use any primitive data type of your choice. The program should also have the following methods:
IN JAVA Array Operations Write a program with an array that is initialized with test data. Use any primitive data type of your choice. The program should also have the following methods: getTotal: This method should accept a one-dimensional array as its argument and return the total of the values in the array. getAverage: This method should accept a one-dimensional array as its argument and return the average of the values in the array. getHighest: This method should accept a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT