Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use ARM assembly language. Write a simple program, complete with all dire

ID: 3677268 • Letter: P

Question

Please use ARM assembly language.

Write a simple program, complete with all directives, that includes the table of numbers below and searches for the value "0x13" in the table. Assume that the table maybe changed and the position of the number will change or the number searched for will change. Your routine should be able to find the number no matter where it is in the table without having to rewrite the program. You do not need to do any startup routine. Assume the program will be branched to from the startup routine. The program should end with "STOP B STOP". TABLE 0x01, 0x03, 0x04, 0x06, 0x07, 0x09, 0 x0B 0x0D, 0x0F, 0x10, 0x13, 0x15, 0x17, 0x20

Explanation / Answer

STOP B STOP

// the C version of the R assembly code

//#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
//#include <string.h>
// #include <conio.h>

// search for an hexadecimal number in a table of numbers


int main()
{
unsigned char test = 0x45;
printf("%02X", test);
test = 0x01;
printf("%02X", test);
test = 0x03;
printf("%02X", test);
test = 0x01;
printf("%02X", test);
test = 0x07;
printf("%02X", test);
test = 0x0B;
printf("%02X", test);
test = 0x0F;
printf("%02X", test);

unsigned char TABLE[14] = {0x01, 0x03, 0x04, 0x06, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x10, 0x13, 0x15, 0x17, 0x20};
int i, srch;
printf(" Table contents: ");
for (i=0; i < 14; i++)
   printf("%02X    ,    ", TABLE[i]);
printf ("Enter search value:");
scanf ("%d", &srch);
for (i=0; i < 14; i++)
   if ( TABLE[i] == srch )
       printf("The searched numberfound at location %d" , i );


printf("%02X", TABLE[0]);
printf("%02X", TABLE[1]);
printf("%02X", TABLE[2]);


printf(" STOP B STOP ");

return 0; // exit
} // end of main()