Hi,
1. You are quite correct, the morale test kicks in on actual casualties inflicted not DP suffered; the DP will of course effect your ability to pass the morale test.
2. To rally off DP the unit does have to be stationary. I think some people play it that generals can rally off even if moving but I don't think that is correct. There was an amendment to V1 that allowed a CinC to lead a unit on assault orders and still rally a DP if they moved but that no longer apears in BGDeLuxe(but I intend to use it in my games)
3. In melee, as well as firing, the first "casualties" inflicted are always DP until you reach three, or were already on three, then they become actual casualties.
So if your infantry charged into a melee with no DP but had an adverse result, retreat, and took 2DP plus melee casualties then you get 2DP. If you were facing an 18 strong infantry battalion they would inflict a further 3 casualties(1 per6), one of which would now be your third DP and the remaining two actual casualties.
Hope that helps
regards
Paul