ARM programming for Gameboy Advance

Following the Gameboy Color, the Gameboy Advance was the first hand-held console to bring Super-Nintendo Quality to handhelds...

Rather than using the Gameboy's GBZ80, or the Super Nintendo's 65816, the Gameboy Advance uses an ARM processor.

In fact, the GBA is pretty much the simplest system to develop ARM for!

There were multiple generations of the Gameboy Advance, but they were essentially functionally identical... the later NDS was also backwards compatible with the GBA

Tech Specs
Cpu 16.7 MHZ ARM7TDMI
Memory 384k
Resolution 240x160 - 256 or 32K colors
Sprites 128 @ 64x64
Sound 4 channel + 2xDMA
The 3 generations of the GBA

If you want to learn ARM get the Cheatsheet! it has all the ARM7 commands, it covers the commands, and options like Bitshifts and conditions as well as the bytecode structure of the commands!

Technical Resources
GBATEK - complete documentation on the GBA and NDS

ARM Hello World Series

Hello World on the GameBoy Advance - ARM Assembly Lesson H2
Hello World on the GameBoy Advance with ARM Thumb Assembly - Lesson H4 [GBA]

ARM Platform Specific Lessons

Lesson P2 - Bitmap graphics and Palette definitions on GameBoy Advance (16 bit - 32768 colors) [GBA]
Lesson P3 - Bitmap graphics and Palette definitions on GameBoy Advance (8 bit - 256 colors) [GBA]
Lesson P5 - Joypad & Pen on the GBA / NDS ... Key reading on Risc OS [NDS] [GBA] [ROS]
Lesson P6 - Sound on the Gameboy Advance [GBA]
Lesson P8 - 16 color Tilemap on the Gameboy Advance and Nintendo DS! [GBA] [NDS]
Lesson P9 - Hardware Sprites on the Gameboy Advance and Nintendo DS! [GBA] [NDS]

ARM Simple Samples

Moving a sprite on RiscOS - Simple ARM Assembly Lesson S1
Sprite moving on the GameBoy Advance - Arm Assembly Lesson S2
Lesson S4 - Sprite moving on the GameBoy Advance (Thumb) [GBA]

Screen Display
In these tutorials we're going to use mode 4 - this effectively has 2 bitmap layers of 256 colors each, they are NOT PLANAR - they are linear bitmap format.
Note, it is not possible to write in bytes to the screen, We must write in WORDS... if we write a byte, both bytes of the word will be set the same - effectively halving the horizontal resolution

Memory Map
From To Purpose
00000000 00003FFF BIOS - System ROM (16 KBytes)
00004000 01FFFFFF Not used
02000000 0203FFFF WRAM - On-board Work RAM (256 KBytes) 2 Wait
02040000 02FFFFFF Not used
03000000 03007FFF WRAM - On-chip Work RAM (32 KBytes)
03008000 03FFFFFF Not used
04000000 040003FE I/O Registers
04000400 04FFFFFF Not used
05000000 050003FF BG/OBJ Palette RAM (1 Kbyte)
05000400 05FFFFFF Not used
06000000 06017FFF VRAM - Video RAM (96 KBytes)
06018000 06FFFFFF Not used
07000000 070003FF OAM - OBJ Attributes (1 Kbyte)
07000400 07FFFFFF Not used
08000000 09FFFFFF Game Pak ROM/FlashROM (max 32MB) - Wait State 0
0A000000 0BFFFFFF Game Pak ROM/FlashROM (max 32MB) - Wait State 1
0C000000 0DFFFFFF Game Pak ROM/FlashROM (max 32MB) - Wait State 2
0E000000 0E00FFFF Game Pak SRAM (max 64 KBytes) - 8bit Bus width
0E010000 0FFFFFFF Not used
10000000 FFFFFFFF Not used (upper 4bits of address bus unused)


Sound
Port Name Description Bits Details
4000060h SOUND1CNT_L Channel 1 Sweep register ---------TTTDSSS S=sweep shift D=direction T=Time
4000062h SOUND1CNT_H Channel 1 Duty/Length/Envelope (NR11 VVVVDSSSWWLLLLLL L=length W=wave pattern duty S=envelope Step D= env direction V=Volume
4000064h SOUND1CNT_X Channel 1 Frequency/Control IL---FFFFFFFFFFF I=Init sound L=no loop F=Frequency
4000068h SOUND2CNT_L Channel 2 Duty/Length/Envelope (NR21 VVVVDSSSWWLLLLLL L=length W=wave pattern duty S=envelope Step D= env direction V=Volume
400006Ch SOUND2CNT_H Channel 2 Frequency/Control IL---FFFFFFFFFFF I=Init sound L=no loop F=Frequency
4000070h SOUND3CNT_L Channel 3 Stop/Wave RAM select (NR30) -------PBD----- D=Dimension B=Bank P=Play
4000072h SOUND3CNT_H Channel 3 Length/Volume FVV-----LLLLLLLL L=sound Length V=volume F=Force
4000074h SOUND3CNT_X Channel 3 Frequency/Control IL---FFFFFFFFFFF I=Init sound L=no loop F=Frequency
4000078h SOUND4CNT_L Channel 4 Length/Envelope VVVVDSSS--LLLLLL L=length S=envelope Step D= env direction V=Volume
400007Ch SOUND4CNT_H Channel 4 Frequency/Control IL------SSSSCRRR R=dividing Ration, C=Counter S=shify clock freq L+no Loop I=Init sound
4000080h SOUNDCNT_L Control Stereo/Volume/Enable LLLLRRRR-lll-rrr LR=Channel on lr=master vol(7=max)
4000082h SOUNDCNT_H Control Mixing/DMA Control BBBBAAAA-ba-VV
4000084h SOUNDCNT_X Control Sound on/off M---4321 M=Master ON 1234 (Read) = Sound on flag
4000088h BIOS SOUNDBIAS Sound PWM Control AA----BBBBBBBBB- A=Amplitude B=Bios
4000090h WAVE_RAM 16 Bytes 1111222233334444 4 bit sample data
40000A0h FIFO_A Channel A FIFO ----DDDD----DDDD D=Wawave Data
40000A4h FIFO_B Channel B FIFO ----DDDD----DDDD D=Wawave Data

Ports
Port Name Description Bits Details
4000000h DISPCNT LCD Control
Owwddddd Bmhfcbbb
4000002h - Undocumented - Green Swap

4000004h DISPSTAT General LCD Status (STAT LYC)
4000006h VCOUNT Vertical Counter (LY)

4000008h BG0CNT BG0 Control

400000Ah BG1CNT BG1 Control

400000Ch BG2CNT BG2 Control

400000Eh BG3CNT BG3 Control

4000010h BG0HOFS BG0 X-Offset

4000012h BG0VOFS BG0 Y-Offset

4000014h BG1HOFS BG1 X-Offset

4000016h BG1VOFS BG1 Y-Offset

4000018h BG2HOFS BG2 X-Offset

400001Ah BG2VOFS BG2 Y-Offset

400001Ch BG3HOFS BG3 X-Offset

400001Eh BG3VOFS BG3 Y-Offset

4000020h BG2PA BG2 Rotation/Scaling Parameter A (dx)

4000022h BG2PB BG2 Rotation/Scaling Parameter B (dmx)

4000024h BG2PC BG2 Rotation/Scaling Parameter C (dy)

4000026h BG2PD BG2 Rotation/Scaling Parameter D (dmy)

4000028h BG2X BG2 Reference Point X-Coordinate

400002Ch BG2Y BG2 Reference Point Y-Coordinate

4000030h BG3PA BG3 Rotation/Scaling Parameter A (dx)

4000032h BG3PB BG3 Rotation/Scaling Parameter B (dmx)

4000034h BG3PC BG3 Rotation/Scaling Parameter C (dy)

4000036h BG3PD BG3 Rotation/Scaling Parameter D (dmy)

4000038h BG3X BG3 Reference Point X-Coordinate

400003Ch BG3Y BG3 Reference Point Y-Coordinate

4000040h WIN0H Window 0 Horizontal Dimensions

4000042h WIN1H Window 1 Horizontal Dimensions

4000044h WIN0V Window 0 Vertical Dimensions

4000046h WIN1V Window 1 Vertical Dimensions

4000048h WININ Inside of Window 0 and 1

400004Ah WINOUT Inside of OBJ Window & Outside of Windows

400004Ch MOSAIC Mosaic Size

400004Eh Not used


4000050h BLDCNT Color Special Effects Selection

4000052h BLDALPHA Alpha Blending Coefficients

4000054h BLDY Brightness (Fade-In/Out) Coefficient

4000056h Not used


40000B0h DMA0SAD DMA 0 Source Address

40000B4h DMA0DAD DMA 0 Destination Address

40000B8h DMA0CNT_L DMA 0 Word Count

40000BAh DMA0CNT_H DMA 0 Control

40000BCh DMA1SAD DMA 1 Source Address

40000C0h DMA1DAD DMA 1 Destination Address

40000C4h DMA1CNT_L DMA 1 Word Count

40000C6h DMA1CNT_H DMA 1 Control

40000C8h DMA2SAD DMA 2 Source Address

40000CCh DMA2DAD DMA 2 Destination Address

40000D0h DMA2CNT_L DMA 2 Word Count

40000D2h DMA2CNT_H DMA 2 Control

40000D4h DMA3SAD DMA 3 Source Address

40000D8h DMA3DAD DMA 3 Destination Address

40000DCh DMA3CNT_L DMA 3 Word Count

40000DEh DMA3CNT_H DMA 3 Control

40000E0h Not used


4000100h TM0CNT_L Timer 0 Counter/Reload

4000102h TM0CNT_H Timer 0 Control

4000104h TM1CNT_L Timer 1 Counter/Reload

4000106h TM1CNT_H Timer 1 Control

4000108h TM2CNT_L Timer 2 Counter/Reload

400010Ah TM2CNT_H Timer 2 Control

400010Ch TM3CNT_L Timer 3 Counter/Reload

400010Eh TM3CNT_H Timer 3 Control

4000110h Not used


4000120h SIODATA32 SIO Data (Normal-32bit Mode; shared with below)

4000120h SIOMULTI0 SIO Data 0 (Parent) (Multi-Player Mode)

4000122h SIOMULTI1 SIO Data 1 (1st Child) (Multi-Player Mode)

4000124h SIOMULTI2 SIO Data 2 (2nd Child) (Multi-Player Mode)

4000126h SIOMULTI3 SIO Data 3 (3rd Child) (Multi-Player Mode)

4000128h SIOCNT SIO Control Register

400012Ah SIOMLT_SEND SIO Data (Local of MultiPlayer; shared below)

400012Ah SIODATA8 SIO Data (Normal-8bit and UART Mode)

400012Ch Not used


4000130h KEYINPUT Key Status

4000132h KEYCNT Key Interrupt Control

4000134h RCNT SIO Mode Select/General Purpose Data

4000136h IR Ancient - Infrared Register (Prototypes only)

4000138h Not used


4000140h JOYCNT SIO JOY Bus Control

4000142h Not used


4000150h JOY_RECV SIO JOY Bus Receive Data

4000154h JOY_TRANS SIO JOY Bus Transmit Data

4000158h JOYSTAT SIO JOY Bus Receive Status

400015Ah Not used


4000200h IE Interrupt Enable Register

4000202h IF Interrupt Request Flags / IRQ Acknowledge

4000204h WAITCNT Game Pak Waitstate Control

4000206h Not used


4000208h IME Interrupt Master Enable Register

400020Ah Not used


4000300h POSTFLG Undocumented - Post Boot Flag

4000301h HALTCNT Undocumented - Power Down Control

4000302h Not used


4000410h ? Undocumented - Purpose Unknown / Bug ??? 0FFh

4000411h Not used


4000800h ? Undocumented - Internal Memory Control (R/W)

4000804h Not used


4xx0800h ? Mirrors of 4000800h (repeated each 64K)





Learn Assembly for the Greatest Classic Processors:  Z80 - 6502 - 68000 - 8086 - ARM
Visit www.ChibiAkumas.com and www.ChibiAliens.com to get my games and their source code! | Support me on patreon

 

View Options
Default Dark
Simple (Hide this menu)
Print Mode (white background)

Top Menu
***Main Menu***
Youtube channel
Patreon
Introduction to Assembly (Basics for absolute beginners)
Amazon Affiliate Link
Forum
AkuSprite Editor
ChibiTracker
Dec/Bin/Hex/Oct/Ascii Table

Alt Tech
Archive.org
Bitchute
Odysee
Rumble
DailyMotion
Please note: I wlll upload more content to these alt platforms based on the views they bring in

Z80 Content
***Z80 Tutorial List***
Learn Z80 Assembly (2021)
Learn Z80 Assembly (old)
Hello World
Simple Samples
Advanced Series
Multiplatform Series
Platform Specific Series
ChibiAkumas Series
Grime Z80
Z80 Downloads
Z80 Cheatsheet
Sources.7z
DevTools kit
Z80 Platforms
Amstrad CPC
Elan Enterprise
Gameboy & Gameboy Color
Master System & GameGear
MSX & MSX2
Sam Coupe
TI-83
ZX Spectrum
Spectrum NEXT
Camputers Lynx

6502 Content
***6502 Tutorial List***
Learn 6502 Assembly
Advanced Series
Platform Specific Series
Hello World Series
Simple Samples
Grime 6502
6502 Downloads
6502 Cheatsheet
Sources.7z
DevTools kit
6502 Platforms
Apple IIe
Atari 800 and 5200
Atari Lynx
BBC Micro
Commodore 64
Commodore PET
Commander x16
Super Nintendo (SNES)
Nintendo NES / Famicom
PC Engine (Turbografx-16)
Vic 20

68000 Content
***68000 Tutorial List***
Learn 68000 Assembly
Hello World Series
Platform Specific Series
Simple Samples
Grime 68000
68000 Downloads
68000 Cheatsheet
Sources.7z
DevTools kit
68000 Platforms
Amiga 500
Atari ST
Neo Geo
Sega Genesis / Mega Drive
Sinclair QL
X68000 (Sharp x68k)

8086 Content
Learn 8086 Assembly
Platform Specific Series
Hello World Series
Simple Samples
8086 Downloads
8086 Cheatsheet
Sources.7z
DevTools kit
8086 Platforms
Wonderswan
MsDos

ARM Content
Learn ARM Assembly
Learn ARM Thumb Assembly
Platform Specific Series
Hello World
Simple Samples
ARM Downloads
ARM Cheatsheet
Sources.7z
DevTools kit
ARM Platforms
Gameboy Advance
Nintendo DS
Risc Os

Risc-V Content
Learn Risc-V Assembly
Risc-V Downloads
Risc-V Cheatsheet
Sources.7z
DevTools kit

MIPS Content
Learn Risc-V Assembly
Platform Specific Series
Hello World
Simple Samples
MIPS Downloads
MIPS Cheatsheet
Sources.7z
DevTools kit
MIPS Platforms
Playstation
N64

PDP-11 Content
Learn PDP-11 Assembly
Platform Specific Series
Simple Samples
PDP-11 Downloads
PDP-11 Cheatsheet
Sources.7z
DevTools kit
PDP-11 Platforms
PDP-11
UKNC

TMS9900 Content
Learn TMS9900 Assembly
Platform Specific Series
Hello World
TMS9900 Downloads
TMS9900 Cheatsheet
Sources.7z
DevTools kit
TMS9900 Platforms
Ti 99

6809 Content
Learn 6809 Assembly
Learn 6309 Assembly
Platform Specific Series
Hello World Series
Simple Samples
6809 Downloads
6809/6309 Cheatsheet
Sources.7z
DevTools kit
6809 Platforms
Dragon 32/Tandy Coco
Fujitsu FM7
TRS-80 Coco 3
Vectrex

65816 Content
Learn 65816 Assembly
Hello World
Simple Samples
65816 Downloads
65816 Cheatsheet
Sources.7z
DevTools kit
65816 Platforms
SNES

eZ80 Content
Learn eZ80 Assembly
Platform Specific Series
eZ80 Downloads
eZ80 Cheatsheet
Sources.7z
DevTools kit
eZ80 Platforms
Ti84 PCE

IBM370 Content
Learn IBM370 Assembly
Simple Samples
IBM370 Downloads
IBM370 Cheatsheet
Sources.7z
DevTools kit

Super-H Content
Learn SH2 Assembly
Hello World Series
Simple Samples
SH2 Downloads
SH2 Cheatsheet
Sources.7z
DevTools kit
SH2 Platforms
32x
Saturn

PowerPC Content
Learn PowerPC Assembly
Hello World Series
Simple Samples
PowerPC Downloads
PowerPC Cheatsheet
Sources.7z
DevTools kit
PowerPC Platforms
Gamecube

Work in Progress
ChibiAndroids

Misc bits
Ruby programming









Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book



Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!












































































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book



Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!












































































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book



Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!