MAP

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

Syntax:
MAP( n ) = rgb% 
MAP MAXIMITE
MAP( n ) = rgb% 
MAP( n ) = rgb% 

Description:

MAP 
The MAP commands allow the programmer to set the colours used in 8-bit colour modes. 
Each value in the 8-bit colour pallet can be set to an independent 24-bit colour.

MAP( n ) = rgb% 
This will assign the 24-bit colour 'rgb% to all pixels with the 8-bit colour value of 'n'. The change is activated after the MAP SET command

MAP MAXIMITE
This will set the colour map to the colours implemented in the original Colour Maximite.

MAP SET 
This will cause MMBasic to update the colour map (set using MAP(n)=rgb%) during the next frame blanking interval.

MAP RESET 
This will reset the colour map to the default colours. This map is used to assign 24-bit colours to individual values in the 8-bit colour space.

 ' Set up an array to hold the colour mappings we are going to use
 DIM INTEGER cmap(6)
 
 'Clear the screen
 CLS
 
 'Set up 6 colours in the array
 cmap(1)=RGB(RED)
 cmap(2)=RGB(GREEN)
 cmap(3)=RGB(BLUE)
 cmap(4)=RGB(YELLOW)
 cmap(5)=RGB(MAGENTA)
 cmap(6)=RGB(CYAN)
 
 ' Do an initial update of the CLUT to set up our colours
 mapclut
 
 'Display an outer circle in white
 CIRCLE MM.HRES/2,MM.VRES/2,MM.VRES/2-1,0,,RGB(WHITE),RGB(WHITE)
 
 ' Now draw a simple colour pie chart using our new colours with the ARC command
 ARC MM.HRES/2,MM.VRES/2,0,MM.VRES/2-10,0,60,MAP(1)
 ARC MM.HRES/2,MM.VRES/2,0,MM.VRES/2-10,60,120,MAP(2)
 ARC MM.HRES/2,MM.VRES/2,0,MM.VRES/2-10,120,180,MAP(3)
 ARC MM.HRES/2,MM.VRES/2,0,MM.VRES/2-10,180,240,MAP(4)
 ARC MM.HRES/2,MM.VRES/2,0,MM.VRES/2-10,240,300,MAP(5)
 ARC MM.HRES/2,MM.VRES/2,0,MM.VRES/2-10,300,360,MAP(6)
 
 ' Start a never ending loop
 DO
   
   ' each time round the loop move the colours in our array one place to the left
   ' Use array element 0 to store the first element that is going to be at the end
   cmap(0)=cmap(1)
   cmap(1)=cmap(2)
   cmap(2)=cmap(3)
   cmap(3)=cmap(4)
   cmap(4)=cmap(5)
   cmap(5)=cmap(6)
   cmap(6)=cmap(0)
   
   ' reset the colour map
   mapclut
   
   ' pause so we can see the change
   PAUSE 200
 LOOP
 
 ' This subroutine updates the colour map for the colours we are using
 ' set map positions 1 to 6 to the new colours
 ' then apply the change
SUB mapclut
 MAP(1)=cmap(1)
 MAP(2)=cmap(2)
 MAP(3)=cmap(3)
 MAP(4)=cmap(4)
 MAP(5)=cmap(5)
 MAP(6)=cmap(6)
 MAP set
END SUB

 

Last edited: 30 September, 2020