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

Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode


SubjectLoading screen #3 all at once new  
Posted bypulper
Posted on10/16/04 02:25 AM
From IP132.241.64.67  



Hmmm.. it has been so long since I did nametable loading I am forgetting the quirks. Say I wanted to cycle through nametables by pressing the start button. I can load the first two, but the third one gets all corrupted. I think I am forgetting something simple, but here is the basic idea I am going with:


jsr ldtitle ;completely loads 2 nametables (one at $2000, one at $2800)

;this sets up the PPU
lda #%10001000
sta $2000
lda #%00011110
sta $2001

jsr pollstrt ;poll for press start
jsr waitv2 ;wait for vblank
jsr swapnam0 ;swap nametables so we see 2nd screen
;(it works good so far)
jsr load1st ;loads the 3rd nametable at $2000 which is offscreen
;at this moment. This is the corrupted one.
jsr pollstrt ;Wait for press start
jsr waitv2 ;Wait for vblank
jsr swapnam0 ;swap nametables so we see screen 3
;However it looks like crap.


See what I'm getting at here? Do I have to turn off backgrounds or something while loading the third nametable?

-Pulper


SubjectRe: Loading screen #3 all at once new  
Posted byMemblers
Posted on10/16/04 02:46 AM
From IP68.58.99.218  



Yeah, you can't load a whole nametable in one vblank. You can split the loading into several smaller parts, or turn the screen off and write it all at once.

If you write it all at once, it'd be good to re-enable the screen during vblank (or after waiting for one), so the screen doesn't jump.




SubjectRe: Loading screen #3 all at once new  
Posted byMemblers
Posted on10/16/04 02:47 AM
From IP68.58.99.218  



Also note that by turning the screen off, I meant both background and sprites.




SubjectRe: Loading screen #3 all at once new  
Posted byDrag
Posted on10/16/04 02:50 AM
From IP69.243.0.34  



Or you can load a few rows at a time each vblank, which creates some type of oldschool top-down wiping effect. :P

- Drag


SubjectRe: Loading screen #3 all at once new  
Posted bypulper
Posted on10/16/04 03:49 AM
From IP132.241.65.68  



Ah, great! Thanks guys, I forgot that you couldn't load a whole screen in one vblank.

-Pulper


SubjectRe: Loading screen #3 all at once  
Posted bytepples
Posted on10/16/04 4:20 PM
From IP68.53.188.30  



Or use the fact that two nametables is enough for a double buffer, displaying one while loading the other in vblank. I used a technique like this in an "All Your Base" demo that I never finished.

____________________
My English is better than your Geberquen.


SubjectRe: Loading screen #3 all at once new  
Posted bypulper
Posted on10/16/04 5:47 PM
From IP132.241.65.155  



Hmmm.. I tried this but it is still garbled. Assume that the first two are loaded OK and the screen is displaying $2800 nametable correctly (screen 2). Here is my code:

jsr pollstrt ;poll start button

lda ppuReg1
and #%11110111 ;Turn off background
jsr waitv2 ;Copies ppureg1 into $2001 only during vblank, so wait

jsr load1st ;load the third nametable all at once at $2000

jsr swapnam0 ;swap nametables so we see newly loaded nametable

lda ppuReg1
ora #%00001000 ;Turn on background

At this point the third screen should have appeared.. but its garbage again. Am I turning the screen off correctly?

-Pulper


SubjectRe: Loading screen #3 all at once new  
Posted byDisch
Posted on10/16/04 6:05 PM
From IP66.82.9.41  



To turn the PPU off, you have to turn off BG and sprites. Leaveing one or both enabled will mean the PPU is rendering normally.

You're just turning off the BG, leaving sprites enabled, which doesn't do anything in terms of allowing you to draw outside of V-Blank.




SubjectRe: Loading screen #3 FIXED new  
Posted bypulper
Posted on10/16/04 7:08 PM
From IP132.241.65.129  



Ack yes, I just saw that Memblers said that as well. Fixed now, thanks guys!

-Pulper


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

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo