Jump to content
IGNORED

Split Screen Scrolling


jacobus

Recommended Posts

My son and I are trying to write a two player game. The basic concept is a shared playfield viewed through two independently scrolling windows (top and bottom of the screen). I'm having some issues implementing the split screen scrolling - issues centered mostly around the fact I have no clue how to do this.

 

I've created a nice horizontally scrolling playfield with a non-scrolling score/status area in the middle. (10 lines of Antic mode 6, 4 of mode 2 and another 10 of Antic 6) Each line in the Display List has a separate LMS instruction with the appropriate fine scrolling bits set. So far so good. In this version, the playfield scrolls through both windows in the same direction at the same time. Obviously what I need to do is to create some kind of independence between the top and the bottom half of the screen.

 

SCROLL.xex

 

My first thought was to modify the Display List during the VBI in order to alternatively turn off scrolling for each window (by re-setting bits 4 and 5 of each LMS instruction). Unfortunately this causes nothing but flickering garbage.

 

Would it be better to have pre-defined two separate DLs (one with scrolling enabled for the top, and the other with scrolling enabled for the bottom) and alternate between them?

 

Am I way out to lunch on this? Is there a different/better way? Help, please!

Link to comment
Share on other sites

Stuff to note:

 

. with the VScrolling, the last line of each area to scroll should have the bit turned off in the display list entry.

. HScrol/VScrol register values. For the top, set the registers in VBlank immediate. For the bottom you'll need a DLI.

 

I don't see any point in alternately turning scrolling off in the DList. Since you have LMS setup everywhere already, you're halfway there. All you need to do is have the VBlank code set each LMS according to window position.

 

e.g. for a game like Nautilus with e.g. 4 screens horizontal by 20 lines high - set the origin in first LMS. Second LMS in the mode you're using would be 80 bytes after the first. Then keep adding.

 

When scrolling like you want it can be easier to just keep an origin X/Y for each window and adjust the LMS and scroll registers by bit shifting/masking tricks.

Link to comment
Share on other sites

Thanks for the responses, let me try to unpack some of them.

 

. HScrol/VScrol register values. For the top, set the registers in VBlank immediate. For the bottom you'll need a DLI.

 

OK, for the top window, I set the FS registers in the VBI as I am doing now. And I won't need to do anything in the DLI for this window - correct? For the bottom window I should create a DLI that sets the registers on each line, or only on the last?

 

I don't see any point in alternately turning scrolling off in the DList. Since you have LMS setup everywhere already, you're halfway there. All you need to do is have the VBlank code set each LMS according to window position.

 

I am using this technique to effect coarse scrolling right now - it's setting the the single HSCROL register to produce fine scrolling in two directions at the same time that is driving me nuts.

 

 

thanks!

Link to comment
Share on other sites

For what you want, you only need to set the scroll registers once for each window.

 

One thing you need to consider is the 4K boundary, ie don't let the screen data cross it. For a simple V-scroller it's easy enough but for something scrolling both ways it becomes more complex.

 

Until you get it going at least, probably best to limit the screen data so it won't cross a 4K boundary.

Link to comment
Share on other sites

Thanks for the responses, let me try to unpack some of them.

 

 

 

OK, for the top window, I set the FS registers in the VBI as I am doing now. And I won't need to do anything in the DLI for this window - correct? For the bottom window I should create a DLI that sets the registers on each line, or only on the last?

 

 

 

I am using this technique to effect coarse scrolling right now - it's setting the the single HSCROL register to produce fine scrolling in two directions at the same time that is driving me nuts.

 

 

thanks!

 

If you have scrolling working for the whole screen

- setting HSCROL and VSCROL registers ($d404/5 I think)

- changing DL for coarse scrolling

 

 

Then going to vertical split screen should be really easy.

As already suggested put ONE DLI AFTER the top window and reset HSCROL/VSCROL. Further, do not forget to change the DL lines for the bottom window as well.

That's all thre is AFAIK

 

One important thing about vertical scrolling already mentioned by Rybags:

Vertical fine scrolling is ONLY done when the VSCROL-bit in the DL is CHANGED!

So it affects only the first line, as the bit is switched from 0 to 1 and the line when the bit is set back to 0. All lines in between are just rendered as always (for example ANTIC 4: 8 scan-lines).

Vertical fines scrolling is basically just starting the mode-line VSCROL scan-lines later and finish the last mode line 8-VSCROL (considering ANTIC 4) earlier. All these details are in the Altirra HW Reference book.

 

That is the reason why the last mode-line of the top AND bottom windows must have VSCROL bit cleared!

Link to comment
Share on other sites

OK, progress!

 

Horizontal scrolling is working properly - Both windows scroll smoothly and independently!!! The upper window scrolls vertically quite well, but I can't seem to divorce the lower window from it - please see demo.

 

I did break the 4K boundary - could this be responsible for what's happening with the lower window?

 

SCROLL.XEX

demo requires two joysticks

 

My Display List looks like this:

post-11281-0-60536500-1350354363_thumb.jpg

 

Thanks very much to everyone who offered (and will hopefully continue to offer) suggestions!

Edited by jacobus
Link to comment
Share on other sites

You are writing VSCROL too late to affect the start of the second window -- backing the DLI up one mode line fixes it. It's better to avoid writing VSCROL or HSCROL right at the start or end of a scrolling region if you can as the timing window for doing it correctly is very tight.

Link to comment
Share on other sites

Just had a quick look on your DLI code and you are not saving content of accumulator. Add PHA at the start of DLI code and PLA at the end. (don't know if it will fix your vscrol problem, but it's wrong)

You are writing VSCROL too late to affect the start of the second window -- backing the DLI up one mode line fixes it. It's better to avoid writing VSCROL or HSCROL right at the start or end of a scrolling region if you can as the timing window for doing it correctly is very tight.

 

Thanks very much, I followed both suggestions and together they seem have done the trick! Attached is the WIP with extremely wide playfield, independent scrolling and everything moving very quickly and smoothly. Next update will be when I have significantly more progress - or another serious issue (hopefully not). Thanks again!

 

Scroll2.xex (requires two joysticks)

  • Like 1
Link to comment
Share on other sites

Thanks very much, I followed both suggestions and together they seem have done the trick! Attached is the WIP with extremely wide playfield, independent scrolling and everything moving very quickly and smoothly. Next update will be when I have significantly more progress - or another serious issue (hopefully not). Thanks again!

 

Scroll2.xex (requires two joysticks)

That's really nice.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...