nesdev.com
https://forums.nesdev.com/

Choplifter and multiple scroll
https://forums.nesdev.com/viewtopic.php?f=2&t=15001
Page 1 of 1

Author:  Diskover [ Sat Oct 29, 2016 3:13 pm ]
Post subject:  Choplifter and multiple scroll

Choplifter playing, I noticed that several pieces of the background move at different speeds.
Given that the sprite zero is located in the hub, how do the other pieces to move at different speeds?

https://www.youtube.com/watch?v=ybzHtVEvPKA

Author:  tepples [ Sat Oct 29, 2016 3:34 pm ]
Post subject:  Re: Choplifter and multiple scroll

If the cartridge has no programmable interval timer, there are three possibilities for multiple splits:

  1. Time the first split with sprite overflow and the second with sprite 0. That's not what's happening in this particular game, as you said sprite 0 is before the first split.
  2. Spin using 100% CPU to count cycles from sprite 0. The horizontal scrolling test in the NES version of 240p test suite does this, as does the road in Rad Racer.
  3. (Ab)use the DMC as a crude interval timer. I've made a demo of this called DPCM Letterbox. I seem to remember Time Lord and Fire Hawk doing this.

Author:  Diskover [ Sat Oct 29, 2016 3:42 pm ]
Post subject:  Re: Choplifter and multiple scroll

Wow... ok, thanks.

Author:  rainwarrior [ Sat Oct 29, 2016 4:48 pm ]
Post subject:  Re: Choplifter and multiple scroll

Choplifter was one of my favourite SMS games. I didn't know there was a Famicom port of it, so I didn't mind spending a little time checking this out...

Sprite 0 is placed over the bottom left corner of the status bar, an execution breakpoint at $9255 will hit when this is detected.

From here (scanline 33) it seems to do a series of carefully timed (cycle counted code) tasks, eventually updating the scroll position at scanlines 100 and 150 as well.

It looks to me like each task does a little bit of work before calling a common delay routine at $9E2D with a parameter A that I guess is used to align the tasks to some common coarse time unit? (Doesn't seem to be aligned to a scanline.) Like it's a series of short tasks interspersed with long delays from that routine.

The scroll splits are on consistent scanlines but kind of have an inconsistent timing position within those scanlines. I expect the cycle counted code is slightly approximated / incorrect, and maybe that parameterized variable delay function was just a way to tweak timings easily until it seemed to work.

Edit: The particular split points seem to change from level to level, too.

Author:  Diskover [ Sun Oct 30, 2016 3:24 am ]
Post subject:  Re: Choplifter and multiple scroll

Mmm. . . ok, more questions.

With sprite_zero we can move the planes in the X-axis coordinates

Is it possible to move the Y-axis static leaving the rest of the screen?

Author:  rainwarrior [ Sun Oct 30, 2016 3:30 am ]
Post subject:  Re: Choplifter and multiple scroll

Sprite 0 is just a means for timing the split.

You can change both X and Y scroll values at any split. It's simpler to only change X, but the technique for changing Y scroll mid-screen is well understood.

On our wiki: PPU scrolling: Split X/Y scroll

Author:  tokumaru [ Sun Oct 30, 2016 4:27 am ]
Post subject:  Re: Choplifter and multiple scroll

You can't split the screen horizontally though (e.g. the left side of the screen scrolls at a different speed than the right side), because the screen is rendered from top to bottom.

Like rainwarrior said, the sprite 0 hit is just a means for the CPU to know that the PPU has reached a certain point of the screen as it renders the picture, so the program can change something in order to create a "split". You can change the scroll, the emphasis bits, the monochrome bit, switch CHR banks, or anything else you want (such as palettes or OAM) if you're willing to temporarily turn rendering off (which means blank scanlines on screen) in order to modify VRAM, although this is trickier to pull off.

Other means to time splits are the sprite overflow, timed code (from the NMI, from the end of vblank or from a previous split), APU IRQs and mapper IRQs. Some games (e.g. Super Cars, IIRC) even snoop into the sprite evaluation process by reading $2004 to know which part of the screen the PPU is currently rendering.

Author:  Diskover [ Sun Oct 30, 2016 7:48 am ]
Post subject:  Re: Choplifter and multiple scroll

Oh, thanks everybody

Author:  dougeff [ Sun Oct 30, 2016 12:28 pm ]
Post subject:  Re: Choplifter and multiple scroll

The MMC5 mapper can do a crude L / R scroll split.

https://youtu.be/yLiKOePb4bQ

See topic...
viewtopic.php?f=10&t=14083

Author:  Dwedit [ Sun Oct 30, 2016 12:48 pm ]
Post subject:  Re: Choplifter and multiple scroll

I bet you could do that split vertical effect without a mapper, since it's coarse scrolling and at a low framerate. Easily enough PPU time to blast out that much within a few frames, then swap to another nametable.

Author:  tepples [ Sun Oct 30, 2016 1:01 pm ]
Post subject:  Re: Choplifter and multiple scroll

That specific split vertical effect with a 10-tile-wide scrolling window is possible without a mapper. I'd provide proof, but BPS would object.

Author:  rainwarrior [ Sun Oct 30, 2016 2:36 pm ]
Post subject:  Re: Choplifter and multiple scroll

BPS?

Author:  tepples [ Sun Oct 30, 2016 3:47 pm ]
Post subject:  Re: Choplifter and multiple scroll

The demo of soft scrolling that I mentioned is a game that I made back in 2009, but which I later pulled from the Internet after Blue Planet Software aka The Tetris Company started winning lawsuits.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/