Commit d2524393 authored by Aaron Erhardt's avatar Aaron Erhardt
Browse files

Improve code formatting


Signed-off-by: default avatarAaron Erhardt <aaron.erhardt@t-online.de>
parent f3ee3cbe
Pipeline #545 passed with stage
in 1 minute and 54 seconds
......@@ -190,7 +190,7 @@ label
```asm
main
ldr r0, =1 ; initialize parameters
ldr r0, =1 ; initialize parameters
ldr r1, =2
bl add_nums ; run subroutine
; r2 can now be used as returned value
......@@ -210,24 +210,25 @@ main
ldr r8, =2
; prepare parameters and return values
push {r7} ; parameter 1
push {r8} ; parameter 2
push {r9} ; return value 1
push {r7} ; parameter 1
push {r8} ; parameter 2
push {r9} ; return value 1
bl add_nums ; run subroutine
pop {r9} ; get return value from the stack
pop {r8} ; free stack space again
pop {r7} ; free stack space again
pop {r9} ; get return value from the stack
pop {r8} ; free stack space again
pop {r7} ; free stack space again
add_nums
push {lr, r0-r2} ; increments stack pointer by 4 * (amount of registers)!
; increments stack pointer by 4 * (amount of registers)!
push {lr, r0-r2}
; load parameters into registers
ldr r0, [sp, #4*6] ; 4*4 + 4*2 -> r7 (was pushed first, highest address)
; load parameters into registers
ldr r0, [sp, #4*6] ; 4*4 + 4*2 -> r7 (pushed first -> highest address)
ldr r1, [sp, #4*5] ; 4*4 + 4*1 -> r8
add r2, r0, r1 ; perform actual calculation
add r2, r0, r1 ; perform actual calculation
; store return values on reserved the stack space
str r2, [sp, #4*4] ; 4*4 + 4*0 -> r9
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment