Jump to navigationJump to search

The MXS lump is a series of fixed-width records, each of which contains 1 full screen backdrop. These backdrops can be used as battle backgrounds, the title screen, cutscenes or whatever. This same file format is used for both backgrounds(MXS) and tilesets(TIL).

Each record is 64,000 bytes long. Each byte is a pixel, and an index into the master palette.

The ordering of the pixels is in accordance with the Mode-X video raw layout. It is comprised of 4 planes. The first plane holds the pixels where (x is in the series [0,4,8,12,..]), the second holds the pixels where (x is in [1,5,9,13..]), the third holds the pixels where (x is in [2,6,10,14..]), and the fourth holds the pixels where (x is in [3,7,11,15..]). so, each plane is 80 pixels wide by 200 pixels high; you read plane0, plane1, plane2, plane3 from the file and place them in the appropriate location for their plane. (essentially, coordinates = (plane_num + (x * 4), y) if x is the x position in the plane (from 0..79))

A graphical representation (in English) is available here: ModeX Format

A loop to blit the raw data might look like this: (This is a code snippet from OHRFB)

dim x as integer, y as integer, l as integer, dat(63999) as UByte '0 to 63999
'... load data from .MXS into dat()
' FScreen is the backdrop buffer, so I only have to do this once
for j = 0 to 3
	for y = 0 to 199
		for x = j to 319 STEP 4
			putpixel FScreen,x,y,dat(l)
			l += 1