Where are my non-background sprites?

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

Post Reply
Tompis1995
Posts: 17
Joined: Fri Feb 22, 2019 10:05 am

Where are my non-background sprites?

Post by Tompis1995 » Thu Jul 23, 2020 6:30 pm

Hello. I'm having a bit of trouble trying to render non-background sprites within a background of bg sprites. My goal is to make the text, "FUCK!", slide across the screen. I've tried assigning them to addresses beyond $1000 and set the 5th bit to one in the PPU Control register (which should assign the non-bg sprites to the right area of the chr file, $1000) and set the 4th and 5th bit to one in the PPU Mask register (which should make the background and non-background sprites visible), but nothing happens except for the background rendering of the Tourette's Guy. I've tried assigning the text sprites to the same region as the background sprites, albeit in unoccupied spaces, and still nothing. How do I fix this?

Code: Select all

.segment "RODATA"
palette:
.byte $00,$0f,$10,$30,$00,$01,$21,$31,$00,$06,$16,$26,$00,$09,$19,$29

Tourettesguy:
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $01
.byte $02
.byte $03
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $04
.byte $05
.byte $06
.byte $06
.byte $06
.byte $07
.byte $08
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $09
.byte $0a
.byte $06
.byte $06
.byte $06
.byte $06
.byte $0b
.byte $0c
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $0a
.byte $0e
.byte $06
.byte $06
.byte $06
.byte $06
.byte $0f
.byte $10
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $11
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $12
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $13
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $14
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
Tourettesguy2:
.byte $00
.byte $00
.byte $00
.byte $00
.byte $15
.byte $16
.byte $06
.byte $06
.byte $06
.byte $06
.byte $06
.byte $17
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $18
.byte $19
.byte $1a
.byte $06
.byte $06
.byte $1b
.byte $06
.byte $1c
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $1d
.byte $1e
.byte $00
.byte $1f
.byte $20
.byte $06
.byte $21
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $22
.byte $23
.byte $24
.byte $25
.byte $06
.byte $26
.byte $06
.byte $27
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $28
.byte $29
.byte $00
.byte $00
.byte $0a
.byte $2a
.byte $06
.byte $06
.byte $2b
.byte $06
.byte $2c
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $2d
.byte $2e
.byte $2f
.byte $30
.byte $31
.byte $32
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $33
.byte $34
.byte $00
.byte $00
.byte $00
.byte $35
.byte $36
.byte $37
.byte $38
.byte $39
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $06
.byte $06
.byte $3a
.byte $3b
.byte $00
.byte $00
.byte $3c
.byte $3d
.byte $3e
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
Tourettesguy3:
.byte $00
.byte $3f
.byte $40
.byte $41
.byte $0f
.byte $42
.byte $43
.byte $44
.byte $45
.byte $46
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $47
.byte $48
.byte $49
.byte $4a
.byte $4b
.byte $4c
.byte $4d
.byte $06
.byte $4e
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $4f
.byte $00
.byte $00
.byte $50
.byte $06
.byte $51
.byte $52
.byte $06
.byte $53
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $54
.byte $55
.byte $56
.byte $06
.byte $06
.byte $57
.byte $58
.byte $59
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $5a
.byte $5b
.byte $06
.byte $06
.byte $5c
.byte $5d
.byte $00
.byte $00
.byte $00
.byte $5e
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $5f
.byte $60
.byte $61
.byte $06
.byte $62
.byte $00
.byte $00
.byte $00
.byte $63
.byte $64
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $65
.byte $66
.byte $06
.byte $67
.byte $68
.byte $00
.byte $69
.byte $6a
.byte $6b
.byte $6c
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $6d
.byte $6e
.byte $6e
.byte $6f
.byte $70
.byte $06
.byte $06
.byte $06
.byte $71
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
Tourettesguy4:
.byte $00
.byte $00
.byte $00
.byte $00
.byte $72
.byte $73
.byte $06
.byte $0f
.byte $74
.byte $06
.byte $06
.byte $06
.byte $75
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $76
.byte $77
.byte $06
.byte $78
.byte $79
.byte $06
.byte $7a
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $7b
.byte $7c
.byte $7d
.byte $7e
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $7f
.byte $e2
.byte $82
.byte $ac
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $c2
.byte $81
.byte $e2
.byte $80
.byte $9a
.byte $c6
.byte $92
.byte $e2
.byte $80
.byte $9e
.byte $e2
.byte $80
.byte $a6
.byte $00


