Made a small demo and trying to finish

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
Rednecker20
Posts: 6
Joined: Fri Feb 19, 2010 5:49 pm

Made a small demo and trying to finish

Post by Rednecker20 »

Okay, so here is the deal: I've created a simple demo in NESASM3 that shows an airoplane over water and you control it with up/down. Made a game mode that only starts the game when $00 is 01. Added in a font in the CHR. And looking at all of the sources from this site that have text, it seems they do it different. How exactly would I set up a text table and display text from this font in the PPU?

Here is a relevant part of my code:

Code: Select all

SetPals:
   LDA $2002   ;Read PPU status to reset it (It is reset by reading from it)
   LDA #$3F    ;\ High byte 
   STA $2006   ;/
   LDA #$00    ;\ Low byte
   STA $2006   ;/
   LDX #$00    ;We start at 00
SetPalsLoop:
   LDA palette,x ;Load from palette table from data section below
   STA $2007   ;And we write it to the PPU I/O
   INX         ;We set the start of a loop
   CPX #$20    ;We're writing 16 bytes so hex $10 = decimal 16
   BNE SetPalsLoop ;Loop if not zero
I use $2007 for palettes, but it seems that other times it is used for PPU writing?

Agh, this as been bothering me all day. :shock:
Any help would be appreciated.
albailey
Posts: 177
Joined: Thu Jul 13, 2006 3:15 pm

Post by albailey »

$2007 is the read/write register for all PPU access.
You use $2006 for the address that the PPU is pointing at when you read or write to PPU ($2007).

So the loop you used is the loop that is loading in the palette (which goes at 3F00

You want to set different high and low $2006 bytes to write to your nametable, which is most likely at $2000

Al
Rednecker20
Posts: 6
Joined: Fri Feb 19, 2010 5:49 pm

Post by Rednecker20 »

Edit: I did have another problem, but nevermind :roll: It seems that writting the same values twice seemed to fix it :P
Post Reply