Programming Lab #2 Functions and Parameters solved

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (6 votes)

Create an assembly language source code file containing six functions. If the functions were
written in C, they would look like the following:
uint32_t Ten32(void)
{
return 10 ;
}
uint64_t Ten64(void)
{
return (uint64_t) 10 ;
}
uint32_t Incr(uint32_t n)
{
return n + 1 ;
}
uint32_t Nested1(void)
{
return rand() + 1 ;
}
uint32_t Nested2(void)
{
return rand() + rand() ;
}
void PrintTwo(char *format,
uint32_t n)
{
printf(format, n) ;
printf(format, n + 1) ;
}
Test your functions using the main program downloaded
from here. If you code works correctly, the display
should look like this image (although the numbers are
likely to be different). Incorrect values will be displayed
using white text on a red background.
IMPORTANT – The .thumb_func directive:
The “.thumb_func” assembler directive specifies
that the next label is the entry point of a function that
contains instructions from the Thumb subset of the
ARM processor and causes the binary representation
of instructions that branch to that label to be generated
somewhat differently. Thus in a source code file that
contains more than one function, it is imperative that
you place a .thumb_func directive immediately before the entry point label of every function.