MZM file format: MZX image

This file format is a simple format that describes graphically a 
 rectangular area.
 
b = byte (8bit)
w = word (16bit)
d = dword (32bit)
sN = string of N size (ie N bytes)
bN = N bytes
wN = N words
dN = N dwords

header:

pos  size  description
0     s4    "MZMX" tag
4     b     width
5     b     height
6
.           reserved
f           

data:

The data is composed of w * h (width * height) blocks, where each
 block is 6 bytes and contains the following:

pos  size  description
0     b     ID (5 for overlay)
1     b     param (char for overlay)
2     b     color
3     b     under ID (0 for overlay)
4     b     under param (0 for overlay)
5     b     under color (0 for overlay)



MZM2 file format:

This file format is a simple format that describes graphically a 
 rectangular area.
 
b = byte (8bit)
w = word (16bit)
d = dword (32bit)
sN = string of N size (ie N bytes)

header:

pos  size  description
0     s4    "MZM2" tag
4     w     width
6     w     height
8			d			location in file of robot table (0 for no table)
c			b			number of robots
d			b			storage mode
e			b			robot storage mode
f           reserved           

data:

Width * height cells are then stored.

In storage mode 0 the cells consist of the following 6 bytes:

pos  size  description
0     b     ID
1     b     param
2     b     color
3     b     under ID
4     b     under param
5     b     under color

All robots are stored with param 0.

In storage mode 1, the cells consist of the following 2 bytes:

pos  size  description
0     b		  character
1			b		  color	

Then, an optional robot table may be stored. The table consists of n
robots listed in the same order that their representative ID's appear
in the cell table.

The robots comply to the MZX 2 world format in mode 0 and MZX 2.80
save format in mode 1. Reserved fields are in place to retain compatability
with the MZX 2 world format (and thus can be loaded by an MZX 2 compatabile
loader)

If the robot storage mode is 0, the robot data is as follows:

pos  size  description
 0    w     program length
 2          reserved
 4		s15		robot name
 13   b     robot character
 .
 .					reserved
 29   
 . 				  robot program, stored in MZX2 Robotic bytecode format
 ??


If the robot storage mode is 1, the robot data is as follows:

pos  size  description
 0    w     program length
 2          reserved
 4		s15		robot name
 13   b     robot character
 14		w		  current line
 16		b		  current position in line
 17		b		  current cycle
 18		b			cycle total
 19		b			bullet type
 1A		b		  locked status
 1B		b		  lavawalk status
 1C		b			walking direction
 1D		b		  last touched direction
 1E		b		  last shot direction
 1F					 
 .				  reserved
 .
 23		b		  status
 24					 
 .				  reserved
 .
 27				  loop counter
 29   d32		local counters
 49   d			stack size
 4D		d			stack pointer
 51		
 .					stack (stack size bytes)
 ??
 . 				  robot program, stored in MZX2 Robotic bytecode format
 ??



