Layer 2 is an additional graphics feature on the Next. It provides a 256-color screen at the full 256x192 resolution, in which every pixel is individually colored. Layer 2 may appear in place of, behind, or above the ULA-generated screen.
At this moment the enabled Layer 2 prevents turbo mode 14MHz to be stable, the ZX Next will thus drop the speed to 7MHz automatically when video-out signal for the central 256x192 pixel area of screen is generated. For remaining areas of screen (border, and H/V-blanks) the CPU will operate at desired 14MHz speed even with Layer 2 enabled.
Documentation on Layer 2 is extremely sparse at the moment and could be subject to change. Information below has been taken from emulator documentation.
The Layer 2 screen occupies 48k, which is stored in 3 consecutive banks. By default, banks 8-10 are used for the main Layer 2 screen and banks 11-13 for the shadow Layer 2 screen. These can be changed using Layer 2 RAM Page Register ($12) and Layer 2 RAM Shadow Page Register ($13).
Each pixel of Layer 2 is assigned 1 byte of video memory. This means Layer 2 consumes a total of 48k. Since the Spectrum banks are 16k, Layer 2 is divided horizontally into 3 banks of 64 lines each, each of which is exactly 16k.
Layer 2 is controlled via Layer 2 Access Port ($123B), which is bit mapped as follows:
|6-7||Video RAM bank select|
|3||Shadow Layer 2 RAM select|
|1||Layer 2 visible|
|0||Enable Layer 2 write paging|
When bit 0 of $123B is set to 1, the appropriate area of Layer 2 video memory (as set by bits 6-7) is accessed by writes into slot 1, ie memory area $0000-$3fff (see Memory map). This prevents any conflict since this area would normally be ROM and thus useless to write to. However, you cannot READ the contents of Layer 2 via this mapping! Reading addresses in this range will read the values from the ROM page (or RAM bank if in AllRam mode) that would be mapped there normally if Layer 2 were disabled.
If you need to read from Layer 2 you can use the regular banking ports to switch in one of the Layer 2 banks in slot for at $C000. This will allow you to read and write the memory as usual. The ability to write to Layer 2 via writes into slot 1 is provided for convenience and to allow graphics data to be easily copied from extended RAM banks.
Pixels are drawn to Layer 2 by writing to the appropriate area of RAM. Layer 2 pixels are in English reading order with no ULA-style interlacing. Since there are 256 pixels per line, and when using access via slot 1 the memory port starts at $0000, the upper byte of the address exactly equals the Y coordinate (within the selected third of the screen) and the lower byte exactly equals the X coordinate.
Note that you will need to manually clear the Layer 2 screen before drawing on it, as it may contain random data when the machine starts up.
When ZX Spectrum 128k Memory Paging Control ($7FFD) is used to switch display to ULA "shadow" variant, the Layer 2 is automatically disabled, due to ULA screen data being read from other memory bank. For double-buffered ULA screen together with Layer 2 functionality, use the Timex Sinclair Video Mode Control ($xxFF) functionality.
To use double-buffered scheme for Layer 2, think about Layer 2 RAM Page Register ($12) being display related (i.e. has to be changed to display new Layer 2, when the new image is already prepared) (or it may be modified also during frame to compose final image from various memory areas), while Layer 2 RAM Shadow Page Register ($13) is related only to write-over-ROM functionality (Layer 2 Access Port ($123B)).