I have a little problem...
I wanted to save some space on my title screen so I came up with this little routine. However, all it does is that it makes my background flash. Does anyone know what the problem is?
LoadTitle:
LDA $2002
LDA #$20
STA $2006
LDA #$00
STA $2006 ;Begins at $2000
LDX #$00
LoadTitleLoop:
LDA title,x ; load data from address (background + the value in x)
CMP #$FF ;Compares value to $FF, and if it is equal to FF, skip next branch
BNE Write_Title_Tile
INX
LDA title,x ;Takes value next to $FF and rams it in the variable title_black (a racist variable)
STA title_black
LDY #$00 ;Prepares Y register
Black_Loop:
LDA #$00
STA $2007 ;Puts a lot of black tiles on the screen (CHR+pallettes make them black)
INY ;Increments Y and then compares it to the title_black variable
CPY title_black
BNE Black_Loop ;If it's not equal, go back to Black_Loop
INX ;Increments X for it to be ready for the next tile, and goes back to LoadTitleLoop
JMP LoadTitleLoop
Write_Title_Tile:
STA $2007 ; write to PPU
INX ; X = X + 1
CPX #$FA ; Compare X to hex $FA
BNE LoadTitleLoop ; Go back to LoadTitleLoop if it's not equal
title:
.db $FF,$42,$1D,$0D,$19,$1C,$0F,$00,$00,$30,$31,$32,$33,$34,$35,$36
.db $37,$FF,$03,$38,$39,$3A,$3B,$00,$12,$13,$01,$00,$40,$41,$42,$43
.db $44,$45,$46,$47,$0B,$18,$0E,$48,$49,$4A,$4B,$FF,$31,$1A,$00,$1C
.db $00,$0F,$00,$1D,$00,$0F,$00,$18,$00,$1E,$FF,$29
.db $00,$1D,$3D,$4D,$3F,$3E,$3F,$4D,$3C,$3E,$3F,$4C,$4D,$3C,$00,$3E ;; SFS Inscription! WEEEEEE
.db $3F,$3D,$3D,$3D,$4D,$3F,$4C,$4D,$4C,$4D,$3C,$4D,$3C,$4D,$3F,$00 ;;
.db $00,$1F,$3D,$3D,$3D,$3D,$3C,$3D,$00,$3D,$3C,$00,$3D,$00,$00,$3D ;;
.db $3C,$3D,$3D,$3D,$3D,$3D,$00,$3D,$00,$3D,$00,$3D,$00,$3D,$3D,$00 ;;
.db $00,$1A,$3D,$3D,$3D,$4E,$3F,$4D,$3C,$3D,$00,$00,$3D,$00,$00,$4E ;;
.db $3F,$3D,$3D,$3D,$4D,$3D,$00,$3D,$00,$3D,$00,$4D,$3C,$4D,$4F,$00 ;;
.db $00,$0F,$3D,$3D,$3D,$3D,$3D,$3D,$00,$3D,$3D,$00,$3D,$00,$00,$3D ;;
.db $3D,$3D,$3D,$3D,$3D,$3D,$00,$3D,$00,$3D,$00,$3D,$00,$4D,$3F,$00 ;;
.db $00,$1C,$3D,$3D,$3D,$4E,$4F,$4C,$3C,$4E,$4F,$00,$3C,$00,$00,$4E ;;
.db $4F,$4E,$4C,$4F,$3C,$3C,$00,$3C,$00,$3C,$00,$4C,$3C,$3C,$3C,$FF ;; Ends here
.db $4A,$02,$00,$1A,$16,$0B,$23,$0F,$1C,$00,$11,$0B,$17,$0F,$FF,$33
.db $03,$00,$1A,$16,$0B,$23,$0F,$1C,$00,$11,$0B,$17,$0F,$FF,$33