Guess: You aren't interpreting the no-overwrite flags.
In DOS Lemmings 1, tiles have 3 flags:
erase (instead of drawing the tile, erase pixels where the tile would be),
upside-down (flip vertically), and
no-overwrite (draw behind existing tiles).
Naively, it looks like you don't need special code to handle no-overwrite, you would simply draw all no-overwrite tiles first, then the rest on top. Here's a counterexample to this strategy:
The order of these tiles in the file is A, B, C. Tile A is normal, tile B is an eraser, and tile C is no-overwrite. You cannot draw C-A-B because that would erase the part of C that appears in the hole. Neither you can draw C-B-A because A would appear as a complete square, which it should not. And you can't draw A-B-C because C shall not overwrite A.
You must really draw A, then erase with B, then draw with C exactly in the hole where there are no pixels, even though this is slow with hardware rendering.
Any other correct solution would be more complicated, e.g., you can analyze the tiles and observe that B really cuts something from A, creating a tile A' with the corner gnawed away, and then paint C, then A'.
I have no idea how Lemmini encodes no-overwrite in the text files.
-- Simon