Concept explainers
What does this code do?
.model small
.386
.stack 100h
.data
msg1 db 13, 10, "Enter any number --> ", "$"
msg2 db "Enter an operation +,- * or / --> ",13, 10, "$"
msg3 db "The Operation is --> ", "$"
msg4 db "The result is --> ", "$"
by_10 dd 10
sp_counter db 0
disp_number dd 0
disp_number2 dd 0
disp_number3 dd 0
op_type db 0
last_key dd 0
remainder db 0
.code
main proc
mov ax,@data
mov ds,ax
mov dx,offset msg1
call display_message
call m_keyin
call operation
mov dx,offset msg1
call display_message
call m_keyin
cmp op_type, "+"
jnz short skip_plus
call op_plus
skiP_plus:
cmp op_type, "-"
jnz short skip_minus
call op_minus
skip_minus:
cmp op_type, "*"
jnz short skip_mul
call op_mult
skip_mul:
cmp op_type, "/"
jnz short skip_div
call op_div
skip_div:
call m_display
mov ax, 4c00h
int 21h
operation proc
mov dx,offset msg2
rpt4:
call display_message
mov dx,offset msg3
call display_message
mov ah, 1
int 21h
cmp al, 30h
jns rpt4
mov op_type, al
ret
operation endp
m_display proc
mov dx,offset msg4
call display_message
mov eax, disp_number
mov sp_counter, 0
LP1:
mov edx, 0
div by_10
push dx
inc sp_counter
cmp eax, 0
jnz lp1
LP2:
pop dx
call display
dec sp_counter
jnz lp2
ret
m_display endp
op_minus proc
mov eax, disp_number2
sub eax, disp_number3
mov disp_number, eax
ret
op_minus endp
op_div proc
mov eax, disp_number2
div disp_number3
mov disp_number, eax
mov remainder, dl
call display
call m_display
mov dl, -16
call display
mov dl, remainder
call display
mov dl, -1
call display
mov edx, disp_number3
call display
mov ax, 4c00h
int 21h
op_div endp
op_mult proc
mov eax, disp_number2
mul disp_number3
mov disp_number, eax
ret
op_mult endp
op_plus proc
mov eax, disp_number2
add eax, disp_number3
mov disp_number, eax
ret
op_plus endp
display proc
add dl, 30h
cmp dl, 39h
js short skip_hex
add dl, 7
Skip_hex:
mov ah, 6
int 21h
ret
display endp
display_message proc
mov ah, 9
int 21h
mov edx, 0
ret
display_message endp
m_keyin proc
MOV disp_number, 0
mov last_key, 0
LP_key:
mov eax, disp_number
mul by_10
add eax, last_key
mov DISP_NUMBER, eax
mov ah, 1
int 21h
AND eax, 000000ffh
cmp al, 13
jz short finkey
sub al, 30h
MOV LAST_KEY, EAX
jmp lp_key
finkey:
MOV eax, DISP_NUMBER
cmp DISP_NUMBER2,0
jnz short skip
MOV DISP_NUMBER2, EAX
skip:
MOV DISP_NUMBER3, EAX
ret
m_keyin endp
main endp
end main
Step by stepSolved in 2 steps
- m6 C++ Question: Make an execution chart like the example below for the code provided. Example chart: An execution chart is a text version of the hierarchy. Indentation is used to indicate thesublevels or calls inside a call. It also contains the data exchange between the components asdesignated in the hierarchy chart. Given below is the execution chart that corresponds to thehierarchy chart of the property tax calculation program1.0 Main()2.0 CalculatePropertyTax()3.0 displayMessage( input string messageToDisplay)3.1 return double getHomeValue()3.2 return boolean checkHomeValue()3.3 return double applyPropertyTax(input double homeValue)3.4 displayPropertyTax(input homeValue)3.5 return Boolean queryMoreData()4.0 displayMessage(input string messageToDisplay)4.1 return char getYesNo()4.2 return char convertCase(input char)3.6 displayErrorMessage() More exlanation: example: 1.0 means it's of depth 1, line 0 then 2.0 means it's one call inside a function (aka it's inside another function)…arrow_forwardIf the input is negative, make numltemsPointer be null. Otherwise, make numltems Pointer point to numltems and multiply the value to which numltems Pointer points by 10. Ex: If the user enters 99, the output should be: Items: 990 406554.2871636.qx3zqy7 1 #include 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13 14 15 16 17 int numItems Pointer; int numItems; cin >> numItems; /* Your solution goes here */ if (numItems Pointer == nullptr) { cout << "Items is negative" << endl; } else { cout << "Items: << *numItemsPointer << endl; } || 1 test passed All tests passedarrow_forwardWrite a menu-driven C++ program to manage your college course history and plans, named as you wish. It should work something like this: Array size: 0, capacity: 2MENUA Add a courseL List all coursesC Arrange by courseY arrange by YearU arrange by UnitsG arrange by GradeQ Quit...your choice: a[ENTER]Enter a courses' name: Comsc-165[ENTER]Enter the year for Comsc-165 [like 2020]: 2016[ENTER]Enter the units for Comsc-165 [0, 1, 2,...]: 4[ENTER]Enter the grade for Comsc-165 [A, B,..., X if still in progress or planned]: x[ENTER]Array size: 1, capacity: 2MENUA Add a courseL List all coursesC Arrange by courseY arrange by YearU arrange by UnitsG arrange by GradeQ Quit...your choice: a[ENTER]Enter a courses' name: Comsc-110[ENTER]Enter the year for Comsc-110 [like 2020]: 2015[ENTER]Enter the units for Comsc-110 [0, 1, 2,...]: 4[ENTER]Enter the grade for Comsc-110 [A, B,..., X if still in progress or planned]: A[ENTER]Array size: 2, capacity: 2MENUA Add a courseL List all coursesC Arrange by…arrow_forward
- def is_balanced(root): return __is_balanced_recursive(root) def __is_balanced_recursive(root): """ O(N) solution """ return -1 != __get_depth(root) def __get_depth(root): """ return 0 if unbalanced else depth + 1 """ if root is None: return 0 left = __get_depth(root.left) right = __get_depth(root.right) if abs(left-right) > 1 or -1 in [left, right]: return -1 return 1 + max(left, right) # def is_balanced(root):# """# O(N^2) solution# """# left = max_height(root.left)# right = max_height(root.right)# return abs(left-right) <= 1 and is_balanced(root.left) and# is_balanced(root.right) # def max_height(root):# if root is None:.arrow_forwardUse stack concepts Q #2 Ô https://www.loc-cs.org/~chu/DataStructu Essay Questions (20% each)- continue [0] [1] [2] [3] myList "Bashful" "Awful" Jumpy "Happy The above "myList" is an ArrayList in Java program. 2. If I want to remove "Awful" from myList, which of the following actions should I take first? a. Move "Happy" to the previous element first. b. Move "Jumpy" to the previous element first. Describe the reason of your choice. Next Pagearrow_forwardYou can Use C++ programming, Windows Programming, Java, or Ptyhon to solve it The following table contains quarterly sales figures for five (5) departments: Quarter 1 Quarter 2 Quarter 3 Quarter 4 Total Department 1 750 660 910 800 Department 2 800 700 950 900 Department 3 700 600 750 600 Department 4 850 800 1000 950 Department 5 900 800 960 980 Total Design and write a Windows program/module named SalesAnalysis that will: Declare a two-dimensional integer array named sales – (Note: you have 6 rows and 5 columns) - that will hold the 4 quarterly sales for 5 departments Populate the first four columns for the 5 departments using the data in the preceding table. Contain a loop to compute and populate the total column. Store each department’s total in the array as it is being computed. Contain a loop to compute and populate the total row. Store each quarter’s total in the array as it is…arrow_forward
- Instructions: You are strictly not allowed to use anything other than pointers and dynamic memory. One function should perform one functionality only. Task 1 Write a program in C++ that reads data from a file. Create dynamic memory according to the data. Now your task is to perform the following task. Row wise Sum Column wise Sum Diagonal wise Sum Example data.txt 4 5 1.6 10.2 33.7 99 20.5 3 44 50 96.1 2 8 9 4 74 50 99 19.1 Output: Sum row wise: 165, 191, 17, 242.1 Sum col wise: 127.6, 120.1, 228.8, 118.1, 20.5 Sum diagonal wise: Not Possible Note: You are restricted to use pointers and your function should be generic. Avoid memory wastage, memory leakage, dangling pointer. Use regrow or shrink concepts if required.arrow_forwardJAVA PROGRAM Homework #2. Chapter 7. PC #13. Name Search (page 492) Read these instructions for additional requirements carefully. Write a program that reads the contents of the two files into two separate arrays. The user should be able to enter a name the application will display messages indicating whether the names were among the most popular. 1. GirlNames.txt and BoyNames.txt contain a list of the 200 most popular names given to girls/boys born in the United States for the years 2000 through 2009. 2. Your application should use an array to hold the names. 3. The program should continue interacting with the user indefinitely unless the user chooses to quit by entering "QUIT" (should be case insensitive). 4. The user should enter a single name and the program will search the name in both lists. The user SHOULD NOT specify whether the search is for girls name or boys name. The program is responsible for finding either or both and telling the user where it found it. 5.…arrow_forwardC++ Problem!! Sort A List Of Integers Given a file of 100,000 unsorted integers, write a program that first prompt user to enter file name and reads those integers into an array and sorts the integers in the array. The program should then prompt the user for an index, and then display the integer at that index. For example, if the array contains ten integers and the contents are 79 4 42 51 12 22 33 17 91 10 after sorting, the integer at index 6 is 42 Download the "List of 100,000 Unsorted Integers" from below link and sort that list, then enter the value at index 10000 (ten thousand) for a screenshot. https://1drv.ms/t/s!AuFS4mkcuYyBjHZ_SIudb93bq2uy?e=CsyvZjarrow_forward
- JAVA PROGRAM Homework #2. Chapter 7. PC #13. Name Search (page 492) Read these instructions for additional requirements carefully. Write a program that reads the contents of the two files into two separate arrays. The user should be able to enter a name the application will display messages indicating whether the names were among the most popular. 1. GirlNames.txt and BoyNames.txt contain a list of the 200 most popular names given to girls/boys born in the United States for the years 2000 through 2009. 2. Your application should use an array to hold the names. 3. The program should continue interacting with the user indefinitely unless the user chooses to quit by entering "QUIT" (should be case insensitive). 4. The user should enter a single name and the program will search the name in both lists. The user SHOULD NOT specify whether the search is for girls name or boys name. The program is responsible for finding either or both and telling the user where it found it. 5.…arrow_forwardWould it be possible to use unique, shared or weak pointers in the code?arrow_forwardThe destination of a function's return value may be represented as a sequence of instructions. When making modifications to the stack, keep in mind that they must not prevent the method from returning to its caller.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education