MODE

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

Syntax:
MODE r, bits [, bg [, int]]
MODE mode [, palette]

Description:

For the CMM2:

MODE r, bits [, bg [, int]]
Set the format for the VGA video output.

'r' is the screen resolution. It is a number from 1 to 13 as follows:
1 = 800 x 600 pixels Monitor sees 800 x 600 60Hz
2 = 640 x 400 pixels Monitor sees 640 x 480 75Hz
3 = 320 x 200 pixels Monitor sees 640 x 480 75Hz
4 = 480 x 432 pixels Monitor sees 640 x 480 75Hz
5 = 240 x 216 pixels Monitor sees 640 x 480 75Hz
6 = 256 x 240 pixels Monitor sees 640 x 480 75Hz
7 = 320 x 240 pixels Monitor sees 640 x 480 75Hz
8 = 640 x 480 pixels Monitor sees 640 x 480 75Hz
9 = 1024 x 768 pixels (12-bit mode not available) Monitor sees 1024 x 768 60Hz
10 = 848 x 480 pixels (widescreen format) Monitor sees 848 x 480 60Hz
11 = 1280 x 720 pixels (widescreen format 12-bit mode not available) Monitor sees 1280 x 720 60Hz
12 = 960 x 540 pixels (widescreen format 12-bit mode not available) Monitor sees 1920 x 1080 60Hz
13 = 400 x 300 pixels Monitor sees 800 x 600 60Hz
14 = 960 x 540 pixels (widescreen format 12-bit mode not available) Monitor sees 960 x 540 60Hz

‘bits' is the colour depth and can be 8, 12, or 16 – see the table below.
‘bg’ is the background colour and can be used in the 12-bit mode. 
If pixels in layer 0 are not set to solid (transparency = 15) then the background will show through as determined by the transparency value of the pixel. 
This parameter is ignored in 8 and 16-bit modes.
‘int’ is a subroutine that will be called at the start of frame blanking.

The specifications of the colour depth ('bits') are:

                     16-bit       12-bit       8-bit
H/W Pixel Format      RGB565      ARGB4444     RGB332
Colours               65536         4096        256
Transparency           None       16-levels     None
Pages Used               1           2           1
Layers                   1        2+backgnd      1

The numbers of pages available in the various modes are:

      Mode               Pixels             Pages
Mode 1,8 1,12 1,16       800 x 600         7,  3,  3
Mode 2,8 2,12 2,16       640 x 400        14,  7,  7
Mode 3,8 3,12 3,16       320 x 200        55, 26, 27
Mode 4,8 4,12 4,16       480 x 432        16,  8,  8
Mode 5,8 5,12 5,16       240 x 216        62, 31, 32
Mode 6,8 6,12 6,16       256 x 240        55, 27, 28
Mode 7,8 7,12 7,16       320 x 240        43, 21, 22
Mode 8,8 8,12 8,16       640 x 480        11,  5,  5
Mode 9,8  -   9,16      1024 x 768         4, - ,  2
Mode 10,8 10,12 10,16    848 x 480         8,  3,  3
Mode 11,8 -  11,16      1280 x 720         3, - ,  1
Mode 12,8 -  12,16       960 x 540         5, - ,  2
Mode 13,8 13,12 13,16    400 x 300        28, 12, 13
Mode 14,8 14,12 14,16    960 x 540         7,  3,  3


All modes other than 10,11, 12 and 14 work perfectly with monitors that have an aspect ratio of 4:3 or widescreen monitors that can switch to that ratio (most widescreen monitors will do this automatically).
Modes 10,11,12 and 14 are in widescreen formats
The display always shows the contents of page 0 (16-bit and 8-bit) and pages 0 and 1 (12-bit). Use PAGE WRITE and PAGE COPY to avoid flashing and tearing artefacts.
For 12-bit colour depth page 0 is the lower level and page 1 the upper so the stack is: background, page 0, page 1 with each one overwriting the previous in turn as defined by the transparency values of each individual pixel.
MM.INFO(MAX PAGES) and MM.INFO(PAGE ADDRESS n) are useful if you wish to PEEK or POKE the video memory. 
In all cases the memory is arranged as a two dimensional array x,y so, to get the address of a specific pixel on a specific page n,:
With an 8-bit colour depth you would use:
add% =MM.INFO(page address n)+ y* mm.hres +x
For 12 or 16-bit colour depth you would use
add% =MM.INFO(page address n)+ (y* mm.hres +x) * 2
For modes 3 and 5 each line is duplicated to get square pixels so Y needs to be multiplied by 2 for PEEK and both lines y*2 and Y*2+1 need to be POKEd. 
Eg, for an 8-bit colour depth:
add1% = MM.INFO(page address n)+ (y * 2) * MM.HRES + x
add2% = MM.INFO(page address n)+ (y * 2 + 1) * MM.HRES + x
For the 12 and 16-bit modes you can use POKE SHORT and PEEK(SHORT) which are designed for this purpose.

The current mode can be determined by MM.INFO(MODE)

LIST PAGES will list all the pages and memory address for the current mode.

For the CMM1:

MODE mode [, palette]
Sets the number of colours that can be displayed on the screen. 'mode' can be:
1 Monochrome mode. 'palette' will select the colour to use and can be 0 to 7 representing the colours black to white. This mode provides complete compatibility with programs written for the monochrome Maximite

2 Four colour mode. 'palette' can be a number from 1 to 6 and will select the range of colours available (see table below).

3 Eight colour mode. In this mode all eight colours (including black and white) can be used. 'palette' can be supplied but will be ignored.

4 240x216 pixel resolution with all eight colours (including black and white) available. 'palette' can be supplied but will be ignored.

In mode 2 the colours available in each palette are:
palette = 1 Black, Red, Green, Yellow
palette = 2 Black, Red, Blue, Purple
palette = 3 Black, Red, Cyan, White
palette = 4 Black, Green, Blue, Cyan
palette = 5 Black, Green, Purple, White
palette = 6 Black, Blue, Yellow, White

The MODE command allows the programmer to trade the number of colours used and resolution against the amount of memory required by the video driver. 
Modes 1 and 4 use the least amount of memory while mode 3 uses the most.

A useful test card program to se all the modes in action.

 

Last edited: 23 January, 2021