It is currently Fri Nov 17, 2017 7:51 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 124 posts ]  Go to page 1, 2, 3, 4, 5 ... 9  Next
Author Message
PostPosted: Mon Jul 07, 2014 10:49 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 800
I know this has been discussed before, but I can't find any reference to a conclusion.

Was it tested? Does anyone know if you can change BG modes mid-scanline?

If not, is it possible to change scroll parameters (and matrix parameters, if in mode 7) in order to fake it?

I don't have a flash cart, and probably won't any time soon, so I can't test it myself, but this and a couple of other questions have been driving me nuts...

byuu (bsnes v089 release) wrote:
Air Strike Patrol surprises us with a second mid-scanline raster effect, which disproved an older theory of mine on the BG scroll registers, and is now emulated correctly as well.


Top
 Profile  
 
PostPosted: Mon Jul 07, 2014 11:48 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7265
Location: Chexbres, VD, Switzerland
Quote:
Does anyone know if you can change BG modes mid-scanline?

Well, it's obvious you can, but what effect it will have is a mystery.

I can test things for you on my Super Power Pak and PAL SNES if there's a need to, but I can only do so if you give me a ROM. I know few things about the 65816 and SNES hardware, really so I can't code a demo myself.


Top
 Profile  
 
PostPosted: Mon Jul 07, 2014 11:49 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
I believe there are commercial games which do switch modes mid-scanline. But right now it's late and my brain can't remember which of them which do it...

Summoning byuu! :)


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 1:54 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 800
Bregalad wrote:
I can test things for you on my Super Power Pak and PAL SNES if there's a need to, but I can only do so if you give me a ROM. I know few things about the 65816 and SNES hardware, really so I can't code a demo myself.

Thanks for the offer. I may take you up on it once I'm halfway competent at this myself...

koitsu wrote:
I believe there are commercial games which do switch modes mid-scanline. But right now it's late and my brain can't remember which of them which do it...

That would honestly surprise me. The way it's been talked about in the past makes it sound like an edge case among edge cases. Scroll positions, maybe, but modes?

Granted, the information I have is patchy and stale - I'm very new to the SNES programming scene...


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 4:48 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
Yeah, I'm thinking modes -- as in part of the screen is operating in MODE 1 and another part is operating in MODE 3. I just wish I could remember which games did this.

Hmm, now that I'm thinking about it, and this is just me pondering (I haven't taken the time to investigate), but possibly Super Mario World uses it during boss battles (main background/playfield is MODE 7 but the score/life/coin bar is probably some other mode?) or Contra 3 (2nd stage, entire screen rotates as the player moves around, same during the boss battle, while there's a status bar at the top). I suppose the status bars in question could be done with sprites though. Just dumping thoughts as I go here...


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 5:03 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19221
Location: NE Indiana, USA (NTSC)
I think many of the mode 7 racing games (like F-Zero and Super Mario Kart) use another mode for the horizon area, but not changing during the scanline.


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 5:41 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
tepples wrote:
I think many of the mode 7 racing games (like F-Zero and Super Mario Kart) use another mode for the horizon area, but not changing during the scanline.

SNES modes affect the entire screen, so I don't know how someone would accomplish that without either HDMA (writing to $2105 at a specific scanline, hence changing mode), or through $4209/420a (letting you pick a scanline in the register and when the raster gun hits that scanline, the code at the NMI vector is called, and NMI would change $2105).


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 5:46 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19221
Location: NE Indiana, USA (NTSC)
Yeah, I was thinking rewrite the mode in a vcount interrupt handler.


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 6:46 pm 
Offline

Joined: Wed Jul 09, 2008 8:46 pm
Posts: 238
I thought of using a H-Blank IRQ to change the BG Mode as a possibility under the condition that the GUI actually covered up the background in the process. I could also in theory do this for a port that I am considering, using Mode 7 to simplify the pixel drawing process (I am going to use this to zoom in a display that would normally be very small), but using a different BG mode for displaying something else.


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 7:53 pm 
Offline

Joined: Mon Mar 27, 2006 5:23 pm
Posts: 1339
koitsu wrote:
I believe there are commercial games which do switch modes mid-scanline. But right now it's late and my brain can't remember which of them which do it...

Summoning byuu! :)


Mid-frame, yeah, all the time. Mid-scanline, nah, some games toggle BG layers on and off in the middle of a scanline, more of a timing issue usually caused by using IRQs instead of HDMA. ASP also messes with BGSCROLL mid-scanline to surprisingly good effect. And of course ASP also does INIDISP (display brightness) mid-scanline, to less successful effect due to the impreciseness of IRQs to cycle positions.

You can definitely write to BGMODE in the middle of a scanline, but I don't know what the consequences will be, as I am too afraid to try it. A lot of registers are cached at various times during the scanline. If BGMODE isn't one of them (and it wouldn't surprise me if it weren't), then you'd probably get what looks like gibberish for the rest of the scanline.

Emulating the PPUs perfectly would require perfectly capturing when each variable was read, and mastering the state machine that manipulates those values during rendering. Could easily sink another 5+ years of full-time research into that and likely not even come close to nailing down the extreme edge cases.

