[4.5.9] [UNSOLVED] What Are These Glitch Tiles on the Left Side of the Screen?

puppydrum64

Active member
I noticed this popped up only now that I disabled scrolling on my start screen to get it to function like one. In the past I had this issue and fixed it by figuring out the tile ID of the "glitch tiles" in the PPU viewer and assigning them to blank space which made the illusion that no tile change was occurring. It seems to be different for each build of the game. It doesn't happen unless I'm actually in the game, they don't appear in the editor as you can see. I have provided the Screen Info for this screen as well to make answering my question easier.What Are These Things On The Left Edge of the Screen.png
 

puppydrum64

Active member
That fixed the tile glitch but now the screen won't scroll.

EDIT: Changing RTS back to what it was before now doesn't do anything; the graphics are still fixed and the screen still won't scroll? How does that make any sense?

EDIT 2: If you're thinking "Did you just forget to assign the new script" the answer is no. Even reassigning the old, unaltered script still acts as though I had changed to the "fixed" version. This shouldn't be possible! Thank goodness I didn't save after swapping scripts, that would have been a disaster.

EDIT 3: Derp. I used the wrong doUpdateCamera script, it wasn't doUpdateCamera_shooter2 like it should have been.
 
Last edited:

TakuikaNinja

Active member
So did it fix your issue or not?
You need to save the project after making changes to scripts, nesmaker sometimes doesn't recognise the changes if you don't.
 

puppydrum64

Active member
So did it fix your issue or not?
You need to save the project after making changes to scripts, nesmaker sometimes doesn't recognise the changes if you don't.
The tiles no longer are glitched but the screen will not scroll. I've noticed a pattern: On the loading seam, the script is drawing the following tiles:

#$80 #$03
#$12 #$13

I was hoping that would help me locate the cause in Mesen's debugger but sadly it's much more difficult to track what the PPU is doing. I can't use LDA and STA to write directly to PPU tile addresses either so that won't work.
 

TakuikaNinja

Active member
Double check your screen flags for the right edge for scroll flag. It's easy to miss if you've been copying & pasting screens.
The right edge for scroll flag works differently in the shooter module. The scrolling "unlocks" when you defeat a boss tile (set via the collision tiles).
 

puppydrum64

Active member
Double check your screen flags for the right edge for scroll flag. It's easy to miss if you've been copying & pasting screens.
The right edge for scroll flag works differently in the shooter module. The scrolling "unlocks" when you defeat a boss tile (set via the collision tiles).
The fix you posted dpesn't line up with the version of the Update Camera Script that I have. I'll post it below, with line numbers added.

Code:
1
2 doUpdateCamera:	
3	
4	LDA gameHandler
5	AND #%10000000 ;;; this will skip object handling.
6	BEQ +dontSkipCamHandling
7		RTS
8 dontSkipCamHandling:
9
10	LDA scrollByte
11	ORA #%11000000 
12	STA scrollByte
13	
14	LDA #$00
15	STA tempA
16	LDA #$01
17	STA tempB
18	
19	LDA camX
20	AND #%11110000
21	STA tempz
22
23	LDA scrollByte
24	AND #%10100010
25	BNE +scrollEngaged
26		JMP skipScrollUpdate
27 +scrollEngaged:
28
29	LDA scrollByte
30	AND #%10000000
31	BNE doHorizontalCameraUpdate
32		JMP noHorizontalCameraUpdate ;;;;I tried changing this to RTS and nothing changed. The screen still scrolls but the tile bug is still there.
33	doHorizontalCameraUpdate:
34
35	LDA scrollByte
36	AND #%01000000
37	BNE doRightCameraUpdate
38		
39		; ;; is left camera update
40		; LDA camX_lo
41		; sec
42		; sbc tempA
43		; STA camX_lo
44		; LDA camX
45		; sbc tempB
46		; STA temp
47			; BCS +skipCheckForScrollScreenEdge
48				; LDA ScreenFlags00
49				; AND #%00100000
50				; BEQ +skipCheckForScrollScreenEdge
51					; JMP noHorizontalCameraUpdate
52		; +skipCheckForScrollScreenEdge
53		; LDA temp
54		; STA camX
55		
56		; LDA camX_hi
57		; sbc #$00
58		; STA camX_hi
59		; JSR getCamSeam
60		; JMP noHorizontalCameraUpdate
61	doRightCameraUpdate
62		LDA ScreenFlags00
63                AND #%00010000 
64	BEQ +doNormalScreenUpdate	
65			JMP +noHorizontalCameraUpdate
66		+doNormalScreenUpdate

I'm guessing this is a newer version based on the file name: doUpdateCamera_shooter2. The section you were talking about (at least I believe you were talking about) is commented out entirely. Yet the tile bug still takes place.

EDIT: Had I read a few lines down I would have seen yet another noHorizontalCameraUpdate. I changed it to RTS as well and sadly the tiles are there yet the screen scrolls. I don't know why the screen wasn't scrolling before, in this build that doesn't seem to happen.

Another problem I've noticed is that the level I'm playtesting on uses the wrong palette. After going from my title screen to the stage I have set the screen to warp out to, the correct tiles load but the correct palette does not. This does not happen if I touch a warp tile, even though I set both to use the same WarpToScreen macro.
 
Last edited:

PasseGaming

Active member
Yikes, working with the shooter module. From experience, I can say that it is probably the hardest module to work with. Definitely not first game worthy. It was a absolute nightmare making my project. Sk much so I wont ever mess with that module again from this point forward.
 

puppydrum64

Active member
Yikes, working with the shooter module. From experience, I can say that it is probably the hardest module to work with. Definitely not first game worthy. It was a absolute nightmare making my project. Sk much so I wont ever mess with that module again from this point forward.
And here I thought it would be the easiest. Lmao
 

puppydrum64

Active member
It seems like I made a typo in the original post. The RTS is supposed to be on line 65.
No big deal. I figured that the module probably changed since then. Either way it still didn't work, so I'll tinker with the script this weekend and see what I can figure out
 

PasseGaming

Active member
And here I thought it would be the easiest. Lmao
It's not, I regret beginning with this module. It has been nothing short of a massive headache. Had I known what I was going to experience when I started, I would have made a Maze or Platformer instead.
 

puppydrum64

Active member
It's not, I regret beginning with this module. It has been nothing short of a massive headache. Had I known what I was going to experience when I started, I would have made a Maze or Platformer instead.
The only "bootleg" fix I can come up with would be ensuring that tiles #$80, #$03, #$12, and #$13 are always blank, this isn't the ideal workaround for the bug but it's the only way I can fix it (the code for handling the camera and drawing tiles is beyond my current understanding.)
 

PasseGaming

Active member
I just left those areas blank so when it does happen it's not very noticeable then again, it doesn't happen every time. We have to remember these engines are janky and are supposed to be a jumping off point... then again, without any advanced tutorials on coding it's hard to figure out what we need to know without years of experience.
 

puppydrum64

Active member
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.

tileError.png

Notice how these values correspond to the "glitch tiles" in my previous comment. Somehow these numbers are written here when they shouldn't be.

tileError2.png

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
 
Last edited:
Top Bottom