.segment "HEADER"
    .byte "NES"
    .byte $1a
    .byte $02
    .byte $01
    .byte %00000000
    .byte $00
    .byte $00
    .byte $00
    .byte $00
    .byte $00,$00,$00,$00,$00
	
	
.segment "STARTUP"
.segment "ZEROPAGE"
screenHighByte:
.res 1
index:
.res 1
Fy:
.res 1
Fx:
.res 1
Uy:
.res 1
Ux:
.res 1
Cy:
.res 1
Cx:
.res 1
Ky:
.res 1
Kx:
.res 1
Exy:
.res 1
Exx:
.res 1
.segment "CODE"
WAITVBLANK:
:
    BIT $2002
    BPL :-
    RTS

RESET:
  SEI          ; disable IRQs
  CLD          ; disable decimal mode
  LDX #$40
  STX $4017    ; disable APU frame IRQ
  LDX #$FF
  TXS          ; Set up stack
  INX          ; now X = 0
  STX $2000    ; disable NMI
  STX $2001    ; disable rendering
  STX $4010    ; disable DMC IRQs

  JSR WAITVBLANK

clrmem:
  LDA #$00
  STA $0000, x
  STA $0100, x
  STA $0200, x
  STA $0400, x
  STA $0500, x
  STA $0600, x
  STA $0700, x
  STA $0300, x
  INX
  BNE clrmem

JSR WAITVBLANK

Main:
jsr loadBackground
jsr loadFuck


			
	LDA #%10001000
STA $2000		;This register controls the PPU in terms of where the Sprite address should be, the background address, etc.
				; From a binary perspective, the value goes something like this: #%vmsbpinn
				; v = Vblank: This bit turns on the NMI, which makes the system jump from whatever it was doing to the VBLANK label 0 = don't 1 = do
				; m = PPU select: This is an unused bit, but by default, it is set to master (0).
				; s = Sprite size: This bit determines the size of an individual sprite, 0 = 8x8, 1 = 8x16
				; b = Background Pattern Table Address (PTA): Where should the background sprites be placed? 0 = $0000, 1 = $1000
				; p = Sprite PTA: Same as b but only applies to non-background sprites
				; i = PPU Address increment
				; n = Name table address
LDA #%00011000
STA $2001		;This register determines whether or not sprites can show on the screen. 
				;From a binary perspective, the value goes something like: #%fffpcsit
				; fff = Full background color: which color(s) ought to be emphasized? 
				; 000 = black, 001 = red, 010 = blue, 100 = green
				; p = Sprite visibility: self explanatory. 0 = off 1 = on
				; c = Background visibility: same as p except it applies to backgrounds
				; s = Sprite clipping: sprites that appear in the left 8 pixel column, 0 = off
				; i = Background clipping: same as s except it applies to backgrounds
				; t = Display type, 0 = color, 1 = monochrome
				; Now, since the value I registered is #%00010000, that '1' is in the 4th bit, which
				; turns on the Sprite visibility bit (s).
				

Loopy:
JMP Loopy

loadFuck:
LDA #$50
STA Fy
STA Fx
STA Uy
STA Cy
STA Ky
STA Exy
LDA #$51
STA Ux
LDA #$52
STA Cx
LDA #$53
STA Kx
LDA #$54
STA Exx
Sprite:
LDX #$00
LDA Fy
STA $200,x	;address of the y position
INX
LDA #$D0	;tile number of cursor
STA $200,x	;address of the tile number
INX
LDA #$30	;palette value
STA $200,x	;address of palette value
INX
LDA Fx
STA $200,x	;address of the x position
INX
LDA Uy
STA $200,x	;address of the y position
INX
LDA #$D1	;tile number of cursor
STA $200,x	;address of the tile number
INX
LDA #$30	;palette value
STA $200,x	;address of palette value
INX
LDA Ux
STA $200,x	;address of the x position
INX
LDA Cy
STA $200,x	;address of the y position
INX
LDA #$D2	;tile number of cursor
STA $200,x	;address of the tile number
INX
LDA #$30	;palette value
STA $200,x	;address of palette value
INX
LDA Cx
STA $200,x	;address of the x position
INX
LDA Ky
STA $200,x	;address of the y position
INX
LDA #$D3	;tile number of cursor
STA $200,x	;address of the tile number
INX
LDA #$30	;palette value
STA $200,x	;address of palette value
INX
LDA Kx
STA $200,x	;address of the x position
INX
LDA Exy
STA $200,x	;address of the y position
INX
LDA #$D4	;tile number of cursor
STA $200,x	;address of the tile number
INX
LDA #$30	;palette value
STA $200,x	;address of palette value
INX
LDA Exx
STA $200,x	;address of the x position
RTS
		
loadBackground:
NewPalette:
	LDA #$3F	;High byte of the Palette Address
		STA $2006	;Feed the byte to the PPUADDRESS register ($2006)
		LDA #$00	;Low byte of the Palette Address
		STA $2006	;Feed the byte to the PPU ADDRESS register ($2006)
		LDA #$0F	;0F = black = background color
		STA $2007	;Feed the value to the PPUDATA register ($2007)
		LDA #$30	;30 = white = ball color
		STA $2007	;Feed the value to the PPUDATA register ($2007)
		LDA #$10	;10 = gray
		STA $2007	;Feed the value to the PPUDATA register ($2007)
		
loadTextData:
		lda #$20
		sta screenHighByte
		lda #$20
		sta index
		lda screenHighByte
		sta $2006
		lda #$20
		sta $2006
		ldx index
		textLoop:
			lda Tourettesguy,x
			sta $2007
			ldx index
			cpx #$ff
			beq newLine
			inc index
			jmp textLoop
	newLine:
		inc index
		ldx index
			textLoop2:
			lda Tourettesguy2,x
			sta $2007
			ldx index
			cpx #$ff
			beq newLine2
			inc index
			jmp textLoop2
	newLine2:
		inc index
		ldx index
			textLoop3:
			lda Tourettesguy3,x
			sta $2007
			ldx index
			cpx #$ff
			beq newLine3
			inc index
			jmp textLoop3
	newLine3:
		inc index
		ldx index
			textLoop4:
			lda Tourettesguy4,x
			sta $2007
			ldx index
			cpx #$67
			beq Return
			inc index
			jmp textLoop4
			Return:
			rts

VBLANK:
LDA #$00 		;Starting tile number     
STA $2003		;Feed the tile number to the OAM address register
LDA #$02		;High byte of sprite data address
STA $4014		;Feed the byte to the OAM DMA register
INC Fx
INC Fy
INC Ux
INC Uy
INC Cx
INC Cy
INC Kx
INC Ky
INC Exx
INC Exy
getOut:
RTI

.segment "VECTORS"
    .word VBLANK
    .word RESET
    .word 0
	
.segment "CHARS"
   .incbin "tourettes guy.chr"	;CHRS are files containing sprites
note: any mention of "cursor" in the code refers to the corresponding letter in the text
Attachments
tourettes guy.chr
(8 KiB) Downloaded 20 times
tourettesguy.nes
(40.02 KiB) Downloaded 24 times

User avatar
Memblers
Site Admin
Posts: 3884
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Where are my non-background sprites?

Post by Memblers » Fri Jul 24, 2020 1:36 am

The sprites are using tiles $D0-$D4, which are blank (in both of the 4kB banks). That's why you're not seeing anything. Looks like it's supposed to be tiles $00-$04.

Post Reply