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

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!