I/Oレジスタ

GBAはメモリを読み書きする感覚でI/Oポートを操作することが可能です。アドレスは0x4000000から順次並んでいて、機能の順番としては「液晶ディスプレイ、サウンド、DMA(データ転送)、タイマー、SIO1(外部入出力)、キー入力、SIO2、その他」となっています。I/Oの意味を知ってしまえばGBAに何ができて、何が出来ないのかを理解したも当然です。1つ1つのビットの意味はGBATEKを参照してみることが大事になります。ただGBATEKは日本語の広辞苑というのか、辞書みたいなものなので頭から読むものではありません。必要になった時に部分的に参照します。もしGBATEKが難しいと感じるようならばこのWikiのチュートリアルを一通りやれば自然と読み解く方法が身につくと思います。

エミュレータは「Tools -> IO Viewer」で参照可能です。リアルタイムで変更できたりします。

1.png
I/O Map

Forward
The base address for GBA I/O ports is 04000000h - 
all address below are actually meant to be locat ed at 04000NNNh in memory rather than at NNNh.
LCD I/O Registers

000h       R/W  DISPCNT   LCD Control
002h       R/W  -         Undocumented - Green Swap
004h       R/W  DISPSTAT  General LCD Status (STAT,LYC)
006h       R    VCOUNT    Vertical Counter (LY)
008h       R/W  BG0CNT    BG0 Control
00Ah       R/W  BG1CNT    BG1 Control
00Ch       R/W  BG2CNT    BG2 Control
00Eh       R/W  BG3CNT    BG3 Control
010h       W    BG0HOFS   BG0 X-Offset
012h       W    BG0VOFS   BG0 Y-Offset
014h       W    BG1HOFS   BG1 X-Offset
016h       W    BG1VOFS   BG1 Y-Offset
018h       W    BG2HOFS   BG2 X-Offset
01Ah       W    BG2VOFS   BG2 Y-Offset
01Ch       W    BG3HOFS   BG3 X-Offset
01Eh       W    BG3VOFS   BG3 Y-Offset
020h       W    BG2PA     BG2 Rotation/Scaling Parameter A (dx)
022h       W    BG2PB     BG2 Rotation/Scaling Parameter B (dmx)
024h       W    BG2PC     BG2 Rotation/Scaling Parameter C (dy)
026h       W    BG2PD     BG2 Rotation/Scaling Parameter D (dmy)
028h-02Ah  W    BG2X      BG2 Reference Point X-Coordinate
02Ch-02Eh  W    BG2Y      BG2 Reference Point Y-Coordinate
030h       W    BG3PA     BG3 Rotation/Scaling Parameter A (dx)
032h       W    BG3PB     BG3 Rotation/Scaling Parameter B (dmx)
034h       W    BG3PC     BG3 Rotation/Scaling Parameter C (dy)
036h       W    BG3PD     BG3 Rotation/Scaling Parameter D (dmy)
038h-03Ah  W    BG3X      BG3 Reference Point X-Coordinate
03Ch-03Eh  W    BG3Y      BG3 Reference Point Y-Coordinate
040h       W    WIN0H     Window 0 Horizontal Dimensions
042h       W    WIN1H     Window 1 Horizontal Dimensions
044h       W    WIN0V     Window 0 Vertical Dimensions
046h       W    WIN1V     Window 1 Vertical Dimensions
048h       R/W  WININ     Control Inside of Window(s)
04Ah       R/W  WINOUT    Control Outside of Windows & Inside of OBJ Window
04Ch       W    MOSAIC    Mosaic Size
04Eh       -    -         Not used
050h       R/W  BLDCNT    Color Special Effects Selection   (formerly BLDMOD)
052h       W    BLDALPHA  Alpha Blending Coefficients        (formerly COLEV)
054h       W    BLDY      Brightness (Fade-In/Out) Coefficient(formerly COLY)
056h-05Eh  -    -         Not used
Sound Registers

060h     R/W  SOUND1CNT_L Channel 1 Sweep register       (SG10_L)(NR10)
062h     R/W  SOUND1CNT_H Channel 1 Duty/Length/Envelope (SG10_H)(NR11, NR12)
064h     R/W  SOUND1CNT_X Channel 1 Frequency/Control    (SG11)  (NR13, NR14)
066h     -    -           Not used                        -
068h     R/W  SOUND2CNT_L Channel 2 Duty/Length/Envelope (SG20)  (NR21, NR22)
06Ah     -    -           Not used                        -
06Ch     R/W  SOUND2CNT_H Channel 2 Frequency/Control    (SG21)  (NR23, NR24)
06Eh     -    -           Not used                        -
070h     R/W  SOUND3CNT_L Channel 3 Stop/Wave RAM select (SG30_L)(NR30)
072h     R/W  SOUND3CNT_H Channel 3 Length/Volume        (SG30_H)(NR31, NR32)
074h     R/W  SOUND3CNT_X Channel 3 Frequency/Control    (SG31)  (NR33, NR34)
076h     -    -           Not used                        -
078h     R/W  SOUND4CNT_L Channel 4 Length/Envelope      (SG40)  (NR41, NR42)
07Ah     -    -           Not used                        -
07Ch     R/W  SOUND4CNT_H Channel 4 Frequency/Control    (SG41)  (NR43, NR44)
07Eh     -    -           Not used                        -
080h     R/W  SOUNDCNT_L  Control Stereo/Volume/Enable (SGCNT0_L)(NR50, NR51)
082h     R/W  SOUNDCNT_H  Control Mixing/DMA Control   (SGCNT0_H)
084h     R/W  SOUNDCNT_X  Control Sound on/off         (SGCNT1)  (NR52)
086h     -    -           Not used
088h     BIOS SOUNDBIAS   Sound PWM Control            (SG_BIAS)
08Ah-08Eh  -    -         Not used
090h-09Eh  R/W  WAVE_RAM  Channel 3 Wave Pattern RAM (2 banks!!) (SGWR)
0A0h-0A2h  W    FIFO_A    Channel A FIFO, Data 0-3 (SGFIFOA)
0A4h-0A6h  W    FIFO_B    Channel B FIFO, Data 0-3 (SGFIFOB)
0A8h-0AEh  -    -         Not used
DMA Transfer Channels

