nesdev.parodius.com Forum Index nesdev.parodius.com
NES Development and Strangulation Records message boards
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Level designing
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    nesdev.parodius.com Forum Index -> NESdev
View previous topic :: View next topic  
Author Message
Celius



Joined: 05 Jun 2005
Posts: 1941
Location: Minneapolis, Minnesota, United States

PostPosted: Thu Jul 28, 2005 3:21 pm    Post subject: Reply with quote

Yeah it looked more like the maze than it did before. At first it was just glitchy flashing screen type things happening, but I actually see it helped a bit, but not completely, if that makes any sense.
Back to top
View user's profile Send private message Visit poster's website
beneficii



Joined: 12 Jul 2005
Posts: 118

PostPosted: Thu Jul 28, 2005 3:36 pm    Post subject: Reply with quote

Celius wrote:
Yeah it looked more like the maze than it did before. At first it was just glitchy flashing screen type things happening, but I actually see it helped a bit, but not completely, if that makes any sense.


What do you do on the NMI? Is your NMI turned on?
Back to top
View user's profile Send private message Send e-mail
Celius



Joined: 05 Jun 2005
Posts: 1941
Location: Minneapolis, Minnesota, United States

PostPosted: Thu Jul 28, 2005 3:46 pm    Post subject: Reply with quote

yes my nmi is enabled via $2000. Here is my code:

Code:

;ines crap

   .zp
vbl_count:
   .ds 1

         ;vector info
         .dw nmi
         .dw reset
         .dw irq ;I'm not even going to bother showing you my irq routine

reset:
   lda   #0
   sta   vbl_count
   
   lda   #%10000000
   sta   $2000
   lda   #%00011110
   sta   $2001

        ;pallete stuff

main_loop:
         jsr   wait_vbl   
   

   lda   #HIGH(sprites)
   sta   $4014

   jsr   handle_joypad
   jsr   makemaze
   jmp   main_loop

wait_vbl:
   lda   vbl_count
wait_vbl_change:
   cmp   vbl_count
   beq   wait_vbl_change
   rts
nmi:   
        inc   vbl_count
   rti

        ;maze data
        ;handle joypad
        ;etc.


Is there something wrong with this? or is it just really unreliable. Confused By the way, alot of this stuff I didn't include, because I'm too lazy. There really are variables I used for sprite DMA, I just didn't include them in this code right above.
Back to top
View user's profile Send private message Visit poster's website
beneficii



Joined: 12 Jul 2005
Posts: 118

PostPosted: Thu Jul 28, 2005 4:01 pm    Post subject: Reply with quote

At the beginning of the NMI, try setting $2006 to $0000 like this:

Code:

lda $2002
lda #$00
sta $2006
sta $2006


Essentially, on every NMI you'll want to set $2006 to the nametable you want to show minus $2000. Since you want to show the $2000 nametable, then you should put it as $0000. If you wanted to show the $2800 nametable, then $0800 would be your way. You can also start in the middle of a nametable, like at $2305, which would become $0305.

If you do any $2006/$2007 writes, then afterward you will still need to set $2006 to what I mentioned in the paragraph. In other words, when you leave the NMI, you're going to need to have $2006 set to that value.

Understand?

Try it out btw. Post the results. ^_^
Back to top
View user's profile Send private message Send e-mail
Celius



Joined: 05 Jun 2005
Posts: 1941
Location: Minneapolis, Minnesota, United States

PostPosted: Thu Jul 28, 2005 4:14 pm    Post subject: Reply with quote

Whoa, you can do that? so I could say this:

lda $2002
lda #$00
sta $2006
lda #$01
sta $2006

