NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode


SubjectWierd problem AND chat new  
Posted byAnonymous
Posted on1/3/02 7:55 PM
From IP65.80.88.160  



Hi hi, this is I again ( the person that posted the last 3 posts, lol ).

I have a wierd problem... I have set no background pattern or anything, but it displays "A0BA" repeatedly over my background in my ROM...
The A0BA are just tiles from my first half of my CHROM... They aren't lined up in any logical way, so, I am guessing that the NES is picking four random tiles from my CHROM and repeating them... Its wierd!
Also, how do I specify the color palette I have defined in the palette ROM area for the background and the sprites and everything...
In the sprites, there is a lil thing you can set ( the color bits ) but, that doens't really tell me which palette I'm using or anything...

I made a simple algorithm for "clearing" the screen ( really, its just the background ) and it goes something like the following:

	;clear screen/background
ldx #$00
ldy #$00
ClearScreen:
lda #$3F ;blank tile...
sta $2007
inx
cpx #$3C
bne ClearScreen

ldx #$00
iny
cpy #$1F
bne ClearScreen


It works kinda well... not sure if thats the best way to do it tho.
I don't know how to have a file that has the name table and what not in it so I can just define this ( a background ) outside of the main file with all of those value sets and such...
Could someone give me some insight? I would greatly appreciate it!

Anyhoo, is there a chat room on IRC that is dedicated to chatting about NES Development? If so, please tell me where! Hehe ^_^

Thanks for the help!




SubjectRe: Wierd problem AND chat new  
Posted bymcmartin
Posted on1/4/02 08:50 AM
From IP204.216.188.80  



The VRAM address changes during graphics updates (once you leave VBLANK). You don't get many cycles inside VBLANK (I think it may be under a thousand) - so, in order to make sure that you're writing where you think you are, you need to disable the graphics chip. Put zeros into $2000 and $2001 before running your clearing routine.

Also, you only need to clear $800 worth of memory, starting at $2400, to clear out both name tables and attribute tables (assuming normal mirroring). That can be done pretty straightforwardly (see NES 101, linked from the main site, for sample code for this).

Name tables generally have to be coded in "by hand" - but there are utilities for generating name tables from tiles. Again, the main page on NESDev has a lot of material.

--Michael




SubjectRe: Wierd problem AND chat new  
Posted bykoitsu
Posted on1/4/02 3:29 PM
From IP12.234.24.219  



Also, just a little programmers optimisation note: There's no need for you to be using increment instructions in that subroutine. You would save quite a few cycles getting rid of the compares. Try using this subroutine instead:

ldy #$1F
StartOver:
ldx #$3C
ClearScreen:
lda #$3F
sta $2007
dex
bne ClearScreen
dey
bne StartOver

Finally, I don't think you need to zero out that much of the VRAM to achieve what you need. And don't forget to disable the display ($2000 I think?) prior to doing this, otherwise you'll need to wait for VBLs within that subroutine; there's not enough cycles in a full VBL for you to zero out that amount of RAM before another VBL hits. I recommend you just disable the display prior to doing this.

Happy coding.




SubjectRe: Wierd problem AND chat  
Posted byAnonymous
Posted on1/5/02 2:22 PM
From IP65.80.88.160  



Thanks for the advice, I'll try that ^_^
But could someone explain the particular tiles being displayed? Its wacky!

And now that I've changed the format of my ROM, there is a different pattern being displayed, and I'm not even playing around with the Name Tables...

Thanks for the help!
^__^
Matt




SubjectRe: Wierd problem AND chat new  
Posted byAnonymous
Posted on1/6/02 03:26 AM
From IP65.80.91.11  



Another thing... when do I wait on VBlank?
You say I hafta wait for VBlank, I just don't know when... before I write to some parts of certain RAM?




SubjectRe: Wierd problem AND chat new  
Posted byzero soul
Posted on1/6/02 06:09 AM



no, before you write to VRAM. if you want to do sprite ram, joysticks, etc., you don't have to wait for Vblank. but if the routine has *anything* to do with VRAM (ie., $2005/$2006/$2007), you should wait for VBlank; if you don't, the PPU, when it goes to draw the next frame, will start reading from the wrong point in VRAM, which will seriously mess things up. (and, write a couple of $00's to $2006 after you're done).


...just another vision...


Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo