a = 65472
This looks (most likely) wrong. (I know no OS where your apps would be at such a low position in memory)
You need to check how you calculate the values. Or show us, where you get the original values (source values) for your calculation.
But before all:
If your variables are declared as "integer" then this will only work on 32 bit cpu.
"integer" only has 32 bit, and anything above will be cut off.
You can use PtrUInt instead (or Int64 / QWord, or Pointer or PByte)
Also I recommend (If you do not already do) for testing and debugging compile with the following flags
-Criot -gh -gt