|
| 1 | + |
| 2 | + ---------------------------------------------------------- |
| 3 | + // \\ |
| 4 | + || TTT q cc || |
| 5 | + || TT qq c c bb || |
| 6 | + || TT qq c c lll b b || |
| 7 | + || TT ooo qqq cc l i i b b || |
| 8 | + || TT o q c c lll i i b b || |
| 9 | + || TT o q c c l ii b b || |
| 10 | + || TTTTTTTT ooo q c cccc llll i i b || |
| 11 | + || i i b b || |
| 12 | + || ii b || |
| 13 | + || || |
| 14 | + ||============================================================|| |
| 15 | + || libtonc || |
| 16 | + || part of TONC: GBA Programming in rot 13 || |
| 17 | + || v a0 || |
| 18 | + || 20050316-20091221, J Vijn || |
| 19 | + \\___________________________________________________________// |
| 20 | + |
| 21 | + |
| 22 | +A revamped libtonc. It's actually changed quite a bit since the |
| 23 | +first incarnations. I've renamed a good deal of the defines, |
| 24 | +structures and functions, added some text functions and tried to |
| 25 | +make things a little bit faster. |
| 26 | + |
| 27 | +// === NOTES === |
| 28 | + |
| 29 | +* I'm making liberal use of typedefs and structs this time around. |
| 30 | + In fact, you can pretty much say I've typedef'd the crap out of |
| 31 | + it. Used lots and lots of structures too. Structs are good. They, |
| 32 | + well structure things so that accessing becomse easier (tile_mem). |
| 33 | + Also, it allows the compiler to optimise certain things like copies |
| 34 | + (TILE struct) and clustered register accesses (DMACHN and BGAFF). |
| 35 | + Yes, this creates a bit of a learning curve, but it's worth it. |
| 36 | +* Macros. Yes, the C preprocessor is evil, but there's always been |
| 37 | + a lot of gray area in game programming *cough* global variables |
| 38 | + *cough*. Don't get scared by the bitfield macros BF_MSK and |
| 39 | + BF_UNMSK. The pretty much do what bit-fields do. Only faster. |
| 40 | + Btw, the "do {} while(0)" is just a construct that is used to keep |
| 41 | + multi-statement macros safe (after an if for example). No trace of |
| 42 | + loopiness will remain in the final binary if compiled with |
| 43 | + optimisations. |
| 44 | +* You will find that a number of the defines have an underscore prefix. |
| 45 | + You will also find that this always concerns 0 defines (i.e., default |
| 46 | + values). I do this so you can tell that they are the default values |
| 47 | + and won't do something silly like reg&0 when checking for a bit or |
| 48 | + reg|=0 when setting one. |
| 49 | +* Broken record advice: GBA is a 32bit machine. Use int if you can, |
| 50 | + char or short if you must. You are NOT saving space by using u8 or |
| 51 | + u16 as variables. In fact, probably just the opposite, and it's |
| 52 | + slower too. |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +// Notes to self: |
| 57 | +* check DMA flags once more |
| 58 | +* swi_ex names? |
| 59 | +* text stuff should be singletons |
| 60 | +* timer: TM_ or TMR_ ? |
| 61 | +* INT_ALL ??? |
| 62 | +* IN_SBSS !! |
| 63 | +* Oi! Where'd by xxx_BUILDs go? |
0 commit comments