For All units in the game:

// ****************************************************************************
// Data0
(*
Bits Mask Data
0-6 $0000007F Type (128 possible unit types).
7-14 $00007F80 Country (254 countries).
15-20 $001F8000 Year (-1890).
21 $00200000 Not built at start (air & naval units only).
22 $00400000 Small (land units only).
23-30 $7F800000 Source country (254 countries).
31 $80000000 No adjacent ZOC (land units only).
*)
// ****************************************************************************
UnitTypeMask = $0000007F;
UnitTypeShift = 0;
CountryMask = $00007F80;
CountryShift = 7;
YearMask = $001F8000;
YearShift = 15;
NotBuiltMask = $00200000;
NotBuiltShift = 21;
SmallMask = $00400000;
SmallShift = 22;
SourceCountryMask = $7F800000;
SourceCountryShift = 23;
NoAdjacentZOCMask = $80000000;
NoAdjacentZOCShift = 31;
// ****************************************************************************
// Data1
(*
Bits Mask Data
0-12 $00001FFF Unit ID # (13 bits = 8192).
13-16 $0001E000 TransType (4 bits).
17-25 $03FE0000 Unused (9 bits).
26-31 $FC000000 Fort hexsides (land units only) (6 bits).
*)
// ****************************************************************************
UnitIDReadMask = $00001FFF; // Unit's ID # read from CSV file (13 bits).
UnitIDReadShift = 0;
TransTypeMask = $0001E000; // TransType (4 bits). Used to be $03FFE000.
TransTypeShift = 13;
FortHexsidesMask = $FC000000; // (6 bits).
FortHexsidesShift = 26;
// ****************************************************************************
// Data2
(*
Bits Mask Data // Unit IDs of transported units.
0-12 $00001FFF Trans1 (13 bits).
13-25 $03FFE000 Trans2 (13 bits).
26 $04000000 Picked.
27 $08000000 Sentry.
28 $10000000 Disorganized.
29 $20000000 Disorganized at reorganization start.
30 $40000000 Out of supply.
31 $80000000 Isolated.
*)
// ****************************************************************************
Trans1Mask = $00001FFF;
Trans1Shift = 0;
Trans2Mask = $03FFE000;
Trans2Shift = 13;
PickedMask = $04000000;
PickedShift = 26;
SentryMask = $08000000;
SentryShift = 27;
DisorganizedMask = $10000000;
DisorganizedShift = 28;
DisorganizedAtReorgStartMask = $20000000;
DisorganizedAtReorgStartShift = 29;
OutOfSupplyMask = $40000000;
OutOfSupplyShift = 30;
IsolatedMask = $80000000;
IsolatedShift = 31;
// ****************************************************************************
// Data3
(*
Bits Mask Data
0-8 $000001FF Column (9 bits = 512).
9-16 $0001FE00 Row (8 bits = 256).
17-23 $00FE0000 Sea area (7 bits = 128).
24-26 $07000000 Section (3 bits = 8).
27-31 $F8000000 On/Off map location (5 bits = 32).
*)
// ****************************************************************************
ColumnMask = $000001FF;
ColumnShift = 0;
RowMask = $0001FE00;
RowShift = 9;
SeaAreaMaskUnits = $00FE0000;
SeaAreaShiftUnits = 17;
SectionMask = $07000000;
SectionShift = 24;
UnitPlaceMask = $F8000000;
UnitPlaceShift = 27;
// ****************************************************************************
// Data4
(*
Bits Mask Data
0-6 $0000007F Parent carrier sea area (air units only).
7-9 $00000380 Parent carrier section (air units only).
10 $00000400 Unused.
11 $00000800 Permananent factory (factory units only).
12 $00001000 Invading (land units only).
13 $00002000 Sea invading (land units only).
14 $00004000 Paradropping (land units only).
15 $00008000 Offensive HQ.
16 $00010000 Primary supply source (land units only).
17 $00020000 Emergency supply.
18 $00040000 Emergency supply HQ (land units only).
19 $00080000 Combat engineer (land units only).
20 $00100000 Flying extended (air units only).
21 $00200000 Night mission (air units only).
22 $00400000 Supply checked.
23 $00800000 Selectable.
24 $01000000 Selectable cleared.
25 $02000000 ActiveUnit.
26 $04000000 Overrunning (land units only).
27-30 $78000000 Offensive points used (land units only).
31 $80000000 HQ moved off rail (land units only).
*)
// ****************************************************************************
ParentCarrierSeaAreaMask = $0000007F;
ParentCarrierSeaAreaShift = 0;
ParentCarrierSectionMask = $00000380;
ParentCarrierSectionShift = 7;
PermanentMask = $00000800;
PermanentShift = 11;
InvadingMask = $00001000;
InvadingShift = 12;
SeaInvadingMask = $00002000;
SeaInvadingShift = 13;
ParadroppingMask = $00004000;
ParadroppingShift = 14;
OffensiveHQMask = $00008000;
OffensiveHQShift = 15;
PrimarySupplySourceMask = $00010000;
PrimarySupplySourceShift = 16;
EmergencySupplyMask = $00020000;
EmergencySupplyShift = 17;
EmergencySupplyHQMask = $00040000;
EmergencySupplyHQShift = 18;
CombatEngineerMask = $00080000;
CombatEngineerShift = 19;
FlyingExtendedMask = $00100000;
FlyingExtendedShift = 20;
NightMissionMask = $00200000;
NightMissionShift = 21;
SupplyCheckedMask = $00400000;
SupplyCheckedShift = 22;
SelectableMask = $00800000;
SelectableShift = 23;
SelectableClearedMask = $01000000;
SelectableClearedShift = 24;
ActiveUnitMask = $02000000;
ActiveUnitShift = 25;
OverrunningMask = $04000000;
OverrunningShift = 26;
OffensivePtsMask = $78000000;
OffensivePtsShift = 27;
HQMovedOffRailMask = $80000000;
HQMovedOffRailShift = 31;
// ****************************************************************************
// Data5
(*
Bits Mask Data
0-6 $0000007F Invasion sea area (land units only) (7 bits = 128).
7 $00000080 Synth oil lost (synth oil units only).
8-15 $0000FF00 Points: oil resources/build points only (8 bits = 256).
16-20 $000F0000 Year the unit arrives as a reinforcement.
21-22 $00600000 Role (air units only).
23 $00800000 AA fired (land units only).
24 $01000000 Aborted this combat.
25 $02000000 Aborting.
26 $04000000 Bombarding (land units only).
27 $08000000 Landing.
28 $10000000 Doubled (land units only).
29 $20000000 Forced abort.
30 $40000000 Force extended range (air units only).
31 $80000000 Unit initiating an Interception (air/naval units only).
*)
// ****************************************************************************
InvasionSeaAreaMask = $0000007F;
InvasionSeaAreaShift = 0;
SynthOilLostMask = $00000080;
SynthOilLostShift = 7;
PointsMask = $0000FF00;
PointsShift = 8;
YearArrivesMask = $001F0000;
YearArrivesShift = 16;
RoleMask = $00600000;
RoleShift = 21;
AAFiredMask = $00800000;
AAFiredShift = 23;
AbortedThisCombatMask = $01000000;
AbortedThisCombatShift = 24;
AbortingMask = $02000000;
AbortingShift = 25;
BombardingMask = $04000000;
BombardingShift = 26;
LandingMask = $08000000;
LandingShift = 27;
DoubledMask = $10000000;
DoubledShift = 28;
ForcedAbortMask = $20000000;
ForcedAbortShift = 29;
ForceExtendedMask = $40000000;
ForceExtendedShift = 30;
InterceptionMask = $80000000;
InterceptionShift = 31;
// ****************************************************************************
// Data6
(*
Bits Mask Data
0 $00000001 Returning to base (air/naval units only).
1 $00000002 Staying at sea (air/naval units only).
2-8 $000001FC Range used (air/naval units only) (7 bits = 128).
9-16 $0001FE00 Working8Bits (8 bits).
17 $00020000 US naval combat.
18-20 $001C0000 Movement points used (3 bits = 8).
21-24 $01E00000 Setup status: 0 = not being setup (4 bits = 16).
25-30 $EE000000 Setup group index (6 bits = 64).
31 $80000000 Built this turn.
*)
// ****************************************************************************
ReturningToBaseMask = $00000001;
ReturningToBaseShift = 0;
StayingAtSeaMask = $00000002;
StayingAtSeaShift = 1;
RangeUsedMask = $000001FC;
RangeUsedShift = 2;
Working8BitsMask = $0001FE00; // (8 bits = 256).
Working8BitsShift = 9; // Working8Bits.
ReorgTagMask = $3F; // Used in combination with Working8Bits.
USNavalCombatMask = $00020000;
USNavalCombatShift = 17;
MPUsedMask = $001C0000;
MPUsedShift = 18;
SetupStatusMask = $01E00000; // Step in setup process (4 bits = 16).
SetupStatusShift = 21;
SetupGroupIndexMask = $7E000000; // Setup Location Group Index (6 bits = 64).
SetupGroupIndexShift = 25;
BuiltThisTurnMask = $80000000;
BuiltThisTurnShift = 31;
// ****************************************************************************
// Data7
(*
Bits Mask Data
0 $00000001 Whether unit's bitmap image was loaded (air and naval only).
1-5 $0000003E Bitmap page (31 possible - 22 used).
6-12 $00001FC0 Bitmap cell within page (127 possible - 100 used).
13-21 $003FE000 From column (512 possible - 360 used).
22-29 $3FC00000 From row (256 possible - 195 used).
30 $40000000 Moved in impulse.
31 $80000000 Moved in turn.
*)
BitmapLoadedMask = $00000001; // Whether the unit's bitmap has been loaded.
BitmapLoadedShift = 0;
BitmapPageMask = $0000003E;
BitmapPageShift = 1;
BitmapCellMask = $00001FC0;
BitmapCellShift = 6;
FromColumnMask = $003FE000; // Hex unit started from. Used for returning
FromColumnShift = 13; // air units back to the hex from which they
FromRowMask = $3FC00000; // started, and artillery units back to the hex
FromRowShift = 22; // from which they bombarded.
MovedInImpulseMask = $40000000;
MovedInImpulseShift = 30;
MovedInTurnMask = $80000000;
MovedInTurnShift = 31;

