Windows

Windows are used to hide layers from regions of the screen. On a per-scanline basis, they can be used to cut out areas of:
 * Background layers (BG1, BG2, BG3, BG4)
 * The Sprite layer (OBJ)
 * Color math

Registers
See: PPU registers: Windows

Window
The SNES has two window devices.

Each window has a left and right pixel position (WH0/WH1/WH2/WH3) where the window should hide the affected layers. The window effect (1 output) is at left <= X <= right. If left > right then the window is disabled (all 0 output). HDMA can be used to create shapes by adjusting the left/right position for each scanline.

If the window is inverted (W12SEL/W34SEL), the left/right position instead defines where the window should not hide the affected layers.

Additionally if two windows are enabled for the same layer, boolean logic can be applied between them (WBGLOG/WOBJSEL). An individual window is 0 when showing the layer, and 1 when hiding it. This logic will combine the effect of both windows in the chosen way.

Finally, windows can be selectively applied to the main screen and sub screen (TMW/TSW) or their color math combination (CGWSEL).