in your source codes, you were 16 bit write (02000000). in your loop example, you switched to a 32 bit write (04000000), you cant switch the type of write without adjust the type of write it is.
16 bit is ok for X6, but not for 32 bit. (this is almost all the time, there are exceptions though)
and as jhmiller pointed out, the math is not constant.
9FC6 - 9DA6 = 220
A0D6 - 9FC6 = 110
is it possible there is something at 01799EB6?
then you could adjust it like so:
Code:
30000000 00000004
02010000 01799DA6 000003E7
78010000 00000110
31000000