Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* 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 image text in transcribed

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

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

Step: 3

blur-text-image

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago

Question

Draw and explain the operation of LVDT for pressure measurement

Answered: 1 week ago

Question

3. What are potential solutions?

Answered: 1 week ago