// ****************************************************************************
// TTransType is used to record the linkages between units that are transporting
// other units, transported by other units, or have recently unloaded from
// another unit.
// trtyIng1 - Self is currently transporting 1 other unit.
// trtyIng2 - Self is currently transporting 2 other units.
// trtyIng1U - Self is currently transporting 1 other unit, but it had been
// transporting a second. Self is a non-carrier naval unit.
// trtyBy1 - Self is currently transported by 1 other unit.
// trtyBy2 - Self is currently transported by 2 air transports.
// trtyByR - Self is currently transported by a carrier & rebased from a
// different carrier in the current pAirRebase phase.
// trtyUnloaded1 - Self (a naval unit) unloaded 1 unit after moving.
// trtyUnloaded2 - Self (a naval unit) unloaded 2 units after moving.
// trtyNormalUnload - Self unloaded from a naval transport that returned to
// port or Self unloaded from an air transport that was
// aborted in the pParadrop or pAirTransport phases.
// trtyFromUnload - Self (a land unit) unloaded from a naval transport in the
// current pUnloadLandUnits phase.
// trtyFromInv - Self (a land unit) unloaded from a naval transport in the
// current or immediately previous pInvasion phase.
// trtyFromAirRebase - Self (an air unit) unloaded from a naval transport or
// carrier in the current pAirRebase phase.
// trtyFromCarrier - Self is a carrier air unit flying either an air mission or
// is engaged in a naval air combat.
//
// o In all the above cases the other units are TransLink[1] and TransLink[2].
// o In the trtyBy2 case, TransLink[1] and TransLink[2] both have a TransType of
// trtyIng1, even though they each are only carrying half of the transported
// unit.
// o In the trtyFrom and trtyNormalUnload cases, the TransLink[1] value is used
// to undo the move.
// o In the trtyFromInv case, the TransLink[1] value is used to determine from
// which the sea area section box the unit is invading.
// o In the trtyFromCarrier, the TransLink[1] value is used when the player
// wants the carrier air unit to return to the carrier from which it started
// the mission.
// ****************************************************************************


