Question
Write an assembly program that will verify whether the given integer variable, A, is odd or even. Allocate space in memory to store the result
Write an assembly program that will verify whether the given integer variable, A, is odd or even. Allocate space in memory to store the result (char array) which can be Odd/Even. If the number is even, write Even otherwise write Odd. Assume that A = 20 and address of result is 0x1000. Then the correct results for testing purpose are shown below:
Mem[0x1000] = E
Mem[0x1001] = v
Mem[0x1002] = e
Mem[0x1003] = n
Hint: In assembly, variables can be initialized as shown below (by default memory is allocated in flash, which is read only): General format: Label: datatype value Examples: varA: .int 20 ; same as const int varA = 20 in C arr: .cstring Hello ; same as const char arr[] = Hello in C Note: By default, variables are declared in .text segment (or code segment) which is readonly. But .data segment is readable and writable and hence to be able to update the variables, declare them in .data segment as shown below: .data varA: .int 20 ; same as int varA = 20 in C arr: .cstring Hello ; same as char arr[] = Hello in C
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started