# MODE

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite 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
15 = 1280 x 1024 pixels. Monitor sees 1280 x 1024 60Hz
16 = 1920 x 1080 pixels Monitor sees 1920 x 1080 60Hz (G2 only)
17 = 384 x 240 pixels Monitor sees 640 x 480 75Hz

‘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 32 bit (G2 only)
H/W Pixel Format RGB565 ARGB4444 RGB332 ARGB8888
Colours 65536 4096 256 256*256*256
Transparency None 16-levels None None - set to FF
Pages Used 1 2 1 1
Layers 1 2+backgnd 1 1

The numbers of pages available in the various modes are:

Mode Pixels G1 Pages G2 pages
bits 8 12 16 8 12 16 32
Mode 1 800 x 600 7 3 3 16 7 7 3
Mode 2 640 x 400 14 7 7 30 15 15 7
Mode 3 320 x 200 55 26 27 61 57 58 28
Mode 4 480 x 432 16 8 8 36 18 18 8
Mode 5 240 x 216 62 31 32 61 61 61 34
Mode 6 256 x 240 55 27 28 61 60 61 29
Mode 7 320 x 240 43 21 22 61 46 47 21
Mode 8 640 x 480 11 5 5 24 11 11 5
Mode 9 1024 x 768 4 - 2 9 - 4 -
Mode 10 848 x 480 8 3 3 18 8 8 4
Mode 11 1280 x 720 3 - 1 7 - 3 -
Mode 12 960 x 540 5 - 2 12 - 5 -
Mode 13 400 x 300 28 12 13 61 28 29 13
Mode 14 960 x 540 7 3 3
Mode 15 1280 x1024 3 - - 5 - - -
Mode 16 1920 x1080 - - - 3 - - -
Mode 17 384 x 240 35 15 16 68 38 39 16

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, 14 and 16 are in widescreen formats. Mode 16 is G2 only
The display always shows the contents of page 0 (32-bit, 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: 04 July, 2021