Eureka! I added watches for the following variables and what I found was incredibly interesting. I may have a lead on what causes this bug after all.
Notice how these values correspond to the "glitch tiles" in my previous comment. Somehow these numbers are written here when they shouldn't be.
There's something going on around line C75E. I don't know enough about computers to figure this out yet. I tried adding breakpoints whenever #$80 is in the accumulator and a CPU write or PPU write occurs but I'm not sure what the source of the bug is yet.
Edit 3: I haven't yet located the source of the numbers $80, $03, $12, or $13, but I have found the section of code where they are stored that causes the bug. It's in the "doLoadNametableData" script, in this section of code:
Code:
notPath:
;;;;;; accumulator equals 80 at this point in the code for some reason
STA updateTile_00
INC temp
LDA temp
STA updateTile_01
;;; now, what we need is a row down from our current position...updateNT_pointer
;;; and temp, increased to its next row.
CLC
ADC #$0f
STA temp
LDA temp
STA updateTile_02
INC temp
LDA temp
STA updateTile_03
RTS
doDrawSingleMetatile:
LDA pointer+1
STA $2006
LDA pointer
STA $2006
LDA updateTile_00
STA $2007 ;write 1
LDA updateTile_01
STA $2007 ;; write 2
;;; now, what we need is a row down from our current position...pointer
;;; and temp, increased to its next row.
LDA pointer+1
STA $2006
LDA pointer
CLC
ADC #$20 ;; dont store it into pointer
;; because then it will be easy to just add 2 to
;; for the next place to write.
STA $2006
;; now get the tile
LDA updateTile_02
STA $2007 ; write 3
LDA updateTile_03
STA $2007 ; write 4
RTS