Overview Technical Data Memory Map I/O Map Hardware Programming LCD Video Controller Sound Controller Timers DMA Transfers Communication Ports Keypad Input Interrupt Control System Control Other Cartridges BIOS Functions Unpredictable Things External Connectors |
General ARM7TDMI Information CPU Overview CPU Register Set CPU Flags CPU Exceptions The ARM7TDMI Instruction Sets THUMB Instruction Set ARM Instruction Set Pseudo Instructions and Directives Further Information CPU Instruction Cycle Times CPU Data Sheet About GBATEK About this Document |
| Technical Data |
ARM Mode ARM7TDMI 32bit RISC CPU, 16.78MHz, 32bit opcodes (GBA) THUMB Mode ARM7TDMI 32bit RISC CPU, 16.78MHz, 16bit opcodes (GBA) CGB Mode Z80/8080-style 8bit CPU, 4.2MHz or 8.4MHz (CGB compatibility) DMG Mode Z80/8080-style 8bit CPU, 4.2MHz (monochrome gameboy compatib.) |
BIOS ROM 16 KBytes Work RAM 288 KBytes (32K in-chip + 256K on-board) VRAM 96 KBytes OAM 1 KByte (128 OBJs 3x16bit, 32 OBJ-Rotation/Scalings 4x16bit) Palette RAM 1 KByte (256 BG colors, 256 OBJ colors) |
Display 240x160 pixels (2.9 inch TFT color LCD display) BG layers 4 background layers BG types Tile/map based, or Bitmap based BG colors 256 colors, or 16 colors/16 palettes, or 32768 colors OBJ colors 256 colors, or 16 colors/16 palettes Effects Rotation/Scaling, alpha blending, fade-in/out, mosaic, window OBJ size 12 types (in range 8x8 up to 64x64 dots) OBJs/Screen max. 128 OBJs of any size (up to 64x64 dots each) OBJs/Line max. 128 OBJs of 8x8 dots size (under best circumstances) Priorities OBJ/OBJ: 0-127, OBJ/BG: 0-3, BG/BG: 0-3 Effects Rotation/Scaling, alpha blending, fade-in/out, mosaic, window |
Analogue 4 channel CGB compatible Digital 2 DMA sound channels Output Built-in speaker, or stereo headphones |
Gamepad 4 Direction Keys, 6 Buttons |
Serial Port Various transfer modes, 4-Player Link, Single Game Pak play |
GBA Game Pak max. 32MB ROM or flash ROM + max 64K SRAM CGB Game Pak max. 32KB ROM + 8KB SRAM (more memory requires banking) |
Battery Life-time approx. 15 hours External 3.3V DC (works with somewhat 2.7V-3.3V, or maybe a bit more) |
| Memory Map |
0000:0000-0000:3FFF BIOS - System ROM (16 KBytes) 0000:4000-01FF:FFFF Not used 0200:0000-0203:FFFF WRAM - On-board Work RAM (256 KBytes) 2 Wait 0204:0000-02FF:FFFF Not used 0300:0000-0300:7FFF WRAM - In-chip Work RAM (32 KBytes) 0300:8000-03FF:FFFF Not used 0400:0000-0400:03FE I/O Registers 0400:0400-04FF:FFFF Not used |
0500:0000-0500:03FF BG/OBJ Palette RAM (1 Kbyte) 0500:0400-05FF:FFFF Not used 0600:0000-0617:FFFF VRAM - Video RAM (96 KBytes) 0618:0000-06FF:FFFF Not used 0700:0000-0700:03FF OAM - OBJ Attributes (1 Kbyte) 0700:0400-07FF:FFFF Not used |
0800:0000-09FF:FFFF Game Pak ROM/FlashROM (max 32MB) - Wait State 0 0A00:0000-0BFF:FFFF Game Pak ROM/FlashROM (max 32MB) - Wait State 1 0C00:0000-0DFF:FFFF Game Pak ROM/FlashROM (max 32MB) - Wait State 2 0E00:0000-0E00:FFFF Game Pak SRAM (max 64 KBytes) - 8bit Bus width 0E01:0000-0FFF:FFFF Not used |
1000:0000-FFFF:FFFF Not used (upper 4bits of address bus unused) |
Region Bus Read Write Cycles BIOS ROM 32 8/16/32 - 1/1/1 Work RAM 32K 32 8/16/32 8/16/32 1/1/1 I/O 32 8/16/32 8/16/32 1/1/1 OAM 32 8/16/32 16/32 1/1/1 * Work RAM 256K 16 8/16/32 8/16/32 3/3/6 ** Palette RAM 16 8/16/32 16/32 1/1/2 * VRAM 16 8/16/32 16/32 1/1/2 * GamePak ROM 16 8/16/32 - 5/5/8 **/*** GamePak Flash 16 8/16/32 16/32 5/5/8 **/*** GamePak SRAM 8 8 8 5 ** |
* Plus 1 cycle if GBA accesses video memory at the same time. ** Default waitstate settings, see System Control chapter. *** Separate timings for sequential, and non-sequential accesses. One cycle equals approx. 59.59ns (ie. 16.78MHz clock). |
| I/O Map |
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 |
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 |
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 |
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 |
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 |
130h R KEYINPUT Key Status (formerly P1) 132h R/W KEYCNT Key Interrupt Control (formerly P1CNT) |
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 |
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 |
| LCD Video Controller |
| LCD I/O Display Control |
Bit Expl. 0-2 BG Mode (0-5=Video Mode 0-5, 6-7=Prohibited) 3 Reserved for BIOS (CGB Mode - cannot be changed after startup) 4 Display Frame Select (0-1=Frame 0-1) (for BG Modes 4,5 only) 5 H-Blank Interval Free (1=Allow access to OAM during H-Blank) 6 OBJ Character VRAM Mapping (0=Two dimensional, 1=One dimensional) 7 Forced Blank (1=Allow access to VRAM,Palette,OAM) 8 Screen Display BG0 (0=Off, 1=On) 9 Screen Display BG1 (0=Off, 1=On) 10 Screen Display BG2 (0=Off, 1=On) 11 Screen Display BG3 (0=Off, 1=On) 12 Screen Display OBJ (0=Off, 1=On) 13 Window 0 Display Flag (0=Off, 1=On) 14 Window 1 Display Flag (0=Off, 1=On) 15 OBJ Window Display Flag (0=Off, 1=On) |
Mode Rot/Scal Layers Size Tiles Colors Features 0 No 0123 256x256..512x515 1024 16/16..256/1 SFMABP 1 Mixed 012- (BG0,BG1 as above Mode 0, BG2 as below Mode 2) 2 Yes --23 128x128..1024x1024 256 256/1 S-MABP 3 Yes --?- 240x160 1 32768 --MABP 4 Yes --?? 240x160 2 256/1 --MABP 5 Yes --?? 160x128 2 32768 --MABP |
Bit Expl. 0 Green Swap (0=Normal, 1=Swap) 1-15 Not used |
| LCD I/O Interrupts and Status |
Bit Expl. 0 V-Blank flag (Read only) (1=VBlank) 1 H-Blank flag (Read only) (1=HBlank) 2 V-Counter flag (Read only) (1=Match) 3 V-Blank IRQ Enable (1=Enable) 4 H-Blank IRQ Enable (1=Enable) 5 V-Counter IRQ Enable (1=Enable) 6-7 Not used 8-15 V-Count Setting (0-227) |
Bit Expl. 0-7 Current scanline (0-227) 8-15 Not Used |
| LCD I/O BG Control |
Bit Expl. 0-1 BG Priority (0-3, 0=Highest) 2-3 Character Base Block (0-3, in units of 16 KBytes) (=BG Tile Data) 4-5 Not used (must be zero) 6 Mosaic (0=Disable, 1=Enable) 7 Colors/Palettes (0=16/16, 1=256/1) 8-12 Screen Base Block (0-31, in units of 2 KBytes) (=BG Map Data) 13 Display Area Overflow (0=Transparent, 1=Wraparound; BG2CNT/BG3CNT only) 14-15 Screen Size (0-3) |
Value Text Mode Rotation/Scaling Mode 0 256x256 (2K) 128x128 (256 bytes) 1 512x256 (4K) 256x256 (1K) 2 256x512 (4K) 512x512 (4K) 3 512x512 (8K) 1024x1024 (16K) |
| LCD I/O BG Scrolling |
Bit Expl. 0-8 Offset (0-511) 9-15 Not used |
| LCD I/O BG Rotation/Scaling |
Bit Expl. 0-7 Fractional portion (8 bits) 8-26 Integer portion (19 bits) 27 Sign (1 bit) 28-31 Not used |
Bit Expl. 0-7 Fractional portion (8 bits) 8-14 Integer portion (7 bits) 15 Sign (1 bit) |
Rotation Center X and Y Coordinates (x0,y0) Rotation Angle (alpha) Magnification X and Y Values (xMag,yMag) |
A = Cos (alpha) / xMag ;distance moved in direction x, same line B = Sin (alpha) / xMag ;distance moved in direction x, next line C = Sin (alpha) / yMag ;distance moved in direction y, same line D = Cos (alpha) / yMag ;distance moved in direction y, next line |
x0,y0 Rotation Center x1,y1 Old Position of a pixel (before rotation/scaling) x2,y2 New position of above pixel (after rotation scaling) A,B,C,D BG2PA-BG2PD Parameters (as calculated above) |
x2 = A(x1-x0) + B(y1-y0) + x0 y2 = C(x1-x0) + D(y1-y0) + y0 |
| LCD I/O Window Feature |
Bit Expl. 0-7 X2, Rightmost coordinate of window, plus 1 8-15 X1, Leftmost coordinate of window |
Bit Expl. 0-7 Y2, Bottom-most coordinate of window, plus 1 8-15 Y1, Top-most coordinate of window |
Bit Expl. 0-3 Window 0 BG0-BG3 Enable Bits (0=No Display, 1=Display) 4 Window 0 OBJ Enable Bit (0=No Display, 1=Display) 5 Window 0 Color Special Effect (0=Disable, 1=Enable) 6-7 Not used 8-11 Window 1 BG0-BG3 Enable Bits (0=No Display, 1=Display) 12 Window 1 OBJ Enable Bit (0=No Display, 1=Display) 13 Window 1 Color Special Effect (0=Disable, 1=Enable) 14-15 Not used |
Bit Expl. 0-3 Outside BG0-BG3 Enable Bits (0=No Display, 1=Display) 4 Outside OBJ Enable Bit (0=No Display, 1=Display) 5 Outside Color Special Effect (0=Disable, 1=Enable) 6-7 Not used 8-11 OBJ Window BG0-BG3 Enable Bits (0=No Display, 1=Display) 12 OBJ Window OBJ Enable Bit (0=No Display, 1=Display) 13 OBJ Window Color Special Effect (0=Disable, 1=Enable) 14-15 Not used |
| LCD I/O Mosaic Function |
Bit Expl. 0-3 BG Mosaic H-Size (minus 1) 4-7 BG Mosaic V-Size (minus 1) 8-11 OBJ Mosaic H-Size (minus 1) 12-15 OBJ Mosaic V-Size (minus 1) |
| LCD I/O Color Special Effects |
Bit Expl.
0 BG0 1st Target Pixel (Background 0)
1 BG1 1st Target Pixel (Background 1)
2 BG2 1st Target Pixel (Background 2)
3 BG3 1st Target Pixel (Background 3)
4 OBJ 1st Target Pixel (Top-most OBJ pixel)
5 BD 1st Target Pixel (Backdrop)
6-7 Color Special Effect (0-3, see below)
0 = None (Special effects disabled)
1 = Alpha Blending (1st+2nd Target mixed)
2 = Brightness Increase (1st Target becomes whiter)
3 = Brightness Decrease (1st Target becomes blacker)
8 BG0 2nd Target Pixel (Background 0)
9 BG1 2nd Target Pixel (Background 1)
10 BG2 2nd Target Pixel (Background 2)
11 BG3 2nd Target Pixel (Background 3)
12 OBJ 2nd Target Pixel (Top-most OBJ pixel)
13 BD 2nd Target Pixel (Backdrop)
14-15 Not used
|
Bit Expl. 0-4 EVA Coefficient (1st Target) (0..16 = 0/16..16/16, 17..31=16/16) 5-7 Not used 8-12 EVB Coefficient (2nd Target) (0..16 = 0/16..16/16, 17..31=16/16) 13-15 Not used |
I = MIN ( 31, I1st*EVA + I2nd*EVB ) |
Bit Expl. 0-4 EVY Coefficient (Brightness) (0..16 = 0/16..16/16, 17..31=16/16) 5-15 Not used |
I = I1st + (31-I1st)*EVY ;For Brightness Increase I = I1st - (I1st)*EVY ;For Brightness Decrease |
| LCD VRAM Overview |
06000000-0600FFFF 64 KBytes shared for BG Map and Tiles 06010000-06017FFF 32 KBytes OBJ Tiles |
06000000-06013FFF 80 KBytes Frame 0 buffer (only 75K actually used) 06014000-06017FFF 16 KBytes OBJ Tiles |
06000000-06009FFF 40 KBytes Frame 0 buffer (only 37.5K used in Mode 4) 0600A000-06013FFF 40 KBytes Frame 1 buffer (only 37.5K used in Mode 4) 06014000-06017FFF 16 KBytes OBJ Tiles |
| LCD VRAM Character Data |
| LCD VRAM BG Screen Data Format (BG Map) |
Bit Expl.
0-9 Tile Number (0-1023) (a bit less in 256 color mode, because
there'd be otherwise no room for the bg map)
10 Horizontal Flip (0=Normal, 1=Mirrored)
11 Vertical Flip (0=Normal, 1=Mirrored)
12-15 Palette Number (0-15) (Not used in 256 color/1 palette mode)
|
Bit Expl. 0-7 Tile Number (0-255) |
| LCD VRAM Bitmap BG Modes |
Bit Expl. 0-4 Red Intensity (0-31) 5-9 Green Intensity (0-31) 10-14 Blue Intensity (0-31) 15 Not used |
| LCD OBJ - Overview |
1210 (=304*4-6) If "H-Blank Interval Free" bit in DISPCNT register is 0 954 (=240*4-6) If "H-Blank Interval Free" bit in DISPCNT register is 1 |
Cycles per Screen Pixels OBJ Type OBJ Type Screen Pixel Range 8 cycles per 8 pixels Normal OBJs 8..64 pixels 26 cycles per 8 pixels Rotation/Scaling OBJs 8..64 pixels (area clipped) 26 cycles per 8 pixels Rotation/Scaling OBJs 16..128 pixels (double size) |
| LCD OBJ - OAM Attributes |
Bit Expl.
0-7 Y-Coordinate (0-255)
8 Rotation/Scaling Flag (0=Off, 1=On)
When Rotation/Scaling used (Attribute 0, bit 8 set):
9 Double-Size Flag (0=Normal, 1=Double)
When Rotation/Scaling not used (Attribute 0, bit 8 cleared):
9 OBJ Disable (0=Normal, 1=Not displayed)
10-11 OBJ Mode (0=Normal, 1=Semi-Transparent, 2=OBJ Window, 3=Prohibited)
12 OBJ Mosaic (0=Off, 1=On)
13 Colors/Palettes (0=16/16, 1=256/1)
14-15 OBJ Shape (0=Square,1=Horizontal,2=Vertical,3=Prohibited)
|
Bit Expl.
0-8 X-Coordinate (0-511)
When Rotation/Scaling used (Attribute 0, bit 8 set):
9-13 Rotation/Scaling Parameter Selection (0-31)
(Selects one of the 32 Rotation/Scaling Parameters that
can be defined in OAM, for details read next chapter.)
When Rotation/Scaling not used (Attribute 0, bit 8 cleared):
9-11 Not used
12 Horizontal Flip (0=Normal, 1=Mirrored)
13 Vertical Flip (0=Normal, 1=Mirrored)
14-15 OBJ Size (0..3, depends on OBJ Shape, see Attr 0)
Size Square Horizontal Vertical
0 8x8 16x8 8x16
1 16x16 32x8 8x32
2 32x32 32x16 16x32
3 64x64 64x32 32x64
|
Bit Expl. 0-9 Character Name (0-1023=Tile Number) 10-11 Priority relative to BG (0-3; 0=Highest) 12-15 Palette Number (0-15) (Not used in 256 color/1 palette mode) |
OBJ No. 0 with Priority relative to BG=1 ;hi OBJ prio, lo BG prio OBJ No. 1 with Priority relative to BG=0 ;lo OBJ prio, hi BG prio |
| LCD OBJ - OAM Rotation/Scaling Parameters |
1st Group - PA=0700:0006, PB=0700:000E, PC=0700:0016, PD=0700:001E 2nd Group - PA=0700:0026, PB=0700:002E, PC=0700:0036, PD=0700:003E etc. |
| LCD OBJ - VRAM Character (Tile) Mapping |
| LCD Color Palettes |
05000000-050001FF - BG Palette RAM (512 bytes, 256 colors) 05000200-050003FF - OBJ Palette RAM (512 bytes, 256 colors) |
Bit Expl. 0-4 Red Intensity (0-31) 5-9 Green Intensity (0-31) 10-14 Blue Intensity (0-31) 15 Not used |
| LCD Dimensions and Timings |
Visible 240 dots, 57.221 us, 960 cycles - 78% of h-time H-Blanking 68 dots, 16.212 us, 272 cycles - 22% of h-time Total 308 dots, 73.433 us, 1232 cycles - ca. 13.620 kHz |
Visible (*) 160 lines, 11.749 ms, 197120 cycles - 70% of v-time V-Blanking 68 lines, 4.994 ms, 83776 cycles - 30% of v-time Total 228 lines, 16.743 ms, 280896 cycles - ca. 59.737 Hz |
| Sound Controller |
| Sound Channel 1 - Tone & Sweep |
Bit Expl. 0-2 R/W Number of sweep shift (n=0-7) 3 R/W Sweep Frequency Direction (0=Increase, 1=Decrease) 4-6 R/W Sweep Time; units of 7.8ms (0-7, min=7.8ms, max=54.7ms) 7-15 - Not used |
X(t) = X(t-1) +/- X(t-1)/2^n |
Bit Expl. 0-5 W Sound length; units of (64-n)/256s (0-63) 6-7 R/W Wave Pattern Duty (0-3, see below) 8-10 R/W Envelope Step-Time; units of n/64s (1-7, 0=No Envelope) 11 R/W Envelope Direction (0=Decrease, 1=Increase) 12-15 R/W Initial Volume of envelope (1-15, 0=No Sound) |
0: 12.5% ( -_______-_______-_______ ) 1: 25% ( --______--______--______ ) 2: 50% ( ----____----____----____ ) (normal) 3: 75% ( ------__------__------__ ) |
Bit Expl. 0-10 W Frequency; 131072/(2048-n)Hz (0-2047) 11-13 - Not used 14 R/W Length Flag (1=Stop output when length in NR11 expires) 15 W Initial (1=Restart Sound) |
| Sound Channel 2 - Tone |
| Sound Channel 3 - Wave Output |
Bit Expl. 0-4 - Not used 5 R/W Wave RAM Bank Number (0-1, see below) 6 R/W Wave RAM Dimension (0=One bank/32 digits, 1=Two banks/64 digits) 7 R/W Sound Channel 3 Off (0=Stop, 1=Playback) 8-15 - Not used |
Bit Expl. 0-7 W Sound length; units of (256-n)/256s (0-255) 8-12 - Not used. 13-14 R/W Sound Volume (0=Mute/Zero, 1=100%, 2=50%, 3=25%) 15 R/W Force Volume (0=Use above, 1=Force 75% regardless of above) |
Bit Expl. 0-10 W Frequency; 131072/(2048-n) Hz (0-2047) 11-13 - Not used 14 R/W Length Flag (1=Stop output when length in NR31 expires) 15 W Initial (1=Restart Sound) |
| Sound Channel 4 - Noise |
Bit Expl. 0-5 W Sound length; units of (64-n)/256s (0-63) 6-7 - Not used 8-10 R/W Envelope Step-Time; units of n/64s (1-7, 0=No Envelope) 11 R/W Envelope Direction (0=Decrease, 1=Increase) 12-15 R/W Initial Volume of envelope (1-15, 0=No Sound) |
Bit Expl. 0-2 R/W Dividing Ratio of Frequencies (r) 3 R/W Counter Step/Width (0=15 bits, 1=7 bits) 4-7 R/W Shift Clock Frequency (s) 8-13 - Not used 14 R/W Length Flag (1=Stop output when length in NR41 expires) 15 W Initial (1=Restart Sound) |
| Sound Channel A and B - DMA Sound |
If Timer overflows then
Move 8bit data from FIFO to sound circuit.
If FIFO contains only 4 x 32bits (16 bytes) then
Request more data per DMA
Receive 4 x 32bit (16 bytes) per DMA
Endif
Endif
|
| Sound Control Registers |
Bit Expl. 0-2 Sound 1-4 Master volume RIGHT (0-7) 3 Not used 4-6 Sound 1-4 Master Volume LEFT (0-7) 7 Not used 8-11 Sound 1-4 Enable Flags RIGHT (each Bit 8-11, 0=Disable, 1=Enable) 12-15 Sound 1-4 Enable Flags LEFT (each Bit 12-15, 0=Disable, 1=Enable) |
Bit Expl. 0-1 Sound # 1-4 Volume (0=25%, 1=50%, 2=100%, 3=Prohibited) 2 DMA Sound A Volume (0=50%, 1=100%) 3 DMA Sound B Volume (0=50%, 1=100%) 4-7 Not used 8 DMA Sound A Enable RIGHT (0=Disable, 1=Enable) 9 DMA Sound A Enable LEFT (0=Disable, 1=Enable) 10 DMA Sound A Timer Select (0=Timer 0, 1=Timer 1) 11 DMA Sound A Reset FIFO (1=Reset) 12 DMA Sound B Enable RIGHT (0=Disable, 1=Enable) 13 DMA Sound B Enable LEFT (0=Disable, 1=Enable) 14 DMA Sound B Timer Select (0=Timer 0, 1=Timer 1) 15 DMA Sound B Reset FIFO (1=Reset) |
Bit Expl. 0 Sound 1 ON flag (Read Only) 1 Sound 2 ON flag (Read Only) 2 Sound 3 ON flag (Read Only) 3 Sound 4 ON flag (Read Only) 4-6 Not used 7 All sound on/off (0: stop all sound circuits) (Read/Write) 8-15 Not used |
Bit Expl. 0-9 Bias Level (Default=200h, converting signed samples into unsigned) 10-13 Not used 14-15 Amplitude Resolution/Sampling Cycle (Default=0, see below) |
0 9bit / 32.768kHz (Default, best for DMA channels A,B) 1 8bit / 65.536kHz 2 7bit / 131.072kHz 3 6bit / 262.144kHz (Best for FM channels 1-4) |
| Comparision of CGB and GBA Sound |
| Timers |
Bit Expl. 0-1 Prescaler Selection (0=F/1, 1=F/64, 2=F/256, 3=F/1024) 2 Count-up Timing (0=Normal, 1=See below) 3-5 Not used 6 Timer IRQ Enable (0=Disable, 1=IRQ on Timer overflow) 7 Timer Start/Stop (0=Stop, 1=Operate) 8-15 Not used |
| DMA Transfers |
Bit Expl.
0-4 Not used
5-6 Dest Addr Control (0=Increment,1=Decrement,2=Fixed,3=Increment/Reload)
7-8 Source Adr Control (0=Increment,1=Decrement,2=Fixed,3=Prohibited)
9 DMA Repeat (0=Off, 1=On) (Must be zero if Bit 11 set)
10 DMA Transfer Type (0=16bit, 1=32bit)
11 Game Pak DRQ - DMA3 only - (0=Normal, 1=DRQ <from> Game Pak, DMA3)
12-13 DMA Start Timing (0=Immediately, 1=VBlank, 2=HBlank, 3=Special)
The 'Special' setting (Start Timing=3) depends on the DMA channel:
DMA0=Prohibited, DMA1/DMA2=Sound FIFO, DMA3=Video Capture
14 IRQ upon end of Word Count (0=Disable, 1=Enable)
15 DMA Enable (0=Off, 1=On)
|
| Communication Ports |
| SIO Normal Mode |
Bit Expl. 0-14 Not used 15 Must be zero (0) for Normal/Multiplayer/UART modes |
Bit Expl. 0 Shift Clock (SC) (0=External, 1=Internal) 1 Internal Shift Clock (0=256KHz, 1=2MHz) 2 SI State (opponents SO) (0=Low, 1=High/None) --- (Read Only) 3 SO during inactivity (0=Low, 1=High) 4-6 Not used 7 Start Bit (0=Inactive/Ready, 1=Start/Active) 8-11 Not used 12 Transfer Length (0=8bit, 1=32bit) 13 Must be "0" for Normal Mode 14 IRQ Enable (0=Disable, 1=Want IRQ upon completion) 15 Not used |
Step Sender 1st Recepient 2nd Recipient Transfer 1: DATA #0 --> UNDEF --> UNDEF --> Transfer 2: DATA #1 --> DATA #0 --> UNDEF --> Transfer 3: DATA #2 --> DATA #1 --> DATA #0 --> Transfer 4: DATA #3 --> DATA #2 --> DATA #1 --> |
| SIO Multi-Player Mode |
Bit Expl. 0-14 Not used 15 Must be zero (0) for Normal/Multiplayer/UART modes |
Bit Expl. 0-1 Baud Rate (0-3: 9600,38400,57600,115200 bps) 2 SI-Terminal (0=Parent, 1=Child) (Read Only) 3 SD-Terminal (0=Bad connection, 1=All GBAs Ready) (Read Only) 4-5 Multi-Player ID (0=Parent, 1-3=1st-3rd child) (Read Only?) 6 Multi-Player Error (0=Normal, 1=Error) (Read Only?) 7 Start/Busy Bit (0=Inactive, 1=Start/Busy) (Read Only for Slaves) 8-11 Not used 12 Must be "0" for Multi-Player mode 13 Must be "1" for Multi-Player mode 14 IRQ Enable (0=Disable, 1=Want IRQ upon completion) 15 Not used |
GBAs Bits Delays Timeout 1 18 None Yes 2 36 1 Yes 3 54 2 Yes 4 72 3 None |
| SIO UART Mode |
Bit Expl. 0-14 Not used 15 Must be zero (0) for Normal/Multiplayer/UART modes |
Bit Expl. 0-1 Baud Rate (0-3: 9600,38400,57600,115200 bps) 2 CTS Flag (0=Send always/blindly, 1=Send only when SC=LOW) 3 Parity Control (0=Even, 1=Odd) 4 Send Data Flag (0=Not Full, 1=Full) (Read Only) 5 Receive Data Flag (0=Not Empty, 1=Empty) (Read Only) 6 Error Flag (0=No Error, 1=Error) (Read Only) 7 Data Length (0=7bits, 1=8bits) 8 FIFO Enable Flag (0=Disable, 1=Enable) 9 Parity Enable Flag (0=Disable, 1=Enable) 10 Send Enable Flag (0=Disable, 1=Enable) 11 Receive Enable Flag (0=Disable, 1=Enable) 12 Must be "1" for UART mode 13 Must be "1" for UART mode 14 IRQ Enable (0=Disable, 1=IRQ when any Bit 4/5/6 become set) 15 Not used |
| SIO JOY BUS Mode |
Bit Expl. 0-14 Not used 14 Must be "1" for JOY BUS Mode 15 Must be "1" for JOY BUS Mode |
Bit Expl. 0 Device Reset Flag (Command FFh) (Read/Acknowledge) 1 Receive Complete Flag (Command 14h or 15h?) (Read/Acknowledge) 2 Send Complete Flag (Command 15h or 14h?) (Read/Acknowledge) 3-5 Not used 6 IRQ when receiving a Device Reset Command (0=Disable, 1=Enable) 7-15 Not used |
Bit Expl. 0 Not used 1 Receive Status Flag (0=Remote GBA is/was receiving) (Read Only?) 2 Not used 3 Send Status Flag (1=Remote GBA is/was sending) (Read Only?) 4-5 General Purpose Flag (Not assigned, may be used for whatever purpose) 6-15 Not used |
Receive FFh (Command) Send 00h (GBA Type number LSB (or MSB?)) Send 04h (GBA Type number MSB (or LSB?)) Send XXh (lower 8bits of SIOSTAT register) |
Receive 00h (Command) Send 00h (GBA Type number LSB (or MSB?)) Send 04h (GBA Type number MSB (or LSB?)) Send XXh (lower 8bits of SIOSTAT register) |
Receive 15h (Command) Receive XXh (Lower 8bits of JOY_RECV_L) Receive XXh (Upper 8bits of JOY_RECV_L) Receive XXh (Lower 8bits of JOY_RECV_H) Receive XXh (Upper 8bits of JOY_RECV_H) Send XXh (lower 8bits of SIOSTAT register) |
Receive 14h (Command) Send XXh (Lower 8bits of JOY_TRANS_L) Send XXh (Upper 8bits of JOY_TRANS_L) Send XXh (Lower 8bits of JOY_TRANS_H) Send XXh (Upper 8bits of JOY_TRANS_H) Send XXh (lower 8bits of SIOSTAT register) |
| SIO General-Purpose Mode |
Bit Expl. 0 SC Data Bit (0=Low, 1=High) 1 SD Data Bit (0=Low, 1=High) 2 SI Data Bit (0=Low, 1=High) 3 SO Data Bit (0=Low, 1=High) 4 SC Direction (0=Input, 1=Output) 5 SD Direction (0=Input, 1=Output) 6 SI Direction (0=Input, 1=Output, but see below) 7 SO Direction (0=Input, 1=Output) 8 Interrupt Request (0=Disable, 1=Enable) 9-13 Not used 14 Must be "0" for General-Purpose Mode 15 Must be "1" for General-Purpose or JOYBUS Mode |
| Infrared Communication |
Bit Expl. 0 Transmission Data (0=LED Off, 1=LED On) 1 READ Enable (0=Disable, 1=Enable) 2 Reception Data (0=None, 1=Signal received) (Read only) 3 AMP Operation (0=Off, 1=On) 4 IRQ Enable Flag (0=Disable, 1=Enable) 5-15 Not used |
| Keypad Input |
Bit Expl. 0 Button A (0=Pressed, 1=Released) 1 Button B (etc.) 2 Select (etc.) 3 Start (etc.) 4 Right (etc.) 5 Left (etc.) 6 Up (etc.) 7 Down (etc.) 8 Button R (etc.) 9 Button L (etc.) 10-15 Not used |
Bit Expl. 0 Button A (0=Ignore, 1=Select) 1 Button B (etc.) 2 Select (etc.) 3 Start (etc.) 4 Right (etc.) 5 Left (etc.) 6 Up (etc.) 7 Down (etc.) 8 Button R (etc.) 9 Button L (etc.) 10-13 Not used 14 IRQ Enable Flag (0=Disable, 1=Enable) 15 IRQ Condition (0=Logical OR, 1=Logical AND) |
| Interrupt Control |
Bit Expl. 0 Disable all interrupts (0=Disable All, 1=See IE register) 1-15 Not used |
Bit Expl. 0 LCD V-Blank (0=Disable) 1 LCD H-Blank (etc.) 2 LCD V-Counter Match (etc.) 3 Timer 0 Overflow (etc.) 4 Timer 1 Overflow (etc.) 5 Timer 2 Overflow (etc.) 6 Timer 3 Overflow (etc.) 7 Serial Communication (etc.) 8 DMA 0 (etc.) 9 DMA 1 (etc.) 10 DMA 2 (etc.) 11 DMA 3 (etc.) 12 Keypad (etc.) 13 Game Pak (external IRQ source) (etc.) 14-15 Not used |
Bit Expl. 0 LCD V-Blank (1=Request Interrupt) 1 LCD H-Blank (etc.) 2 LCD V-Counter Match (etc.) 3 Timer 0 Overflow (etc.) 4 Timer 1 Overflow (etc.) 5 Timer 2 Overflow (etc.) 6 Timer 3 Overflow (etc.) 7 Serial Communication (etc.) 8 DMA 0 (etc.) 9 DMA 1 (etc.) 10 DMA 2 (etc.) 11 DMA 3 (etc.) 12 Keypad (etc.) 13 Game Pak (external IRQ source) (etc.) 14-15 Not used |
00000018 b 128h ;IRQ vector: jump to actual BIOS handler 00000128 stmfd r13!,r0-r3,r12,r14 ;save registers to SP_irq 0000012C mov r0,4000000h ;ptr+4 to 03FFFFFC (mirror of 03007FFC) 00000130 add r14,r15,0h ;retadr for USER handler $+8=138h 00000134 ldr r15,[r0,-4h] ;jump to [03FFFFFC] USER handler 00000138 ldmfd r13!,r0-r3,r12,r14 ;restore registers from SP_irq 0000013C subs r15,r14,4h ;return from IRQ (PC=LR-4, CPSR=SPSR) |
Addr. Size Expl. 7FFCh 4 Pointer to user IRQ handler (32bit ARM code) 7FF8h 4 Interrupt Check Flag (for IntrWait/VBlankIntrWait functions) 7FF4h 4 Allocated Area 7FF0h 4 Pointer to Sound Buffer 7FE0h 16 Allocated Area 7FA0h 64 Default area for SP_svc Supervisor Stack (4 words/time) 7F00h 160 Default area for SP_irq Interrupt Stack (6 words/time) |
SP_svc=03007FE0h SP_irq=03007FA0h SP_usr=03007F00h |
| System Control |
Bit Expl. 0-1 SRAM Wait Control (0..3 = 4,3,2,8 cycles) 2-3 Wait State 0 First Access (0..3 = 4,3,2,8 cycles) 4 Wait State 0 Second Access (0..1 = 2,1 cycles) 5-6 Wait State 1 First Access (0..3 = 4,3,2,8 cycles) 7 Wait State 1 Second Access (0..1 = 4,1 cycles; unlike above WS0) 8-9 Wait State 2 First Access (0..3 = 4,3,2,8 cycles) 10 Wait State 2 Second Access (0..1 = 8,1 cycles; unlike above WS0,WS1) 11-12 PHI Terminal Output (0..3 = Disable, 4.19MHz, 8.38MHz, 16.76MHz) 13 Not used 14 Game Pak Prefetch Buffer (Pipe) (0=Disable, 1=Enable) 15 Game Pak Type Flag (Read Only) (0=GBA, 1=CGB) |
Bit Expl. 0 Undocumented. First Boot Flag (0=First, 1=Further) 1-7 Undocumented. Not used. |
Bit Expl. 0-6 Undocumented. Not used. 7 Undocumented. Power Down Mode (0=Halt, 1=Stop) |
Bit Expl. 0 Purpose Unknown (Seems to lock up the GBA when set to 1) 1-3 Purpose Unknown (Read/Write able) 4 Purpose Unknown (Always zero - not used or write only) 5 Purpose Unknown (Seems to lock up the GBA when set to 0) 6-23 Purpose Unknown (Always zero - not used or write only) 24-27 Wait Control WRAM 256K (0-14 = 15..1 Waitstates, 15=Lockup) 28-31 Purpose Unknown (Read/Write able) |