It is currently Sun Oct 22, 2017 6:53 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Sun Jun 05, 2005 7:53 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2131
Location: Minneapolis, Minnesota, United States
Well, if I knew how to scroll before hand, I think I would use some of that code without seeing the example, if you know what I'm saying. But thank you for all the help, now I know how to scroll! yay! thanks :) !

-Celius


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 8:15 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2131
Location: Minneapolis, Minnesota, United States
okay, what instruction do you stop a scroll with? BRK? i don't know.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 8:53 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
There's no instruction. There's no stopping a scroll. You set the scroll to what you want -- it doesn't automatically move, you have to move it. The above example constantly updates the 'x_scroll_distance' var (with an inc command). That var gets moved to $2005 at the start of every frame -- which constantly scrolls the screen one pixel a frame.

But like I said, don't try to build on the above example -- write your own.

First write to $2005 = X scroll
Second write to $2005 = Y scroll
Low 2 bits of $2000 = Nametable scroll

^ That is all you need to know! Just write to those regs every frame with whatever values you want to scroll the screen exactly where you want it! There's no trick or anything -- that's all you have to do. ^

So -- if you want to scroll the screen right... say... 160 pixels at a rate of 20 pixels per frame, you would write 20 to the X scroll the first frame, then 40, then 60, etc until you hit 160, at which point you would stop changing your scroll value.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 05, 2005 9:05 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2131
Location: Minneapolis, Minnesota, United States
okay, but just so you know, I tried stopping an automatic scroll (which there is such a thing) with the BRK instruction, and my titlescreen moved to the center of the screen and stopped. I just wrote BRK right after the example scrolling code. But I do get what you're saying.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 6:22 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
No, there is no such thing as an automatic scroll. You have to write the desired scroll values yourself. It doesn't change them automatically.

Don't use the example code! It was just an example! If you want to have full control of how the screen scrolls you will want to write your own scrolling code.

BRK will throw a software IRQ (jump to your IRQ vector). Since you're probably not jumping back to your scrolling code, you're not scrolling the screen anymore (if you even have a proper IRQ vector -- its very possible BRK is just locking up your whole program by jumping to garbage code). At any rate... BRK has nothing to do with the screen scrolling.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 9:12 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7234
Location: Chexbres, VD, Switzerland
I think, that you shall first write something simpler to understand how the NES works before writing a scrooling stuff. When you'll understand the basics, you'll be able to do more interessting stuff, like scrooling.
Anyway, even if you don't scroll at all, you must clear $2005 after all $2006/$2007 writes in a VBlank (I remember the first time I've written a code for the NES, I uploaded the $2005 scrooling BEFORE uploading the palette via $2006/$2007, so the scroling get modified by the $2006 register and I've searched for months why my thing wasn't shown on the screen (the picture was out of the screen because of the odd scrooling value)).

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 3:16 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2131
Location: Minneapolis, Minnesota, United States
How would you define the INC instruction? :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 3:24 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2131
Location: Minneapolis, Minnesota, United States
nevermind, you don't have to answer that.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


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