scmJS docs

MRGN

The locations. A StarCraft 1.00 file (VER 59) has exactly 64 slots, and any later file exactly 255: a Use Map Settings game of a map whose MRGN is any other size stops with Error loading scenario file. Slot 64 is Anywhere. Editors keep it as the whole map, but the game uses the box it holds, as for any other location. StarEdit treats a slot with no name and no size as unused. Melee never reads the locations.

The game takes each box as it is stored, and does not straighten one whose right edge is left of its left edge, or whose bottom is above its top. Conditions that look for units in such a location, such as Bring, never find any. Actions that work from its middle, such as Create Unit, use the point halfway between its edges, as for any other location. (Checked against 1.16.1, with boxes inverted across, and across and down; found playing Remastered for Bring.)

scmJS writes exactly as many slots as the revision takes. When it opens a map whose MRGN is another length, the next save writes it at the right length, and changing the revision adds or removes slots.

The elevation word works the other way round from how StarEdit shows it: a set bit leaves out that elevation, so 0 means the location covers every elevation. Conditions such as Bring only count units on the elevations the location covers.

The location record, byte by byte

Name MRGN (4D 52 47 4E)
Size 20 bytes per location.
Read by The game, at the start of a Use Map Settings game. Melee and the other game types never read it.
Required For Use Map Settings. Without it a Use Map Settings game stops at the start with Error loading scenario file. Melee and the other game types play without it.
The game accepts Exactly 1280 bytes (64 locations) in a VER 59 file, and 5100 (255 locations) in VER 63 and 205, and Remastered's 64 and 206. Any other length refuses the map.
More than one copy The last copy replaces the others. Every copy must be the full size, so a short copy refuses the map rather than overwriting part of the first.
In scmJS Read, and written again when you change what it holds.

Each location:

Offset Type Holds
0 i32 Left edge, in pixels
4 i32 Top edge
8 i32 Right edge
12 i32 Bottom edge
16 u16 Name, a string number
18 u16 Elevations the location leaves out (below)

Elevations:

Bit Meaning
0x01 Low ground
0x02 Medium ground
0x04 High ground
0x08 Low air
0x10 Medium air
0x20 High air

Example#

A location covering five tiles across and four down, for ground units only. The right and bottom edges are the pixel just past the last tile, and the elevation word lists what the location leaves out:

   0  40 01 00 00  left 320 px (tile 10)
   4  80 01 00 00  top 384 px (tile 12)
   8  E0 01 00 00  right 480 px: tiles up to 14
  12  00 02 00 00  bottom 512 px: tiles up to 15
  16  05 00        name: string 5
  18  38 00        leaves out low air, medium air, high air