For Land units (only):


(*
TLandUnit data storage.

LandData0:
Bits Mask Data
0-3 $0000000F Combat.
4-6 $00000070 Movement.
7-9 $00000380 Reorganization.

A:
10 $00000400 Elite.
11 $00000800 Heavy.
OR B:
10-11 $00000C00 Anti-tank type.

12-14 $00007000 Reserve type.

A:
15-23 $00FF8000 City column.
24-31 $FF000000 City row.
OR B:
15-22 $00FF0000 War country.
23-31 $FF000000 Unused.

CombatMask = $0000000F;
CombatShift = 0;
MoveMask = $00000070;
MoveShift = 4;
ReorgMask = $00000380;
ReorgShift = 7;
EliteMask = $00000400;
EliteShift = 10;
HeavyMask = $00000800;
HeavyShift = 11;
AntiTankMask = $00000C00;
AntiTankShift = 10;
ReserveMask = $00007000;
ReserveShift = 12;
ReserveCountryMask = $00FF0000;
ReserveCountryShift = 16;
CityColumnMask = $00FF8000;
CityColumnShift = 15;
CityRowMask = $FF000000;
CityRowShift = 24;

*)

For Naval Units only:

(*
NavalData0
Bits Mask Data
0-3 $0000000F Attack
4-7 $000000F0 Defense
8-11 $00000F00 Anti-air
12-15 $0000F000 Air class/bombardment/air capacity.
16-19 $000F0000 Supply
20 $00100000 Supply active
21-24 $01E00000 Movement
25-28 $1E000000 Range
29-31 $E0000000 Cost (2nd cycle)
*)
AttackMask = $0000000F;
AttackShift = 0;
DefenseMask = $000000F0;
DefenseShift = 4;
AntiAirMask = $00000F00;
AntiAirShift = 8;
BombardmentMask = $0000F000;
BombardmentShift = 12;
SupplyMask = $000F0000;
SupplyShift = 16;
SupplyActiveMask = $00100000;
SupplyActiveShift = 20;
MoveMask = $01E00000;
MoveShift = 21;
RangeMask = $1E000000;
RangeShift = 25;
Cost2Mask = $E0000000;
Cost2Shift = 29;
(*
NavalData1
Bits Mask Data
0-7 $000000FF Convoy points.
8-10 $00000700 New construction time.
11-16 $0001F800 Year sunk (-1890).
17-20 $001E0000 Month sunk.
21-25 $03E00000 Day sunk.
26 $04000000 Replacement. True means this unit is a replacement unit.
27 $08000000 Override default construction time.
28 $10000000 In 1st cycle/changed location.
29 $20000000 Damaged.
30-31 $C0000000 Naval move number.
*)
ConvoyMask = $000000FF;
ConvoyShift = 0;
TimeMask = $00000700;
TimeShift = 8;
SunkYearMask = $0001F800;
SunkYearShift = 11;
SunkMonthMask = $001E0000;
SunkMonthShift = 17;
SunkDayMask = $03E00000;
SunkDayShift = 21;
ReplacementMask = $04000000;
ReplacementShift = 26;
OverrideTimeMask = $08000000;
OverrideTimeShift = 27;
FirstCycleMask = $10000000;
FirstCycleShift = 28;
DamagedMask = $20000000;
DamagedShift = 29;
NavalMoveNumberMask = $C0000000;
NavalMoveNumberShift = 30;


