assembly - possible for a procedure to have an argument? -
i wondering in assembly possible have procedure uses argument? i'm new assembly , not sure if possibility. great if case since stream line code.
your question if possible:
call my_function, arg1, arg2
if question you didn't understand concepts of assembler , functionality of cpu, yet:
in assembler code 1 assembler instruction typically equals 1 cpu instruction. cpus not have concept of function arguments @ all. function arguments concept of higher-level programming languages.
a higher-level programming language must "translate" concept of function arguments register operations. on arm cpus illustration mutual pass first 4 arguments of function in registers r0-r3.
the next c code...
myfunction(6,7,8,9);
... in assembler:
ldr r0, =6 # load 6 register r0 ldr r1, =7 # load 7 register r1 ldr r2, =8 # load 8 register r2 ldr r3, =9 # load 9 register r3 bl myfunction # phone call myfunction()
on x86 cpus bit more complicated because there multiple so-called calling conventions means way arguments passed function differ function function.
assembly
No comments:
Post a Comment