PPU windowing explanation

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Kaisha
Posts: 14
Joined: Mon Apr 26, 2021 2:58 am

PPU windowing explanation

Post by Kaisha »

I've been using 3 different sources (primarily) to figure out how exactly the windowing/color math system works.
https://www.youtube.com/watch?v=zcoU6-9_fDM&t=182s
https://wiki.superfamicom.org/registers
http://problemkaputt.de/fullsnes.htm#snesppuwindow

The thing is they use different nomenclature and terminology to describe similar things that leaves me a bit confused on the details. So, as I understand...

WH0, WH1, WH2, WH3 are the x-low and x-high coordinates of the two windows. The range [WH0, WH1] inclusive means the pixel is 'inside' window 1, and [WH2, WH3] means the pixel is inside window2. From a logic standpoint '0' or false is outside, '1' or true is inside.

BG1, BG2, BG3, BG4, OBJ, and Color each get a 'line' or bit for each window (12 total), each initialized to a 0 or 1 if it's outside or inside the corresponding window.

Each bit get's possibly inverted by W12SEL, W34SEL, WOBJSEL, and possibly enabled/disabled.

The WBGLOG, WOBJLOG control merging the 12 bits into 6. Then we get to:

http://problemkaputt.de/fullsnes.htm#snesppuwindow says:
The OR/AND/XOR/XNOR logic is applied ONLY if BOTH window 1 and 2 are enabled (in WxxSEL registers). If only one window is enabled, then that window is used as is as "final" area. If both are disabled, then the "final" area will be empty.
Is 'empty' a 0 or 1?

https://wiki.superfamicom.org/registers says:
Neither window enabled => nothing masked.
I'm unsure what they mean by 'empty' or 'nothing masked'. Since '1' is used for 'inside' the window and '0' is used for outside.

https://www.youtube.com/watch?v=zcoU6-9_fDM&t=182s: Specifies that disabled lines are 'inside' the window. So I'm assuming that when both lines are disabled the window logic outputs a 1?

So we have '1' or 'inside' the window referred to as 'empty' or 'nothing masked'?


But then we get a bit further to the TSW and TMW registers.

All 3 sources simply say 'enable' or 'disable'. I assume 'enabled' means leave the bit unchanged, but is disabled a '0' or '1'?

When we get finally to the color masking stage my understanding is that BGs/OBJs who's corresponding bits '1' are made transparent, while those that are '0' are left untouched?

So I'm a bit confused as to the nomenclature...
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: PPU windowing explanation

Post by Oziphantom »

empty = 1 i.e it shows everything
nothing masked means all pixels are shown on the screen, no windowing takes place.

in hardware it probably NANDS things so it will want a 0 to keep the bit rather than a 1 so things probably get inverted at some point which leads to confusion.
I.e colourValue NAND enable

There is a diagram of the system in figure A-23 in book 1 of the SNES development book. It will probably help you understand better.
Kaisha
Posts: 14
Joined: Mon Apr 26, 2021 2:58 am

Re: PPU windowing explanation

Post by Kaisha »

Would have a link to the SNES development book?
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: PPU windowing explanation

Post by creaothceann »

Kaisha wrote: Sat May 01, 2021 9:38 am Would have a link to the SNES development book?
http://www.romhacking.net/?page=documen ... csearch=Go
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
Post Reply