Troops assaulting the walls with siege towers, ladders Or grappling hooks who are broken in close combat flee directly away from the castle along with the rest of their regiment. This is worked out exactly like a normal flee move, ie, the unit moves 2D6" away from the castle. Note that the defenders of the wall may not pursue in this case.
For any other fighting on the ramparts, roll the flee and pursuit moves as normal. If the pursuer beats the score of the fleeing troops, the fleeing troops are destroyed. Simply remove the casualties and leave the pursuers in their place - they catch up with the fleeing troops and hack them down where they stand. If the fleeing troops manage to beat the score of the pursuers, they may move into the courtyard (remember that fleeing into a courtyard costs them half their movement) or into any adjacent wall section or tower. Do not move the pursuers. If there is nowhere for the troops to flee to then the broken units are automatically destroyed.