Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an ARM assembly language which accepts an integer and returns a string which is the hexadecimal representation of the integer. The signature of the

Write an ARM assembly language which accepts an integer and returns a string which is the hexadecimal representation of the integer.

The signature of the routine is: char * int2hex( int conv ) ;

The input is a 32 bit integer. The output is a pointer to a character string of the format 0Xdddddddd. Do not suppress leading zeroes.

The C program is:

#include #include

extern char * int2hex( int convert ) ;

int main( int argc, char * argv[] ) { int convert = 1194684 ; char * result ; result = int2hex( convert ) ; printf( "Integer to hex string: %s ", result ) ; }

A string in C is terminated by a null byte (a byte of zero). You will need to use the shift instructions. You need to separate the integer into 4 bit sections each representing the individual hex digits. These need to be turned into printable characters. You need to adjust the resulting values for the digits A-F. Use the strb instruction and an auto increment of 1 since you are storing bytes into memory. Use the malloc library routine to obtain space for the character string (11 bytes: 2 for 0x, 8 for the hex digits, and one for the null byte).

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago