GBDKライブラリドキュメント
GBDK libraries documentation

Prev
4章 アセンブリ言語
Chapter 4.Assembly language

Next

呼び出し協定
Calling convention

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:

最初にプッシュされる引数が、GBのスタックがどのようにして下方へ成長するかにより、スタックにおいて最も高いことに注意してください。
Note that the arguments that are pushed first are highest in the stack due to how the GB's stack grows downwards.

関数は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
 1