Thanks to Julio Marchi for this space in MSX All
 

MSX 1 Screen Pattern

  Most MSX 1 graphic editors are based on the screen 2.
  Screen 2 is based on a great mosaic composed by 8x8 pixel blocks, as depicted on the next figure.

0                                 31
┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘ 23


  The sequence of these blocks, based on the screen layout, is presented on the next diagram.

 +-----------------------------+
 | 000 001 002 003 ... 030 031 |
 | 032 033 034 035 ... 062 063 |
 | ...                         |
 | 736 737 738 739 ... 766 767 |
 +-----------------------------+

  Obs: decimal values.

  Each block has 8x8 pixels, where each line is represented by one byte. So, each block has 8 bytes. See the illustration below.

┌─┬─┬─┬─┬─┬─┬─┬─┐
│ │ │ │ │ │ │ │ │ Line 0
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 1
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 2
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 3
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 4
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 5
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 6
├─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │ │ │ Line 7
└─┴─┴─┴─┴─┴─┴─┴─┘


  The screen 2 is composed by 32x24 blocks of 8x8 pixels each. Thus, we can draw pictures for this screen mode using any dimensions always based on blocks of 8x8 pixels and the screen 2 layout.


  Graphos III

  The Graphos III shapes may range from 1x1 to 30x22 blocks, or, from 8x8 to 240x176 pixels.

  Example for a picture with 5x4 blocks:

Screen     Blocks numeration

0    5 
┌┬┬┬┬┐      00 01 02 03 04
├┼┼┼┼┤      05 06 07 08 09
├┼┼┼┼┤      10 11 12 13 14
├┼┼┼┼┤      15 16 17 18 19
└┴┴┴┴┘ 4



  Print-Master

  The Print-Master ".PM?" file has 512x192 pixels, or, 64x24 blocks. This size cannot be changed.


  Pseudo-algorithm to read/write an image file

variables: 
  p, x, y : integer;
  heigh, width, D, line : integer;
  save : boolean;

begin
  p ← 7;
  save ← false;

  for y ← 0 to height step 8 do
  begin
    for x ← 0 to width step 8 do
    begin
      for line ← 0 to 7 do
      begin
        if (save = true) then
        begin
          D ← val(p);
          change_line(D);
        else
          D ← read_line();
          val(p) ← D;
        end_if
        p ← p + 1;
      end_for
    end_for
  end_for

end_program

  Where the variables "width" and "height" must be multiple of 8.


  Data representation

  Each line from an 8x8 block make use of two tables to store the data: the character table and the color table. The color table stores the front and background colors for each 8x1 pixels line. The character table contains the color pattern for each 8x1 pixels line.
  Data configuration:

Character table: 
bit 0 = front color
bit 1 = background color

Color table:
4 MSb = front color
4 LSb = background color


  How to calculate the initial address for a block BL in VRAM:

10 EP = 8*BL        ' Character table
20 EC = 8192 + 8*BL ' Color table


  The next example creates a line with alternate colors cyan and magenta, at line 2, block 4:

10 SCREEN 2
20 BL=4
30 EP = 8*BL        ' Character table
40 EC = 8192 + 8*BL ' Color table
50 L=2
60 VPOKE EP+L,&B10101010 ' Pattrern: 10101010
70 VPOKE EC+L,&B01111101 ' Front:7, BG:13


  Configuration for B&W pixels

  Both Graphos III and Page-Maker set the front color (ink) as 1 and the background color (paper) as 15. According to that, their color tables are filled with values &H1F.
  On the character table, these programs use the value 1 to represent the black color whereas the value 0 to represente the white color.


Marcelo Silveira
Systems and Computing Engineer
Expert in Image Processing and Artificial Intelligence
© MarMSX 1999-2025