ARM assembly language to convert integer, 1194684 to hexadecimal. The signature
ID: 3685802 • Letter: A
Question
ARM assembly language to convert integer, 1194684 to hexadecimal.
The signature of the routine is char*int2hex(int convert) where:
int convert = 1194684;
The output must be in the format 0Xdddddddd
I need the ARM Assembly Language NOT the C-code.
The C program is:
#include <stdlib.h>
#include <stdio.h>
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 ) ;
}
Explanation / Answer
.Ltext0: .cfi_sections .debug_frame .section .rodata .align 2 .LC0: 0000 496E7465 .ascii "Integer to hex string: %s
" 67657220 746F2068 65782073 7472696E 001b 00 .text .align 2 .global main main: .fnstart .LFB2: .cfi_startproc @ args = 0, pretend = 0, frame = 16 @ frame_needed = 1, uses_anonymous_args = 0 0000 00482DE9 stmfd sp!, {fp, lr} .save {fp, lr} .cfi_def_cfa_offset 8 .cfi_offset 11, -8 .cfi_offset 14, -4 .setfp fp, sp, #4 0004 04B08DE2 add fp, sp, #4 .cfi_def_cfa 11, 4 .pad #16 0008 10D04DE2 sub sp, sp, #16 000c 10000BE5 str r0, [fp, #-16] 0010 14100BE5 str r1, [fp, #-20] 0014 2C309FE5 ldr r3, .L3 0018 0C300BE5 str r3, [fp, #-12] 001c 0C001BE5 ldr r0, [fp, #-12] 0020 FEFFFFEB bl _Z7int2hexi 0024 0030A0E1 mov r3, r0 0028 08300BE5 str r3, [fp, #-8] 002c 08101BE5 ldr r1, [fp, #-8] 0030 14009FE5 ldr r0, .L3+4 0034 FEFFFFEB bl printf 0038 0030A0E3 mov r3, #0 003c 0300A0E1 mov r0, r3 0040 04D04BE2 sub sp, fp, #4 .cfi_def_cfa 13, 8 @ sp needed 0044 0088BDE8 ldmfd sp!, {fp, pc} .L4: .align 2 .L3: 0048 BC3A1200 .word 1194684 004c 00000000 .word .LC0 .cfi_endproc .LFE2: .fnend .Letext0: