Borrowed code from cspspemu, fixed ICON0 extraction bug