For Air units only:

(*
AirData0:
Bits Mask Data
0-3 $0000000F Tactical 0 - 15
4-8 $000001F0 Strategic 0 - 31
9-14 $00007E00 Range 0 - 63
15 $00008000 Extended capability binary
16 $00010000 Flying boat binary
17-18 $00060000 Flying bomb type 0 - 3
19 $00080000 No interception binary
20 $00100000 No attack binary
21 $00200000 Parent carrier moved Not used
22-24 $01C00000 Class/movement 0 - 7
25-27 $0E000000 Air transport 0 - 7
28 $10000000 Tank buster binary
29 $20000000 Night capability binary
30-31 $C0000000 Class change count 0 - 3

AirData1:
Bits Mask Data
0-5 $0000003F Class year 2 (-1890) 0 - 63
6-8 $000001C0 Class 2 0 - 7
9-14 $00007E00 Class year 3 (-1890) 0 - 63
15-17 $00038000 Class 3 0 - 7
18-20 $001C0000 Cost 0 - 7
21-24 $01E00000 Air-air 0 - 15
25-28 $1E000000 Air-sea 0 - 15
29 $20000000 Pilot binary
30 $40000000 Twin engine binary
31 $80000000 Can carry Okha binary
*)
const
TacticalMask = $0000000F;
TacticalShift = 0;
StrategicMask = $000001F0;
StrategicShift = 4;
RangeMask = $00007E00;
RangeShift = 9;
ExtendedMask = $00008000;
ExtendedShift = 15;
FlyingBoatMask = $00010000;
FlyingBoatShift = 16;
FlyingBombMask = $00060000;
FlyingBombShift = 17;
NoInterceptMask = $00080000;
NoInterceptShift = 19;
NoAttackMask = $00100000;
NoAttackShift = 20;
ClassMoveMask = $01C00000; // Both movement points and starting carrier
ClassMoveShift = 22; // class are stored here.
AirTransportMask = $0E000000;
AirTransportShift = 25;
TankBusterMask = $10000000;
TankBusterShift = 28;
NightMask = $20000000;
NightShift = 29;
ClassChangesMask = $C0000000;
ClassChangesShift = 30;
ClassYear2Mask = $00000003F;
ClassYear2Shift = 0;
ClassClass2Mask = $000001C0;
ClassClass2Shift = 6;
ClassYear3Mask = $00007E00;
ClassYear3Shift = 9;
ClassClass3Mask = $00038000;
ClassClass3Shift = 15;
BaseCostMask = $001C0000;
BaseCostShift = 18;
AirAirMask = $01E00000;
AirAirShift = 21;
AirSeaMask = $1E000000;
AirSeaShift = 25;
PilotMask = $20000000;
PilotShift = 29;
TwinEngineMask = $40000000;
TwinEngineShift = 30;
OhkaMask = $80000000;
OhkaShift = 31;
