The routine at
41271 draws 2 × 2 blocks as defined in the table at
49794. These definitions include a bitmap that determines which of
the four character cells spanned by the block have a terrain interaction parameter applied. The routine functions correctly up to
41398, by which
point the upper two cells have had their terrain interaction parameters correctly applied. The instructions from
41398 are intended to advance the
terrain interaction data pointer down one character row and paint the lower two cells, however the instructions are in the wrong order. The instructions
at
41398 -
41402 load
B with the terrain interaction painting bitmap and
A with the terrain interaction parameter to apply. Then the
instructions at
41405 -
41411 advance the terrain interaction data pointer by 32 bytes by adding 32 in
BC. When
BC is loaded with 32 at
41408, the terrain interaction painting bitmap value is lost, and therefore from
41412 onwards the value in
B is zero.
In order to fix this bug, the two blocks of code,
41398 -
41402 inclusive, and
41405 -
41411 inclusive, should be switched in position.