Converted most macros to inline functions and enums. Added tables to aid in mapping state<->registers. Replaced table.h with an easily tunable method.