CPC Guide - Graphics formatGraphics Defining graphics This shows how the pixels are formed. Mode 0 Mode 1 Mode 2 Mode 0 In mode 0, there are 2 pixels per byte. Each pixel can be one of 16 colours. (The pixel is 4 times the size of a mode 2 pixel). The pixels are numbered p1 and p2. p1 is the left pixel, p2 is the right pixel. p1 and p2 contain a number in the range 0..15. Screen Byte +--+--+--+--+--+--+--+--+ |7.|6 |5.|4 |3.|2 |1.|0 | |..| |..| |..| |..| | +--+--+--+--+--+--+--+--+ ^ ^ ^ ^ | | | | | ___| | | | | ______| | |__|__|___ | | | | | __|__|__|________| | | | | | | | | +--+--+--+--+ |3 |2 |1 |0 | | | | | | +--+--+--+--+ p1 Byte +--+--+--+--+--+--+--+--+ |7 |6,|5 |4,|3 |2,|1 |0,| | |,,| |,,| |,,| |,,| +--+--+--+--+--+--+--+--+ ^ ^ ^ ^ | | | | | ___| | | | | ______| | |__|__|___ | | | | | __|__|__|________| | | | | | | | | +--+--+--+--+ |3 |2 |1 |0 | | | | | | +--+--+--+--+ p2 Mode 1 In mode 1, there are 4 pixels per byte. Each pixel can be one of 4 colours. (The pixel is 2 times the size of a mode 2 pixel). The pixels are numbered p1, p2, p3 and p4. p1 is the leftmost pixel, and p4 is the rightmost pixel. p1,p2,p3,p4 contain a number in the range 0..3. Note: In this mode the pixels are square. Screen Byte +--+--+--+--+--+--+--+--+ |7.|6 |5 |4 |3.|2 |1 |0 | |..| | | |..| | | | +--+--+--+--+--+--+--+--+ ^ ^ | | | | |__ | | | __|________| | | +--+--+ p1 |1 |0 | | | | +--+--+ Screen Byte +--+--+--+--+--+--+--+--+ |7 |6,|5 |4 |3 |2,|1 |0 | | |,,| | | |,,| | | +--+--+--+--+--+--+--+--+ ^ ^ | | | | |__ | | | __|________| | | +--+--+ p2 |1 |0 | | | | +--+--+ Screen Byte +--+--+--+--+--+--+--+--+ |7 |6 |5-|4 |3 |2 |1-|0 | | | |--| | | |--| | +--+--+--+--+--+--+--+--+ ^ ^ | | | | |__ | | | __|________| | | +--+--+ p3 |1 |0 | | | | +--+--+ Screen Byte +--+--+--+--+--+--+--+--+ |7 |6 |5 |4*|3 |2 |1 |0*| | | | |**| | | |**| +--+--+--+--+--+--+--+--+ ^ ^ | | | | |__ | | | __|________| | | +--+--+ p4 |1 |0 | | | | +--+--+ Mode 2 In mode 2, there are 8 pixels per byte. Each pixel can be one of 2 colours. Each bit of the byte is a pixel. If the bit value is 0, then pen 0 is used, if the bit value is 1, then pen 1 is used. The pixels are numbered p1, p2, p3, p4, p5, p6, p7 and p8. p1 is the leftmost pixel and p8 is the rightmost pixel. p1,p2,p3,p4,p5,p6,p7,p8 contain 0 or 1. The bits for each pixel are shown below: Byte +--+--+--+--+--+--+--+--+ |7 |6 |5 |4 |3 |2 |1 |0 | | | | | | | | | | +--+--+--+--+--+--+--+--+ ^ ^ ^ ^ ^ ^ ^ ^ +--+ | | | | | | | |______ |0 | p8 | | | | | | | | | | | | | | | | +--+ | | | | | | | | | | | | | |__________ +--+ | | | | | | |0 | p7 | | | | | | | | | | | | | | +--+ | | | | | | | | | | | |_____________ +--+ | | | | | |0 | p6 | | | | | | | | | | | | +--+ | | | | | | | | | |________________ +--+ | | | | |0 | p5 | | | | | | | | | | +--+ | | | | | | | |___________________ +--+ | | | |0 | p4 | | | | | | | | +--+ | | | | | |______________________ +--+ | | |0 | p3 | | | | | | +--+ | | | |_________________________ +--+ | |0 | p2 | | | | +--+ +--+ |0 | p1 | | +--+