Whitespace fixes.
Move more generic functions to handle A1 surfaces to surface.c
Fix some warnings.
Add missing file, and compile it.
Move bitcounting out of the two functions.
Fix big endian code path.