// 8. About map data specifications //

Below, I present the detailed specifications of the "M08" and "M8D" format map data generated by this editor.
When created map data with this editor, please import its data to other applications you want to use by referring to the detailed specifications below.

// 8-1. About "M08" format map data //

Header information : (0x0000 ~ 0x000F, 16 bytes)

0x0000 ~ 0x0002 : Identification extension ($38304d = "M08")
0x0003 : (unused)
0x0004 ~ 0x0005 : Map's width (2 bytes)
0x0006 ~ 0x0007 : Map's height (2 bytes)
0x0008 : Index information 1
0x0009 : Index information 2
0x000A : Index information 3
0x000B : Index information 4
0x000C ~ 0x000F : (unused)

Map data's area : (0x0010 ~ ????, Varies with map size)

If the upper left corner coordinates of the map are (0,0), the data arrangement is as below :

0x0010 : Coordinate (0,0)
0x0011 : Coordinate (0,1)
0x0012 : Coordinate (0,2)
:
:
0x001F : Coordinate (0,15)

As described above, the data of the first line will be arranged and stored 1 byte at a time first.
When the data in the 1st line reaches the end point of the X coordinate, the storage of the data in the 2nd line will be started next in the same manner.
This process will be repeated until the last line to store all data.
(Up to 256 patterns per chip, No. 0 to 255)

// Data import script example (@ HSP36) //

	;---------------------------------------------------------------
	; mp_wd			Map's width
	; mp_ht			Map's height
	; mp_indx(4)		Index information
	; mp(mp_wd,mp_ht)	2D array variable pf the map data
	;---------------------------------------------------------------

	;------------ Import from 'M08' format map data file
	tmp_ldname="filename"	; "filename" = target data file's name
	sdim tmp,64
	bload tmp_ldname,tmp,64	; Import header part
	;------------ Get map width and height value
	mp_wd=wpeek(tmp,4)	: mp_ht=wpeek(tmp,6)
	;------------ Get index information's value
	repeat 4
		mp_indx(cnt)=peek(tmp,8+cnt)
	loop
	;------------ Import map data (Single)
	sdim tmpmpd,mp_wd*mp_ht			; Full length of map data
	bload tmp_ldname,tmpmpd,mp_wd*mp_ht,16	; Loading map data body
	repeat mp_ht
		a2=cnt
		repeat mp_wd
			a1=cnt
			mp(a1,a2)=peek(tmpmpd,a2*mp_wd+a1)
		loop
	loop
	;------------ Process end

// 8-2. About "M8D" format map data //

Header information : (0x0000 ~ 0x000F, 16 bytes)

0x0000 ~ 0x0002 : Identification extension ($38304d = "M8D")
0x0003 : (unused)
0x0004 ~ 0x0005 : Map's width (2 bytes)
0x0006 ~ 0x0007 : Map's height (2 bytes)
0x0008 : Map[1]'s index information 1
0x0009 : Map[1]'s index information 2
0x000A : Map[1]'s index information 3
0x000B : Map[1]'s index information 4
0x000C : Map[2]'s index information 1
0x000D : Map[2]'s index information 2
0x000E : Map[2]'s index information 3
0x000F : Map[2]'s index information 4

Map data's area : (0x0010 ~ [add1], Varies with map size)

If the upper left corner coordinates of the map are (0,0), the data arrangement is as below :

0x0010 : Map[1]'s coordinate (0,0)
0x0011 : Map[2]'s coordinate (0,0)
0x0012 : Map[1]'s coordinate (0,1)
0x0013 : Map[2]'s coordinate (0,1)
:
:
0x001E : Map[1]'s coordinate (0,7)
0x001F : Map[2]'s coordinate (0,7)

As described above, the data of maps 1 and 2 from the starting point (0,0) are alternately arranged and stored every 1 byte.
Other specifications are basically the same as the above "M08" format.
And this process will be repeated until the last line to store all data.

Map's name for maps 1 and 2 : ([add1]+1 ~ [add1]+128)

Character string data of map names of maps 1 and 2 displaying on the edit screen will be stored after the map data storage area.
The maximum string length for each map name is 64 characters (64 bytes).

[add1] +1 ~ +64 : Map[1]'s character string of name
[add1] +65 ~ +128 : Map[2]'s character string of name

// Data import script example (@ HSP36) //

	;---------------------------------------------------------------
	; mp_wd			Map's width
	; mp_ht			Map's height
	; mp_indx(4,2)		Index information (2 dimension)
	; mp(mp_wd,mp_ht,2)	2D array variable pf the map data (x2 dim)
	;---------------------------------------------------------------

	;------------ Import from 'M08' format map data file
	tmp_ldname="filename"	; "filename" = target data file's name
	sdim tmp,64
	bload tmp_ldname,tmp,64	; Import header part
	;------------ Get map width and height value
	mp_wd=wpeek(tmp,4)	: mp_ht=wpeek(tmp,6)
	;------------ Get index information's value
	repeat 2
		a2=cnt
		repeat 4
			a1=cnt
			mp_indx(a1,a2)=peek(tmp,8+a2*4+a1)
		loop
	loop
	;------------ Import map data (Double)
	sdim tmpmpd,mp_wd*mp_ht*2		; Full length of map data
	bload tmp_ldname,tmpmpd,mp_wd*mp_ht*2,16 ; Loading map data body
	repeat mp_ht
		a2=cnt
		repeat mp_wd
			a1=cnt
			mp(a1,a2,0)=peek(tmpmpd,a2*mp_wd*2+a1*2)
			mp(a1,a2,1)=peek(tmpmpd,a2*mp_wd*2+a1*2+1)
		loop
	loop
	;------------ Process end