Asembly & C

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Asembly & C

1,968件の閲覧回数
Franky_TJ_
Contributor I
i've been told that there some things that could go wrong when mixing asembly and C. I'm usign CW and i created a function that has 3 input parameters and no return value but the entire body is assembly. And one problem that i'm worried about is that before code generated by the compiller adds a PSH before i use any of the paraneters...My question is  . Is this the reason that my function works some of the time but runs into  trouble when call it consecutivle?... and if so is there any document that could help me on how to succesfully mix ASM & C in CodeWarrior
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

700件の閲覧回数
CrasyCat
Specialist III
Hello
As far as I could check the file you attached to this post contains an ANSI C function containing only inline assembly code.
So basically you are invoking an ANSI C function from an ANSI C module.
 
So parameter passing will be done appropriately and there should be no problem.
The PSH you are seeing at the beginning of the function is some entry code added by the compiler. There is probably a corresponding POP instruction at the end of the function.
 
CrayCat
0 件の賞賛
返信

700件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
The push is done to put the register parameter on the stack, where the assembly code
is reading it later. So it is necessary for the current assembly code. If you want full control, you can disable all the compiler stuff with some #pragmas, but then you have to follow the compiler calling convention on your own, this way the compiler takes care of that.
Daniel
0 件の賞賛
返信

700件の閲覧回数
Franky_TJ_
Contributor I
thanks for the replys..Cat and Guru... I guess i wont mess with that part i'll try to see what  i'm do wrong on other parts of the proyect .. tahnks again
0 件の賞賛
返信