0

The following tables are modified and corrected from Painting pixels: Introduction to video memory.

  • m-bit: memory bit
  • p-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 0s, then four 1s), 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?

  • Making the p-bits run in numerical sequence would require that p-bit 1 of pixel 0 come from a different place in modes 0 and 1. – supercat Feb 7 at 23:23
  • @supercat Yes, I mentioned that in the question. – CJ Dennis Feb 7 at 23:25
  • Making p-bit 1 of pixel 0 come from a different place in modes 0 and 1 would require routing circuitry which can be omitted if the bits are arranged as you show them. – supercat Feb 7 at 23:30
  • @supercat The pixels are displayed at different points on the screen due to being different widths. Perhaps 0 | 2 | 4 | 8 | 0 | 2 | 4 | 8 & 0 | 4 | 0 | 4 | 0 | 4 | 0 | 4 make more sense. – CJ Dennis Feb 7 at 23:32
  • 2
    @supercat An answer that addresses this from a hardware perspective of the 6845 CRTC would be good. – CJ Dennis Feb 8 at 1:09
2

According to the CPC schematic, the Armstrad uses a gate array to generate video, so we'd need to know how this gate array is programmed for an exact explanation.

But expanding on the comment of supercat, we can do an educated guess:

Assume we have an 8 bit shift register in the gate array, with a tap for bit C0 at the end, a tap for bit C1 in the middle, a tap for bit C2 two bits from the end and a tap for bit C3 two bits from the other end. These 4 bits C0..C3 go to the color generation part. Picture:

D0 ---> D1 -+-> D2 ---> D3 -+-> D4 ---> D5 -+-> D6 ---> D7 --+
            |               |               |                |
            V               V               V                V
           C3              C1              C2               C0

Then for Mode 2, we can clamp all bits except bit 0 to zero, for two colors in the format given above.

For Mode 1, we only clamp bits C3 and C2 to zero, leaving bit C0 and bit C1 for four colors in the format given above.

And finally for Mode 0, there is no clamping, leaving all four bits for 16 colors in the format given above.

If you wanted a more "logical" format for Mode 0 instead, you'd need extra logic to swap around the four bits from the way they can also be used in Mode 1 and Mode 2 to the way you want for Mode 0. The gate array doesn't contain this extra logic, because it would use up gates that can be used for other purposes, and therefore you end up with the "weird" ordering.

| improve this answer | |
1

I am not an expert in Amstrad CPC at all, however I can see some regularities, for example:

  1. Not grouping pixel bits in halves (like pixel 0 takes bits 7..4 and pixel 1 takes bits 3..0) allows one to use single shift register, that always shifts by 1 bit. In mode 2, it shifts 8 times for 8 pixels, in mode 1 it shifts 4 times for 4 pixels, where one pixel is always taken from bits 7 and 3, second one from bits 6 and 2, etc. Same with mode 0, where every of two pixels takes its bits from 4 positions in the shift register.

  2. A funny bit layout in mode 0 also has its logic, because, in comparison with mode 1, half of bits for a pixel are taken from the same positions. For "0-0-1-1-2-2-3-3" layout, there would be only single such position.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.