to start at the second line of the name table? or just in the middle of the name table, or wherever it is. But I tried your suggestion, and it still only works on Jnes and (if you give an att's rass) Nesticle. Nintedulator goes phsyco, VirtuaNes is kind of working more, it displays the top 4 rows of the maze, and is doing something kind of like fuzz on the tv, except its like lines, going insane on some of the tiles. It's weird. Do you want to see my FULL code to see if I did something wrong?
Back to top
View user's profile Send private message Visit poster's website
beneficii



Joined: 12 Jul 2005
Posts: 118

PostPosted: Thu Jul 28, 2005 4:44 pm    Post subject: Reply with quote

Celius wrote:
Whoa, you can do that? so I could say this:

lda $2002
lda #$00
sta $2006
lda #$01
sta $2006

to start at the second line of the name table? or just in the middle of the name table, or wherever it is. But I tried your suggestion, and it still only works on Jnes and (if you give an att's rass) Nesticle. Nintedulator goes phsyco, VirtuaNes is kind of working more, it displays the top 4 rows of the maze, and is doing something kind of like fuzz on the tv, except its like lines, going insane on some of the tiles. It's weird. Do you want to see my FULL code to see if I did something wrong?


Pretty much. I'm simplifying things a bit. (That example will have it start on the second pixel of the first line.)

Anyway, if you're program's still not working, then perhaps you can send me the source code along with the ROM and I'll see what's wrong. K?
Back to top
View user's profile Send private message Send e-mail
Disch



Joined: 10 Nov 2004
Posts: 1587

PostPosted: Thu Jul 28, 2005 5:27 pm    Post subject: Reply with quote

I must speak up against this advice.

For one -- setting the PPU address to $0001 (what you do in your example, Celius) will start rendering from the second column not the second row. That basically has the same effect as scrolling the screen left 8 pixels.


For two -- this is exactly what $2005 is for. Not only is it MUCH easier to use for this kind of thing, but it also allows you to fine-scroll horizontally and vertically (scroll by pixels instead of by full 8-pixel tiles)

Using $2006 for scrolling should only be done when you're splitting the screen -- and the only reason it's recommended then is because it's manditory.

To start drawing from the second row... use this code instead:

Code:

BIT $2002  ; same effect as LDA $2002, but does not change A

LDA #$00
STA $2000  ; select nametable 0 (ppu$2000)
STA $2005  ; set X scroll to 0 pixels
LDA #$08
STA $2005  ; set Y scroll to 8 pixels (one row)


After you set scroll values, do NOT mess with $2006 (do the above code after you've finished all your drawing). And make sure rendering is on before VBlank ends (flip on $2001.4 or $2001.3 or both)
Back to top
View user's profile Send private message
beneficii



Joined: 12 Jul 2005
Posts: 118

PostPosted: Thu Jul 28, 2005 5:53 pm    Post subject: Reply with quote

Disch wrote:
I must speak up against this advice.

For one -- setting the PPU address to $0001 (what you do in your example, Celius) will start rendering from the second column not the second row. That basically has the same effect as scrolling the screen left 8 pixels.


For two -- this is exactly what $2005 is for. Not only is it MUCH easier to use for this kind of thing, but it also allows you to fine-scroll horizontally and vertically (scroll by pixels instead of by full 8-pixel tiles)

Using $2006 for scrolling should only be done when you're splitting the screen -- and the only reason it's recommended then is because it's manditory.

To start drawing from the second row... use this code instead:

Code:

BIT $2002  ; same effect as LDA $2002, but does not change A

LDA #$00
STA $2000  ; select nametable 0 (ppu$2000)
STA $2005  ; set X scroll to 0 pixels
LDA #$08
STA $2005  ; set Y scroll to 8 pixels (one row)


After you set scroll values, do NOT mess with $2006 (do the above code after you've finished all your drawing). And make sure rendering is on before VBlank ends (flip on $2001.4 or $2001.3 or both)


Yeah, I should have said tile, which would have fit with column more. That's right Celius, things get much more complicated.

Then again, I'm not sure if Celius was trying to scroll.

Disch, I never did recommend that he do $2006 like that, I was just trying to explain the effects (which I did wrongly).
Back to top
View user's profile Send private message Send e-mail
Celius



Joined: 05 Jun 2005
Posts: 1941
Location: Minneapolis, Minnesota, United States

PostPosted: Thu Jul 28, 2005 6:10 pm    Post subject: Reply with quote

Yeah, I wasn't trying to scroll. I am so bad at scrolling, it's embarrasing. I don't know too much about scrolling, and I will save that for a later day. But yes, I will send you my source, and we'll see what we can do, okay? okay. Smile
Back to top
View user's profile Send private message Visit poster's website
beneficii



Joined: 12 Jul 2005
Posts: 118

PostPosted: Thu Jul 28, 2005 6:16 pm    Post subject: Reply with quote

Celius wrote:
Yeah, I wasn't trying to scroll. I am so bad at scrolling, it's embarrasing. I don't know too much about scrolling, and I will save that for a later day. But yes, I will send you my source, and we'll see what we can do, okay? okay. Smile


It's not that difficult. Just read from $2002, then the first write to $2005 will be the horizontal scroll (in pixels, not tiles) and the second write to $2005 will be the vertical scroll (again, in pixels). Try it!

BTW, how will I be receiving the source?
Back to top
View user's profile Send private message Send e-mail
Celius



Joined: 05 Jun 2005
Posts: 1941
Location: Minneapolis, Minnesota, United States

PostPosted: Thu Jul 28, 2005 6:20 pm    Post subject: Reply with quote

I will email it to you, and you can just give me your address in a private message if you don't want it to be seen. By the way, when it scrolls like this:

lda #$01
sta $2005

will it just scroll 1 pixel per vblank? Or what is the timing?
Back to top
View user's profile Send private message Visit poster's website
beneficii



Joined: 12 Jul 2005
Posts: 118

PostPosted: Thu Jul 28, 2005 6:31 pm    Post subject: Reply with quote

Celius wrote:
I will email it to you, and you can just give me your address in a private message if you don't want it to be seen. By the way, when it scrolls like this:

lda #$01
sta $2005

will it just scroll 1 pixel per vblank? Or what is the timing?


No, it won't. It'll simply set the scroll to one pixel over to the right (if that's the horizontal scroll) and there it will remain until the value is changed. Remember what Disch said: You also have to set $2006 as well to your current nametable. If you want one scroll per vblank, try something like:

Code:
nmi:
   pha
   lda $2002
   lda #$00
   sta $2006
   sta $2006
   inc <$30
   lda $2002
   lda <$30
   sta $2005
   lda #$00
   sta $2005
   pla
   rti


Remember to have zero page address $30 starting off at zero!
Back to top
View user's profile Send private message Send e-mail
Quietust



Joined: 19 Sep 2004
Posts: 1028

PostPosted: Thu Jul 28, 2005 9:21 pm    Post subject: Reply with quote

beneficii wrote:
You also have to set $2006 as well to your current nametable.


No you don't - when you want to set your current nametable for rendering, you write to $2000 and specify your desired nametable in the bottom 2 bits (do this along with the reading $2002 and writing $2005 stuff).
Back to top
View user's profile Send private message
Disch



Joined: 10 Nov 2004
Posts: 1587

PostPosted: Thu Jul 28, 2005 9:53 pm    Post subject: Reply with quote

Celius wrote:

lda #$01
sta $2005

will it just scroll 1 pixel per vblank? Or what is the timing?


Setting the scroll is setting where the screen starts drawing from. Here's a few diagrams which might explain. The diagrams represent the two upper nametables (PPU $2000 [upper-left] and $2400 [upper-right]). dots (.) represent the part of the nametables which is not visible. # represents the areas that are visible:

Code:

##########..........
##########..........
##########..........
##########..........
##########..........


This represents scroll values of 0 (X=0, Y=0). The upper-left portion of the # block is where the screen starts drawing from.

Now say you change scroll values so that you scroll halfway through the nametable (X=$80) :

Code:

.....##########.....
.....##########.....
.....##########.....
.....##########.....
.....##########.....


The game is drawing the same nametables, it's just starting to draw from a different area. In this case, it's drawing from further right in the nametable (which will make the screen appear to be moved left)


Now -- you should be setting scroll values every frame -- and the value you write for that frame is where the screen draws from in that frame. There is no "rate" or anything -- it just draws from where you tell it to. If you want to game to appear to scroll in a direction, you will have to constantly change the values you write.

For example, in beneficii's example, every frame he is writing a NEW value to the X scroll. He has is so that the X scroll will be 1 more than it was last frame (making the screen scroll 1 pixel per frame).

Although beneficii is still writing to $2006 -- which you shouldn't do. For now, you should only be using $2006 for drawing (with $2007). For scrolling, you use only $2000, and $2005 (and $2002 to clear the toggle -- but you should only have to do that once at the start of NMI)
Back to top
View user's profile Send private message
Celius



Joined: 05 Jun 2005
Posts: 1941
Location: Minneapolis, Minnesota, United States

PostPosted: Thu Jul 28, 2005 10:47 pm    Post subject: Reply with quote

I think i understand scrolling now. I think I am going to make a couple programs for my current projects. I could design them, I just am not so good with programming opening files and saving files. Do you think it will be alright to make programs with C, and not C++? Because I only know C at the moment. I am not sure how to just jump right into hibber jibber, and ouput stuff on the screen. I don't know how to make a program open a .chr file and put the data on the screen! Is it really hard? Do you know where I could find out how to?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    nesdev.parodius.com Forum Index -> NESdev All times are GMT - 7 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 2 of 8

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group