0B0h-0B2h  W    DMA0SAD   DMA 0 Source Address
0B4h-0B6h  W    DMA0DAD   DMA 0 Destination Address
0B8h       W    DMA0CNT_L DMA 0 Word Count
0BAh       R/W  DMA0CNT_H DMA 0 Control
0BCh-0BEh  W    DMA1SAD   DMA 1 Source Address
0C0h-0C2h  W    DMA1DAD   DMA 1 Destination Address
0C4h       W    DMA1CNT_L DMA 1 Word Count
0C6h       R/W  DMA1CNT_H DMA 1 Control
0C8h-0CAh  W    DMA2SAD   DMA 2 Source Address
0CCh-0CEh  W    DMA2DAD   DMA 2 Destination Address
0D0h       W    DMA2CNT_L DMA 2 Word Count
0D2h       R/W  DMA2CNT_H DMA 2 Control
0D4h-0D6h  W    DMA3SAD   DMA 3 Source Address
0D8h-0DAh  W    DMA3DAD   DMA 3 Destination Address
0DCh       W    DMA3CNT_L DMA 3 Word Count
0DEh       R/W  DMA3CNT_H DMA 3 Control
0E0h-0FEh  -    -         Not used
Timer Registers

100h       R/W  TM0CNT_L  Timer 0 Counter/Reload (formerly TM0D)
102h       R/W  TM0CNT_H  Timer 0 Control        (formerly TM0CNT)
104h       R/W  TM1CNT_L  Timer 1 Counter/Reload (formerly TM1D)
106h       R/W  TM1CNT_H  Timer 1 Control        (formerly TM1CNT)
108h       R/W  TM2CNT_L  Timer 2 Counter/Reload (formerly TM2D)
10Ah       R/W  TM2CNT_H  Timer 2 Control        (formerly TM2CNT)
10Ch       R/W  TM3CNT_L  Timer 3 Counter/Reload (formerly TM3D)
10Eh       R/W  TM3CNT_H  Timer 3 Control        (formerly TM3CNT)
110h-11Eh  -    -         Not used
Serial Communication (1)

120h-122h  R/W  SIODATA32 SIO Data (Normal-32bit Mode) (shared with below!)
120h       R/W  SIOMULTI0 SIO Data 0 (Parent)    (Multi-Player Mode) (SCD0)
122h       R/W  SIOMULTI1 SIO Data 1 (1st Child) (Multi-Player Mode) (SCD1)
124h       R/W  SIOMULTI2 SIO Data 2 (2nd Child) (Multi-Player Mode) (SCD2)
126h       R/W  SIOMULTI3 SIO Data 3 (3rd Child) (Multi-Player Mode) (SCD3)
128h       R/W  SIOCNT    SIO Control Register                    (SCCNT_L)
12Ah       R/W  SIOMLT_SEND SIO Data (Local of Multi-Player) (shared below)
12Ah       R/W  SIODATA8  SIO Data (Normal-8bit and UART Mode)    (SCCNT_H)
12Ch-12Eh  -    -         Not used
Keypad Input

130h       R    KEYINPUT  Key Status            (formerly P1)
132h       R/W  KEYCNT    Key Interrupt Control (formerly P1CNT)
Serial Communication (2)

134h       R/W  RCNT      SIO Mode Select/General Purpose Data (formerly R)
136h       -    IR        Ancient - Infrared Register (Prototypes only)
138h-13Eh  -    -         Not used
140h       R/W  JOYCNT    SIO JOY Bus Control         (formerly HS_CTRL)
142h-14Eh  -    -         Not used
150h-152h  R/W  JOY_RECV  SIO JOY Bus Receive Data    (formerly JOYRE)
154h-156h  R/W  JOY_TRANS SIO JOY Bus Transmit Data   (formerly JOYTR)
158h       R/?  JOYSTAT   SIO JOY Bus Receive Status  (formerly JSTAT)
15Ah-1FEh  -    -         Not used
Interrupt, Waitstate, and Power-Down Control

200h       R/W  IE        Interrupt Enable Register
202h       R/W  IF        Interrupt Request Flags / IRQ Acknowledge
204h       R/W  WAITCNT   Game Pak Waitstate Control (formerly WSCNT)
206h       -    -         Not used
208h       R/W  IME       Interrupt Master Enable Register
20Ah-2FFh  -    -         Not used
300h       R/W  HALTCNT   Undocumented - Power Down Control
302h-40Fh  -    -         Not used
410h       ?    ?         Undocumented - Purpose Unknown ??? 0FFh
411h-7FFh  -    -         Not used
800h-802h  R/W  ?         Undocumented - Internal Memory Control (R/W)
804h-FFFFh -    -         Not used

履歴


トップ   一覧 検索 最終更新   ヘルプ   最終更新のRSS