The following tables are modified and corrected from Painting pixels: Introduction to video memory.
m-bit
: memory bitp-bit
: pixel bit
Mode 2 - 640x200 (half width pixels), 2 colours
m-bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
------+---+---+---+---+---+---+---+---
pixel | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
p-bit | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
Mode 1 - 320x200 (single width pixels), 4 colours
m-bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
------+---+---+---+---+---+---+---+---
pixel | 0 | 1 | 2 | 3 | 0 | 1 | 2 | 3
p-bit | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1
Mode 0 - 160x200 (double width pixels), 16 colours
m-bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
------+---+---+---+---+---+---+---+---
pixel | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1
p-bit | 0 | 0 | 2 | 2 | 1 | 1 | 3 | 3
The arrangement of pixels makes sense for each mode. One ascending group of eight pixels, two ascending groups of four pixels, four ascending groups of two pixels.
The bit patterns per pixel make sense for modes 2 (all 0
) & 1 (four 0
s, then four 1
s), although it might have made more sense to have the high bits first. However, for mode 0 it goes 0
, 2
, 1
, 3
(2
& 1
are swapped compared to ascending order). Why not use simple ascending order?
I assume there was some advantage to aligning memory bits 3
& 2
(and also 7
& 6
) to their pixel bits between modes 1 and 0.
Why was this design chosen?
0 | 2 | 4 | 8 | 0 | 2 | 4 | 8
&0 | 4 | 0 | 4 | 0 | 4 | 0 | 4
make more sense. – CJ Dennis Feb 7 '20 at 23:32