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

Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode


Subjectcoding problems new  
Posted byle_cholet
Posted on1/3/03 00:33 AM
From IP65.94.51.234  



i've written a small nes demo witch doesnt do much but should do alot more. My code is very simple and basic, but i cant seems to understand how to display something on the screen properly. I write to NT1 values but tiles never shows at the right place. For example, if i write to vram $2000, i see nothing but if i write to $2120, i see my stuff at the top of the screen. Here's a sample of my code:

start:
sei
cld

lda $2002
bpl start

lda #$00
sta $2005
sta $2005

lda #%00000000
sta $2000
lda #%00011110
sta $2001

lda #$20
sta $2006
lda #$00
sta $2006

lda #$01
sta $2007

Should this display my tiles at the top of the screen? I tested it out with fceultra but it doenst work.

thanks





SubjectRe: coding problems new  
Posted bymcmartin
Posted on1/3/03 05:39 AM
From IP128.12.190.38  



You need to set the scroll data through $2005 as your *last* step, not your first. The PPU renders based on the last values in its scroll registers, which overlap somewhat with what $2006 writes do.

Also, ensure that you've actually enabled backgrounds and selected the appropriate nametable and such by writing to $2000 and $2001.




SubjectRe: coding problems new  
Posted byMemblers
Posted on1/3/03 3:19 PM
From IP68.58.99.218  



Also, have $2006 point to $0000 (or $2000) before you turn the screen on.




SubjectRe: coding problems new  
Posted byle_cholet
Posted on1/3/03 6:05 PM
From IP64.228.229.129  



it doesnt seems to help. my code now look like this:

start:
sei
cld

;wait for vblank
lda $2002
bpl start

;activate background, set the name table ... etc
lda #%00000000
sta $2000
lda #%00011110
sta $2001

;set vram address to the first NT
lda #$20
sta $2006
lda #$00
sta $2006

;write data to NT1
lda #$01
sta $2007
lda #$02
sta $2007
....

lda #$00
sta $2006
sta $2006
sta $2005
sta $2005
loop:
jmp loop

and it doesnt show anything with fceultra. If i write to the second line of NT1 ($2020), i began to see some stuff at the top of the screen.

Any idea?




SubjectRe: coding problems new  
Posted byMemblers
Posted on1/3/03 6:18 PM
From IP68.58.99.218  



Oh, I see the problem. Set $2001 to zero before you do any writing to VRAM. Then turn the screen on after you've cleared $2005 and $2006. That should fix it.

The program is modifying the VRAM address ($2006) at the same time the PPU is using it. That's why VRAM can only be updated during vblank, or when the sprites+bg are disabled.




SubjectRe: coding problems new  
Posted byJsr
Posted on1/3/03 6:45 PM
From IP62.127.15.243  



You should also put some colors in the palette ram ($3F00), tiles is not visible when they have the same color as the background.




SubjectRe: coding problems  
Posted byle_cholet
Posted on1/4/03 05:13 AM
From IP65.94.51.234  



hummm. I set the PAL option in fceultra and now i am seeing my tiles. Could this be that putting stuff to $2000-$201f (first line) only shows on pal machine? And how an emulator can auto detect PAL/NTSC?




SubjectRe: coding problems new  
Posted byMemblers
Posted on1/4/03 10:30 AM
From IP68.58.99.218  



Hmm, that's something else I didn't consider. On NTSC the top 8 lines (and bottom 8 I think) are drawn but aren't visable on an NTSC TV. I think FCEUltra has an option to show them in NTSC mode.

The emulators can't autodetect PAL/NTSC, at least not with the iNES format. Unless it does a CRC check on the ROM and it has an internal database.




SubjectRe: coding problems new  
Posted byAnonymous
Posted on1/31/03 6:21 PM
From IP12.151.114.40  



As far as I can tell, you're correct about the top row of tiles not being displayed. Since I don't know what hardware or emulators would display them (but I'm sure it's out there), you're probably best off filling in the name table as if they were visible.




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

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo