GBA Assembly: from hardware to a game

The website opens in English. Use the language selector at the top for Portuguese.
Start with /gba-assembly-01-como-o-hardware-funciona.

Requirements: GNU Binutils for arm-none-eabi, Python 3 and a ready-to-run mGBA.
Run the commands below inside this extracted folder. Each .s is independent.
On Windows, build in WSL and open the .gba in mGBA for Windows.

FOLLOW THE COURSE IN ORDER
1. Chapters 1 and 2 are reading and paper exercises; nothing to run yet.
2. Chapter 3 explains installation, terminal folders and the first build.
3. Extract the ZIP before building. Check that the current folder contains
   the chosen .s, gba.ld and rom.py. Short article fragments are not full files.
4. Run one build command at a time. Stop at the first error. The first three
   commands may succeed silently; the last prints the ROM size and hash.
5. Open only the final .gba in mGBA and check the chapter's expected result.
6. Save one small source change and rerun all four commands before reopening
   the ROM. Keep the last working source. Extra experiments are optional.

FIRST ROM (chapter 3)
arm-none-eabi-as -mcpu=arm7tdmi -g -o primeira.o primeira-rom.s
arm-none-eabi-ld -T gba.ld -o primeira.elf primeira.o
arm-none-eabi-objcopy -O binary primeira.elf primeira.gba
python3 rom.py primeira.gba

OTHER EXAMPLES (chapters 4 to 8)
arm-none-eabi-as -mcpu=arm7tdmi -g -o main.o retangulo.s
arm-none-eabi-ld -T gba.ld -o main.elf main.o
arm-none-eabi-objcopy -O binary main.elf jogo.gba
python3 rom.py jogo.gba

Replace retangulo.s with pisca.s, botoes.s, movimento.s or minijogo.s and rerun
all four commands. Do not concatenate the independent programs.
botoes.s: A changes the color while held.
movimento.s: move the square with the D-pad.
minijogo.s: reach the green target; Start restarts.
Configure the corresponding keyboard keys in mGBA.

gba.ld and rom.py are pinned copies from Alan Jahnel's Gateblade v0.3.0:
https://github.com/AlanHJH/gba-assembly-ai/tree/v0.3.0
The six .s programs were written for this series. fill_rect was adapted from
learn/main.s in the same project. The original project received AI assistance.
The maintainer has not yet selected a reuse license; this package adds none.
Examples were tested in an emulator. Physical GBA hardware was not tested.
