I'm doing a high school course about computer fundamentals and I'm trying to understand assembly code and created a hello world in C and compiled it in assembly code. I understand that "mov r0,r3" moves data from register 3 to register 0. However, how do I figure out what what the value of r3 is?
Below is the assembly code that I'm using for my understanding from:
.arch armv6
.eabi_attribute 27, 3
.eabi_attribute 28, 1
.fpu vfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 6
.eabi_attribute 34, 1
.eabi_attribute 18, 4
.file "hello.c"
.section .rodata
.align 2
.LC0:
.ascii "Hello World\000"
.text
.align 2
.global main
.type main, %function
main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
stmfd sp!, {fp, lr}
add fp, sp, #4
ldr r0, .L2
bl printf
mov r0, r3
ldmfd sp!, {fp, pc}
.L3:
.align 2
.L2:
.word .LC0
.size main, .-main
.ident "GCC: (Raspbian 4.9.2-10) 4.9.2"
.section .note.GNU-stack,"",%progbits
Below is my C code:
// Hello World program in C
#include<stdio.h>
main()
{
printf("Hello World");
}