AI assembler! That's awesome.
AI2 0x13, 0x14, 0x15, 0x16, 0x1D
Yeah, you're right. There's clearly a change AI command in there, but it doesn't get used.
Here's how it's supposed to work:
If unit is within a rectangular area, switch AI1/AI2 to [0x00,0x00]
Otherwise, move unit towards a specific point (which should be located within the rectangle)
(X1, Y1) = Upper-left corner of rectangle
(X2, Y2) = Lower-right corner of rectangle
Routine 0803A548 checks whether the unit is within the rectangular area.
Currently, the parameters are formatted like this: X1 Y1 00 00 X2 Y2 00 00
But they should be formatted like this: X1 Y1 X2 Y2
Due to this error, units with this AI will just crowd around the interior point.
AI2 0x17, 0x19, 0x1A, 0x1E
These units won't move back. After stepping on the target point, this AI essentially turns into AI1 0x00.