There are a few naming conventions in the HAM macro system, making it easier to spot what a Macro does:- General Layout of a HAM hardware macro:
-
<type>_<register_name>_<action> [ (parameters) ]
- type
-
The Type determines if this macro will modify something in hardware, or just return a value, return a pointer to a specific adress in the GBA memory or Input/Output system, or other things.
- F_ returns a value
- M_ returns no value
- R_ is the adress of a register
- C_ is a constant
- MEM_ returns memory locations
- TOOL_ is a collection of macros
- register_name
-
Denotes the name of the register the macro is related to. Applied in all HAM macros where the operation is carried out on a single register. see include/mygba.h for a list of values. there are many.
- action
-
Basically the real "name" of the macro. This should be the component of the name that makes you recognize what it does see include/mygba.h for a list of values. there are many.
- parameters
-
If a macro takes parameters (mostly TOOL_ and M_ macros), you supply them in brackets after the macro name see include/mygba.h for a list of values. there are many.
Let us look at this by picking some random macro:
M_BG2CNT_MOSAIC_SET_ON
We can, according to the rules above, extract the following info about this macro:
- it will not return a value after being called (M_ type)
- it operates on the BG2 Control Register (BG2CNT)
- it does "MOSAIC_SET_ON", on this register, so we can assume this turns on Mosaic support for the BG, and we are dam right. This is what it does.
You will need to look around in mygba.h to get familiar with these concepts, but they will become second nature to you in no time.
If you need assistance in finding macro names, I can wholeheartedly suggest a Program called VisualAssist from WholeTomato software, which is a Intellisense enhancer fro Visual C++ (my favourite Source code editor). It works very well with HAM, you should try it. Also, VisualHAM includes MacroLookup functionality in its newer versions.
Documentation Homepage |
HAMLib reference |
Back to HAM Homepage