Skoolkid is correct that the the graphic that you see as the end product gets drawn twice (no 2 and no 3 in your list).
But he omits to mention the first occasion that 'something' is drawn to the top half of the screen, although that 'something' (which never gets seen) is quite different.
More related trivia:
The attached screenshot was created by using POKE #8AAE, #C9 in order to disable the special graphic for the top half of the Final Barrier.
Any attribute values in the layout of the upper half that aren't recognised as being the attribute of a defined cell type (or, thanks to the Cell Graphics Bug, a graphic data byte), cause the cavern-drawing routine to draw an apparently random pixel pattern into the corresponding screen cells. (See the 'tree trunk' in the attached screenshot, for example.)
However, that pixel pattern is not random. In the event that the CPIR loop in the original routine exits without having found a matching value for the attribute value that it is seeking for, (from the list of cell definitions stored in the region #8020-#8067), then HL will be left pointing at the next byte along, namely #8068.
The routine then picks up the next eight bytes #8068-#806F and interprets them as a pixel-pattern in order to draw a graphic in the appropriate cell. But the first seven of those addresses are actually the bytes which define Willy's location and movement status upon his entrance to the cavern (#8068-#806E), whilst the eighth byte (corresponding to the bottom pixel-row of the odd graphic) is the conveyor direction byte (#806F).
P.S. In the attached screenshot, the crown of the tree and the windows of the house are examples of the Cell Graphics Bug in action. The colour-attribute written to those parts of the screen don't match with an attribute from the list of the cavern's cell types, but they do match with a graphic data byte from some of the defined cell graphics for the cavern - the wall tile definition in the case of the crown of the tree, and the 'dangling spider' Fire cell in the case of the windows.
You can see part of the wall tile graphic drawn across the tree's crown, whilst the windows of the house are drawn using part of the 'spider' Type 1 Fire cell, and part of the (defined for the cavern but unused) 'stalactite' Type 2 Fire cell.
P.P.S. The green and yellow grassy areas provide a perfect attribute match with the wall tiles, so the full wall graphic is drawn across the 'lawn' areas of the upper half of the screen in the attached screenshot.
Edited by IRF, 29 November 2018 - 02:17 PM.