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

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

Next

セグメント
Segments

コード、データと変数のためのセグメントの使用はアセンブラにおいてより顕著です。 lccは多くのデフォルトセグメント-コード、静的データと変数を中へそれぞれ格納するための_CODE、_DATAと_BSS-を定義します。 2の余分なセグメント_HEADERと_HEAPは、GBヘッダとmallocヒープのためにそれぞれ存在します。 順序、これらのセグメントはともにリンクされます、crt0.sによって決定され、次に、現在_CODEである、ROMと_BSSの中の_DATA、その後RAMの中の_HEAP。 予備のメモリがすべてmallocルーチンに利用可能なように、_HEAPは_BSSの後に置かれます。 置くために、最初の2つのバンク以外のものの中でコード化する、xが16kbのバンク番号である場合、セグメント_CODE_xを使用します。
The use of segments for code, data and variables is more noticeable in assembler.lcc defines a number of default segments - _CODE, _DATA and _BSS for storing code, static data and variables in respectively.Two extra segments _HEADER and _HEAP exist for the GB header and malloc heap respectively.The order these segments are linked together is determined by crt0.s and is currently _CODE then _DATA in ROM and _BSS then _HEAP in RAM._HEAP is placed after _BSS so that all spare memory is available for the malloc routines.To place code in other than the first two banks, use the segments _CODE_x where x is the 16kB bank number.

_BSSセグメントがROMエリアの外部で生じるとともに、その中のスペースを節約するために.dsを単に使用できます。
As the _BSS segment occurs outside the ROM area you can only use .ds to reserve space in it.

アセンブラ中で_CODEと_DATAの区別を使用する必要がない一方、それはconsistancys目的に推薦されます。
While you don't have to use the _CODE and _DATA distinctions in assembler it is recommended for consistancys sake.



Prev
ホーム
Home

Next
変数とレジスタ
Variables and registers

Up
ライブラリ
Libraries
 1