Created
March 25, 2021 22:48
-
-
Save ncot-tech/f51ddcc4bd307f2bc0ccdf3d86772c5d to your computer and use it in GitHub Desktop.
ZX Spectrum Next DMA Layer 2 Screen Clearing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// R3G3B2 | |
void clearLayer2Screen(unsigned char colour) | |
{ | |
unsigned char zero = colour; | |
IO_123B = 0x03; // Top | |
// WR0 | |
IO_6B = 0x79; | |
IO_6B = 0x00; IO_6B = 0x00; // A Start | |
IO_6B = 0x00; IO_6B = 0x40; // 16k | |
// WR1 | |
IO_6B = 0x14; | |
// WR2 | |
IO_6B = 0x30; | |
// WR4 | |
IO_6B = 0xAD; | |
IO_6B = (int)(&zero) & 0x00FF; | |
IO_6B = ((int)(&zero) & 0xFF00) >> 8; | |
// WR5 | |
IO_6B = 0x82; | |
// WR6 (load) | |
IO_6B = 0xCF; | |
// WR6 (enable) | |
IO_6B = 0x87; | |
IO_123B = 0x43; // Middle | |
// WR6 (disable) | |
IO_6B = 0x83; | |
// WR6 (load) | |
IO_6B = 0xCF; | |
// WR6 (enable) | |
IO_6B = 0x87; | |
IO_123B = 0x83; // Bottom | |
// WR6 (disable) | |
IO_6B = 0x83; | |
// WR6 (load) | |
IO_6B = 0xCF; | |
// WR6 (enable) | |
IO_6B = 0x87; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment