C
Coranac
coranac.com · Personal blog · on HN since 2008
Coranac hosts TONC, a Game Boy Advance programming tutorial, plus articles on ARM assembly, fixed-point math, and graphics.
What HN saysHN commenters praise TONC as a great software project with excellent documentation, and recommend its Mode 7 pages for old-school GBA programming.
35HN people shared it
24linked it in comments
12stories submitted
290story points
1 year agolast shared
2008people per year2026
Most-shared posts
- 1Game Boy Advanced programming tutorial9 people · 8 points · first shared 2012 · 1 comments on HN
- 2A Whirlwind Tour of ARM Assembly7 people · 44 points · first shared 2013 · 12 comments on HN
- 3Text6 people · first shared 2013
- 4Another fast fixed-point sine approximation3 people · 4 points · first shared 2014 · discussion on HN
- 5Introduction to GBA Graphics2 people · 3 points · first shared 2017 · discussion on HN
- 6Bitmaps2 people · first shared 2020
- 7Mode72 people · first shared 2015
- 8Matrices from a geometric perspective1 people · 206 points · first shared 2017 · 51 comments on HN
- 9Low level stuff in ARM1 people · 23 points · first shared 2008 · 3 comments on HN
- 10A Look at Arctangent Implementations1 people · 2 points · first shared 2020 · discussion on HN
- 11Tonc.pdf1 people · first shared 2013
- 12Mode7ex1 people · first shared 2024
- 13Text1 people · first shared 2017
What HN people wrote when they linked it
araker · 2024-01-09
I can also recommend these blog posts about mode 7 (2 parts)
https://www.coranac.com/tonc/text/mode7.htm https://www.coranac.com/tonc/text/mode7ex.htm
ravishi · 2023-09-01
To this day I consider TONC (https://www.coranac.com/tonc/text/) to be the greatest software project I have ever worked with. It touches everything you need to develop games for the GBA. The documentation is awesome on many levels. The book is great. I am just thankful that I found it when I was younger as that introduced me to a whole lot of critical knowledge.
csande17 · 2019-12-09
The most popular toolchain is devkitPro, which is based on GCC: https://devkitpro.org/wiki/Getting_Started
The impression I've gotten is that the GBA is powerful enough that you can write most of your programs in C, but some performance-critical stuff (like if you're trying to draw pixels directly instead of using the sprite/tile hardware) is best written in assembly. If you're interested in learning more, I would highly recommend this tutorial: https://www.coranac.com/tonc/text/toc.htm
birslip · 2015-01-06
If you like this article you might be interested in this article about the mode7 on the GBA: http://www.coranac.com/tonc/text/mode7.htm
Personally I love this kind of old-school programming article. It reminds me when I was developing homebrew games for the GBA!
jpap · 2013-08-01
Practice. A lot.
A good start is actually the ARM processor; since it's a RISC instruction set, it's quite simple.
I've done lots of assembly in my ugrad days, even writing a Motorola HC11 micro-controller emulator, but ARM would be a much better choice right now.
I found the "Tonic: Whirlwind Tour of Assembly" [1] site invaluable to get me started for SnappyCam, as it covers a lot of the ARM ISA.
For iOS-related assembly, I'd recommend [2].
And for a taste of ARM NEON SIMD, have a look at [3]. The one thing that "clicked" for me on SIMD is that you should look at each register "lane" as trying to unroll a loop. I initially dived in thinking I'd just make a sequential algorithm parallel, which is often too difficult to arrange.
[1] http://www.coranac.com/tonc/text/asm.htm
[2] http://www.shervinemami.info/armAssembly.html
[3] http://hilbert-space.de/?p=22
Keyframe · 2013-07-29
It's always interesting to see game console programming. On a similar note tonc http://www.coranac.com/tonc/text/ is a great intro to homebrew GBA programming.
felipebueno · 2013-07-29
Thanks for the manual. =]
I know it's not an official manual but it's worth mentioning: GBA Tonc - http://www.coranac.com/tonc/text/toc.htm
PDF download: http://www.coranac.com/files/tonc.pdf
kragen · 2024-07-17
if you want to understand chip architectures, work through the elements of computing systems (aka nand to tetris). it walks you through implementing your own cpu, gate by gate, plus an operating system, compiler, and tetris game, in a way tested to successfully fit inside of a single-semester undergraduate class. their hardware designs are pretty weird (their hdl looks nothing like any hdl you can actually synthesize hardware from, their descriptions of how gates work are oversimplified, and their instruction set architecture is pretty similar to the eclipse that kidder was writing about but completely unlike any current design) but that isn't really important
after completing the work in that book and raising investment capital for your company, you can honestly call yourself a fullstack engineer
— arm —
the best architecture to write assembly for is the arm—the original one, not thumb, which is a bit of a pain—and arm is also only slightly more complex to build than the fake-ass architecture in nand2tetris, and quite a bit faster. if you already know any assembly language, including the nand2tetris one, the best introduction to arm might not actually be any current tutorial but rather the vlsi arm3 datasheet from 01990 https://www.chiark.greenend.org.uk/~theom/riscos/docs/ARM3-datasheet_A… which has a summary of the instruction set on p.1-7 (9/56) and a fully complete description on pp.3-12 to 3-43 (19/56 to 34/56)
as you probably know,…
keyle · 2024-12-31
Interesting post. I wish it went deeper but I guess it's just a post-mortem.
Related, I found this old post that goes into the basics of GBA coding [1]. It doesn't look nearly as bad as I expected. That said I'm sure performance might be the issue once you start having a few things going.
If you have a good resource please let me know (I prefer C).
Edit: also this library [2].
[1] http://www.loirak.com/gameboy/gbatutor.php
[2] https://www.coranac.com/tonc/text/toc.htm
wtetzner · 2024-08-22
The Game Boy Advance is a fun console to program for. Though you'd need to get a flash cart to easily run your code on it, which isn't especially cheap.
https://www.coranac.com/tonc/text/
http://problemkaputt.de/gbatek-index.htm
sneeuwpopsneeuw · 2021-04-30
If anyone is interested in making a Gameboy game from scratch. Tonc is basically the resource that everyone is using to do that. https://www.coranac.com/tonc/text/
bluedino · 2020-11-15
There are bitmap modes on the Advance:
https://www.coranac.com/tonc/text/bitmaps.htm
deaddodo · 2020-11-15
No, you can directly rasterize to the screen buffer:
https://www.coranac.com/tonc/text/bitmaps.htm
However, you’re limited to the CPU’s (relatively) mediocre processing power. This is exactly how some of the raycasted game engines were built, though:
https://m.youtube.com/watch?v=eD1RRESSF6Y
And, if you look at open source raycaster engines, they’ll use either Mode 3 or Mode 4, usually with a background enabled:
https://github.com/jduranmaster/GBA-caster/blob/dd62073a4371c143e7e57f…
ranger207 · 2019-11-16
You could try old systems. The GameBoy Advance is reasonably well-documented[0] (enough for me to write a simple game for it over the summer as my first real C program), and a hacked 3DS[1] can run the game on real GameBoy hardware through Virtual Console injection.
[0] http://coranac.com/tonc/text/
[1] reddit.com/r/3dshacks
z3phyr · 2019-06-23
https://www.coranac.com/tonc/text/toc.htm
http://ianfinlayson.net/class/cpsc305/notes/01-intro
By programming for the Game Boy Advanced ofcourse
GrantSolar · 2018-11-26
I've found this to be a good resource: https://www.coranac.com/tonc/text/
tagrun · 2018-10-26
That kind of empty loops are actually used for delays, waiting on interrupts to kick in etc. in embedded systems, where you typically fight against the compiler using volatile keyword.
Example from https://www.coranac.com/tonc/text/video.htm:
#define REG_VCOUNT *(volatile u16*)0x04000006
while(REG_VCOUNT < 160);
Graziano_M · 2018-07-21
I haven't written a GBA emulator, but GBA got me into ARM. Tonc's old guide to ARM[1] I'll still send to people who want to learn ARM.
[1] https://www.coranac.com/tonc/text/asm.htm
indescions_2018 · 2018-04-27
Pokémon! GBA (ARM7) is even being used in some undergrad level OS classes. Although you may get more mileage out of RP3 development.
disassembly of Pokémon Red/Blue
https://github.com/pret/pokered
TONC GBA Programming Principles
https://www.coranac.com/tonc/text/toc.htm
khalladay · 2017-04-04
You are definitely right. Tonc has some interesting data (here: http://www.coranac.com/tonc/text/text.htm#tbl-txt-se2) about performance of operations with 16 bit vs 32 bit variables, but none of that information applies to memcpy, and I think I jumped the gun on making as much as possible 32 bit types.
Thanks for catching that! I'll remedy that line later this evening.
Although, evidently ARM chips have an optimized code path for 4 byte aligned data: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka393… , I'm not sure if that would apply in this case or not?
shepardrtc · 2015-08-11
This series ends abruptly at Part 2. The author said there would be a Part 3, but I couldn't find anything.
In any case, if you want another overview article on ARM Assembly, try this: http://www.coranac.com/tonc/text/asm.htm
If you want a tutorial: http://thinkingeek.com/2013/01/09/arm-assembler-raspberry-pi-chapter-1…
And finally, this is a pretty good book if you've never looked at Assembly before and you've got a RPi or RPi emulator: http://www.amazon.com/Raspberry-Assembly-Language-RASPBIAN-Beginners/d…
jhallenworld · 2014-10-10
Related: here is a very good article and comments on estimating transcendental functions: http://www.coranac.com/2009/07/sines/
I'm annoyed that one of the links in the comments is broken: there was a page where you entered your function and it provided a chebyshev polynomial to generate it to a particular precision.
EDIT: well here is another one: http://goddard.net.nz/files/js/chebyshev/cheby.html
floody-berry · 2014-09-04
Not ARM64, but "Tonc: Whirlwind Tour of ARM Assembly" [1] is what I'm repeatedly referring to while learning ARM. Pretty confusing coming from x86, but it's starting to make sense and my ARM is getting slightly less awful.
[1] http://www.coranac.com/tonc/text/asm.htm
dpflan · 2015-12-29
If you're interested in programming Gameboy Advance games:
While in college, one intro course on lower-level computer programming had a few projects for programming for a Gameboy Advance emulator. This site was heavily used for reference and guidance: http://www.coranac.com/tonc/text/toc.htm
Also, here are some materials (from the course) and even examples of created projects:
_
Related Course Materials
1. Main Reference: http://www.coranac.com/tonc/text/toc.htm
2. GBA Installation: https://github.com/nuppan/Georgia-Tech/tree/master/2nd%20Year/CS%20211…
2. Another site: http://www.loirak.com/gameboy/gbatutor.php
_
Projects
1. "Duckhunt" - https://github.com/jabelman/duck_hunt-gba
2. "Pacman" - https://github.com/zjhzyyk/gba-pacman
3. Video of "The Snuggler" - https://www.youtube.com/watch?v=wxnEY3RRPp4
4. Video of "Samurai Jack" - https://www.youtube.com/watch?v=fgIeKCxAfSk