GBDKライブラリドキュメント
GBDK libraries documentation |
||
---|---|---|
前
Prev |
4章
アセンブリ言語
Chapter 4.Assembly language |
次
Next |
lccは、ほぼすべてのCコンパイラと共通に、任意の関数名へ'_'をprependsします。
例えば、関数printf(...)はラベル_printf::で始まります。
関数がすべてグローバル宣言されることに注意してください。
lcc in common with almost all C compilers prepends a '_' to any function names.For example the function printf(...) begins at the label _printf::.Note that all functions are declared global.
関数への引数は、アラインなしで右から左にプッシュされます - したがって、1バイトはより自然なワードの代わりにスタック上で1バイトを持ち上げます。
したがって、例えば関数int store_byte( UWORD addr, UBYTE byte)は最初に「byte」を、次にaddrをスタックにプッシュして、合計3バイトを使用します。
戻りアドレスがさらプッシュされるとともに、スタックは次のものを含みます:
The parameters to a function are pushed in right to left order with no aligning - so a byte takes up a byte on the stack instead of the more natural word.So for example the function int store_byte( UWORD addr, UBYTE byte) would push 'byte' onto the stack first then addr using a total of three bytes.As the return address is also pushed, the stack would contain:
SP+0 - 戻りアドレス
At SP+0 - the return address
SP+2 - addr
At SP+2 - addr
SP+4 - byte
At SP+4 - byte
関数はDEで返ります。
浮動小数ががどう返されるか確かではありません。
The function returns in DE.I'm not sure how a FP number is returned.
前
Prev |
ホーム
Home |
次
Next |
アセンブリ言語
Assembly language |
上
Up |
変数とレジスタ
Variables and registers |