It is currently Wed Nov 21, 2018 7:34 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Namtable woes
PostPosted: Tue Oct 16, 2018 8:41 am 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 146
Location: Colorado
When I was looking through rainwarrior's ca65 template, setting up the nametable seemed pretty straight forward. He was using the x and y register and looping 960 times doing a STA on $2007. I was able to play around with that code and thought I understood it. But when I'm trying that in the game I'm working on, it seems to only be setting the left column of background tiles.

I'm calling this proc on reset:
Code:
.proc load_background
    stx nametable_reg_x
    sty nametable_reg_y

    lda PPU_STATUS        ; PPU_STATUS = $2002
    lda #$20
    sta PPU_ADDR          ; PPU_ADDR = $2006
    lda #$00
    sta PPU_ADDR          ; PPU_ADDR = $2006
    ldx #32              ; start out at 0
    lda #2
    background_x_loop:
        ldy #30

        background_y_loop:
            sta PPU_DATA      ; PPU_DATA = $2007
            dey
        bpl background_y_loop ; loop until y == -1
        dex
    bpl background_x_loop  ; loop until x == -1

    ldx nametable_reg_x
    ldy nametable_reg_y
    rts     
.endproc


Attachments:
File comment: Notice the left column has the letter 'B' which is tile #2 in my CHR
nesteroids.nes [40.02 KiB]
Downloaded 22 times

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
Top
 Profile  
 
 Post subject: Re: Namtable woes
PostPosted: Tue Oct 16, 2018 9:01 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2334
Location: DIGDUG
Are you sure PPU control $2000 is set to +1 mode and not +32 mode?

xxxx x0xx

This bit should be zero.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: Namtable woes
PostPosted: Tue Oct 16, 2018 9:07 am 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 146
Location: Colorado
dougeff wrote:
Are you sure PPU control $2000 is set to +1 mode and not +32 mode?

xxxx x0xx

This bit should be zero.


It was set to 0 because I'm writing to PPU Address $2000. Is that not right?

Thanks

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
 Post subject: Re: Namtable woes
PostPosted: Tue Oct 16, 2018 9:09 am 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 146
Location: Colorado
dougeff wrote:
Are you sure PPU control $2000 is set to +1 mode and not +32 mode?

xxxx x0xx

This bit should be zero.


Actually you were right. I was setting $2000 to #%10011100 earlier than I thought I was.

Thanks!

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group