Question: ( Need help with Case D and division) assembly language //part of calculator source code //calculator.cpp #include stdafx.h #include #include using namespace std; void addition(short

(Need help with Case D and division)

assembly language

//part of calculator source code //calculator.cpp #include "stdafx.h" #include #include using namespace std; void addition(short int x, short int y); // addition for signed integers void subtraction(short int x, short int y); // subtraction for signed integers void multiplication(short int x, short int y); // multiplication for signed integers void division(int x, short int y); // division for signed integers void addition(unsigned short int x, unsigned short int y); // addition for unsignedintegers void subtraction(unsigned short int x, unsigned short int y); // subtraction forunsigned integers void multiplication(unsigned short int x, unsigned short int y); // multiplication forunsigned integers void division(unsigned int x, unsigned short int y); // division for signed integers int main() { char ch1, ch2, ch3, ch4; unsigned short ur1, ur2, ur; signed short r1, r2, r; short int a, b; cout << "Start your calcalator Y/N, enter 'Y (or y)' or 'N( or n)' " << endl; cin >> ch1; ch1 = ch1; while (ch1 == 'Y' || ch1 == 'y') { printf("Menu: "); printf("1, 16-bit Integer Arithmetic Operation "); printf("2, Exit "); printf("Menu Options: "); std::cin >> ch2; ch2 = ch2; //Submenu: if (ch2 == '1') { printf("Submenu - input your choice "); printf("(a) Input two signed number operands for addition, and display the sum in the format of decimal and hex, respectively. "); printf("(b) Input two signed number operands for subtraction and display the difference in the format of decimal and hex, respectively. "); printf("(c) Input two signed number operands for multiplication and display the product in the format of decimal and hex, respectively. "); printf("(d) Input two signed number operands for division and display the quotient and remainder in the format of decimal and hex, respectively. "); printf("(e) Input two unsigned number operands for addition, and display the sum in the format of decimal and hex, respectively. "); printf("(f) Input two unsigned number operands for subtraction and display the difference in the format of decimal and hex, respectively. "); printf("(g) Input two unsigned number operands for multiplication and display the product in the format of decimal and hex, respectively. "); printf("(h) Input two unsigned number operands for division and display the quotient and remainder in the format of decimal and hex, respectively. "); } else { goto EndLable; } std::cin >> ch3; ch3 = ch3; //your code for signed number and unsighed number arithmatic operations switch (ch3) { case 'a': { printf("Input two signed number operands in decimal format "); scanf_s("%d %d", &r1, &r2); //read two signed numbers from keyboard addition(r1, r2); printf("====================================================== "); break; } case 'b': { printf("Input two signed number operands in decimal format "); scanf_s("%d %d", &r1, &r2); //read two signed numbers from keyboard subtraction(r1, r2); printf("====================================================== "); break; } case 'c': { printf("Input two signed number operands in decimal format "); scanf_s("%d %d", &r1, &r2); //read two signed numbers from keyboard multiplication(r1, r2); printf("====================================================== "); break; } case 'd': { printf("Input two signed number operands in decimal format "); scanf_s("%d %d", &r1, &b); //read two signed numbers from keyboard division(r1, b); printf("====================================================== "); break; } // continue your source code } cout << "Continue your integer calculator Y/N. Enter: 'Y' or 'N' " << endl; cin >> ch1; ch1 = ch1; } EndLable: cout << "Exit program" << endl; //getchar(); system("pause"); //hold screen return 0; } void addition(short int x, short int y) { short int r; _asm { MOV AX, x; MOV BX, y; ADD AX, BX; MOV r, AX; } cout << "The decimal sum of " << x << " and " << y << " is " << r << endl; cout << "The hexadecimal sum of " << hex << x << " and " << hex << y << " is " << hex << r << endl; } void subtraction(short int x, short int y) { short int r; _asm { MOV AX, x; MOV BX, y; SUB AX, BX; MOV r, AX; } cout << "The decimal subtraction of " << x << " minus " << y << " is " << dec << r << endl; cout << "The hexadecimal subtraction of " << hex << x << " minus " << hex << y << " is " << hex << r << endl; } // continue your source code for each function declared at the top of the programming // continue your source code for each function declared at the top of the programming void multiplication(short int x, short int y) // multiplication for signed integers { short int r; _asm { MOV AX, x; MOV BX, y; IMUL AX, BX; MOV r, AX; } cout << "The decimal Multipication of " << x << " times " << y << " is " << dec << r << endl; cout << "The hexadecimal Multiplication of " << hex << x << " times " << hex << y << " is " << hex << r << endl; } void division(int x, short int y) // division for signed integers { } void addition(unsigned short int x, unsigned short int y) // addition for unsigned integers { } void subtraction(unsigned short int x, unsigned short int y) // subtraction for unsigned integers { } void multiplication(unsigned short int x, unsigned short int y) // multiplication for unsigned integers { } void division(unsigned int x, unsigned short int y) // division for signed integers { }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!