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

Prev
2章 ターゲットとしてのGameboy
Chapter 2.The Gameboy as a Target

Next

グローバル変数の使用
Using global variables

関数のローカル変数はスタック上に格納されます、使用する度に変数の絶対アドレスを計算することをコンパイラに要求します。 グローバルとして変数を宣言することで、ほとんどの場合コードをより効率的にするRAM中のアドレスで静的に割り付けられるようになります。
The local variables of a function are stored on the stack, requiring the compiler to calculate a variables absolute address every time its used.By declaring a variable as global it becomes statically allocated at an address in ram which in most cases makes the code more efficient.

グローバル変数がなお悪いことを忘れない でください - しかしこの場合、それらを使用するのにより効率的。
Don't forget that global variables are still bad - but in this case its more efficient to use them.

グローバル変数は、大きな構造体に特に適しています。 スタック上のデータにアクセスする最も容易な方法は、xが符号付きバイトである場合lda hl,x(sp)です。 ローカル変数のサイズがそのとき著しく127バイト以上(符号付きバイトの上限)である場合、より遅いコードが使用されます。
Globals are especially good for large structures.The easiest way to access data on the stack is with the lda hl,x(sp) where x is a signed byte.If the size of the local variables is greater than 127 bytes (the upper limit of a signed byte) then significantly slower code is used.



Prev
ホーム
Home

Next
促進の回避
Avoiding Promotion

Up
その他
Other
 1