The practical use, if you could actually pull this off ... would be to have the left-hand side of the screen be one mode (say a text display that wouldn't work with sprites for some made-up reason) and the right-hand side be another mode (probably mode 7.) Ostensibly with black filler pixels between the two sides of the screen. Not all that useful. Sprites are pretty versatile. Maybe doing hires text/art on one side, and mode7 on the other, would be sufficiently unique ...


Top
 Profile  
 
PostPosted: Fri Jul 11, 2014 10:51 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
Hey thanks byuu. Your reply actually made me realise a big mistake on my part:

The subject in question was with regards to mid-scanline mode changes (as in changing $2105 outside of HBlank), and I even said "there are commercial games which do switch modes mid-scanline".

But what I said is false/inaccurate -- what I was thinking of (as my subsequent replies implied) were games that tweaked $2105 at the end of a scanline / during HBlank (I even have a SNES music pack demo that does that (and boy does it make emulators angry, but I haven't tried bsnes/higan, I imagine that probably gets it right)).

No, I don't know of any games that do mid-scanline mode changes, just ones doing it during HBlank.

I guess I wasted a bit of everyone's time. Sorry folks. I should have paid closer attention/read more slowly.


Top
 Profile  
 
PostPosted: Sat Jul 12, 2014 12:42 am 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 800
byuu wrote:
You can definitely write to BGMODE in the middle of a scanline, but I don't know what the consequences will be, as I am too afraid to try it.

Thanks for the response. Unless another heavy gun like nocash has been messing with this, I guess it's safe to assume no one knows.

Though the fact that scroll parameters can be changed is encouraging - if the matrix can be changed too, it might be possible to fake a mode change, though I imagine you'd have to mask some garble with sprites (or turn the BG off) because it would take a while to hit up all those registers even with DMA...

Quote:
The practical use, if you could actually pull this off ... would be to have the left-hand side of the screen be one mode (say a text display that wouldn't work with sprites for some made-up reason) and the right-hand side be another mode (probably mode 7.) Ostensibly with black filler pixels between the two sides of the screen. Not all that useful. Sprites are pretty versatile. Maybe doing hires text/art on one side, and mode7 on the other, would be sufficiently unique ...

I do have a scenario in mind. It's a port, so I don't have much design freedom, and the result is that I am so overloaded with sprites that I'm not sure I can reliably stay under the scanline limit (or the global limit for that matter) even if this trick works perfectly. Nerfing the game is an absolute last resort; gameplay fidelity comes ahead of visual fidelity - but I'd still like as much visual fidelity as possible...

koitsu wrote:
Sorry folks.

I kinda figured that might be what you meant, especially after seeing the subsequent conversation. And you did mention you were tired...


Top
 Profile  
 
PostPosted: Sat Jul 12, 2014 5:33 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7265
Location: Chexbres, VD, Switzerland
Pehaps you should post a screenshot of what you're wanting to do, so we can help you.

I doubt any emu support midscanline mode change, so if the hardware supports that, your ROM will probably be hardware-only (until BSNES starts to support this).


Top
 Profile  
 
PostPosted: Sat Jul 12, 2014 3:21 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 800
Bregalad wrote:
Pehaps you should post a screenshot of what you're wanting to do, so we can help you.

Perhaps I should, now that I've mentioned the idea. And I appreciate your willingness to help. But I have a possibly irrational desire to keep this as far under my hat as I can for as long as I can. Part of it is that I'd really rather not look like I'm promising something I can't actually pull off, or that will take so long as to be effectively the same thing (ever heard of the Nearly Upright?)...

I will say this: It's a bullet hell game. The score/lives/etc. are on a textured overlay next to the playfield. There are way too many independently-moving bullets for the SNES to have a hope of handling them as sprites, so I plan to blit them with the Super FX chip. The trouble I'm referring to with sprites happens when the playfield is in Mode 7, because I don't have a background layer to blit to. This means that in the general case the whole playfield is covered in a layer of tiled sprites, which doesn't include the player, the player's bullets or any enemies or powerups unless I can jam them into the palette I'm using for the enemy bullets. I could rearrange the screen to get the HUD out of the playfield's scanline range, but I'd really rather not...

...

Fool's errand? Maybe. I haven't seen anything yet that looks like an obvious showstopper, but every part of this game seems to be pushing the system in some way; I had to trim the title screen vertically a bit because I ran out of VRAM and DMA bandwidth at the same time...

This is why I like the project; it's marginal. People have actually said that it's impossible, no way no how, and I disagree. But it's also why I'm asking questions now - I want to establish what's possible before I start.

Quote:
I doubt any emu support midscanline mode change, so if the hardware supports that, your ROM will probably be hardware-only (until BSNES starts to support this).

I'm cool with that, as long as I can get my hands on a dev cart with the hardware I need (GSU2, MSU1, maxed-out Game Pak ROM/RAM as well as a full load of backup RAM and a bunch of extra ROM the GSU doesn't know about, which according to the manual is something you can do)... I'm hoping the sd2snes ends up being that dev cart; it's easily the most promising option I'm aware of...

Besides, if I can show something useful working on hardware, at least in the context of a finished game, I'm sure higan will support it before too long...


Top
 Profile  
 
PostPosted: Sat Jul 12, 2014 3:46 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19221
Location: NE Indiana, USA (NTSC)
Perhaps the hardware you need is a Game Boy Advance, which has a 4x overdraw for sprites and the ability to rewrite OAM mid-frame.

Do you have a screenshot of a comparable game in the same genre? Or should I just say "perfect cherry blossom" and leave it at that?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 124 posts ]  Go to page 1, 2, 3, 4, 5 ... 9  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 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