Question: /* The following code is for NASM Assembly language. I have attached the assignment Please post working code: Thanks, segment .data num1 db 4 num2

/* The following code is for NASM Assembly language. I have attached the assignment /* The following code is for NASM Assembly language. I have attached

Please post working code:

Thanks, segment .data num1 db 4 num2 db 4

button db 2 segment .bss

segment .text global asm_main

asm_main: push ebp mov ebp, esp

; ********** CODE STARTS HERE **********

start:

call read_int mov num1, eax

call read_char mov button, eax

call read_int mov num2, eax

cmp button, '+' JE addition

cmp button, '-' JE subtraction

cmp button, '*' JE multiplication

cmp button, '/' JE division

cmp button, '%' JE modulus

addition: JMP start subtraction: JMP start multiplication: JMP start division: JMP start modulus: JMP start

stop:

; *********** CODE ENDS HERE *********** mov eax, 0 mov esp, ebp pop ebp ret

Assignment: Calculator Description: Write a calculator program in assembly. It should handle the following functions: addition (+), subtraction (-), multiplication (*), integer division (), modulo division (%), and exponentiation(. Your program should 1. Read an integer from the user 2. Read a character from the user, representing the function. (+,-, *J, % 3. Read another integer from the user 4. Print an equals sign () 5. Print the result Plcase comment your code, and format it so that it looks clean! (examples on next page) Output Examples: andrew@dev:/calculator$ ./calculator 17 - This is input - This is input - This is input -This is output - This is output 28 andrew@de/calculator$ ./calculator 25 74 andrew@dev:/calculator$ ./calculator 10 110 andrew@dev: /calculator$ ./calculator 67 andrew@dev:/calculator$./calculator 67 andrew@dev:/calculator$ ./calculator 64 Assignment: Calculator Description: Write a calculator program in assembly. It should handle the following functions: addition (+), subtraction (-), multiplication (*), integer division (), modulo division (%), and exponentiation(. Your program should 1. Read an integer from the user 2. Read a character from the user, representing the function. (+,-, *J, % 3. Read another integer from the user 4. Print an equals sign () 5. Print the result Plcase comment your code, and format it so that it looks clean! (examples on next page) Output Examples: andrew@dev:/calculator$ ./calculator 17 - This is input - This is input - This is input -This is output - This is output 28 andrew@de/calculator$ ./calculator 25 74 andrew@dev:/calculator$ ./calculator 10 110 andrew@dev: /calculator$ ./calculator 67 andrew@dev:/calculator$./calculator 67 andrew@dev:/calculator$ ./calculator 64

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!