	1 * 1	00 04 06 01 FRUIT_TRACK
		08 "ISRR"

		// Sprite layout
		1A 04
			// 00 (x)
			43
			\dx000003F4 \wx0002 // ground sprite - track
			10 // register
			\dx8000042D \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842D \wx0006 // fruit back
			00 00 00 // x/y/z offset
			10 03 0A // x/y/z extent
			11 13 // register
			\dx8000842D \wx0006 // fruit front
			00 0D 00 // x/y/z offset
			10 03 0A // x/y/z extent
			12 13 // register

			// 01 (y)
			43
			\dx000003F3 \wx0002 // ground sprite - track
			10 // register
			\dx8000042E \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80008431 \wx0006 // fruit back
			00 00 00 // x/y/z offset
			03 10 0A // x/y/z extent
			11 13 // register
			\dx80008431 \wx0006 // fruit front
			0D 00 00 // x/y/z offset
			03 10 0A // x/y/z extent
			12 13 // register

			// 02 (x) - purchase
			43
			\dx000003F4 \wx0000 // ground sprite - track
			\dx8000042D \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000042D \wx0000 // fruit back
			00 00 00 // x/y/z offset
			10 03 0A // x/y/z extent
			\dx8000042E \wx0000 // fruit front
			00 0D 00 // x/y/z offset
			10 03 0A // x/y/z extent

			// 03 (y) - purchase
			43
			\dx000003F3 \wx0000 // ground sprite - track
			\dx8000042E \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80000431 \wx0000 // fruit back
			00 00 00 // x/y/z offset
			03 10 0A // x/y/z extent
			\dx80000432 \wx0000 // fruit front
			0D 00 00 // x/y/z offset
			03 10 0A // x/y/z extent

		0B 02 // use callback for sprite layout

		10 \w600 // set little/lots threshold
		12 \dx00002000 // cargo types for randomisation triggers

		11 FF // pylon placement (all)


// Real sprites
// ------------
	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FD 04 04 // ground overlay sprites
		\wx00E2 // fruit sprites

	// Test variable 10 for real sprites - no fruit
	1 * 1	02 04 1C // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FD 04 04 // ground overlay sprites
		\wx00E1 // fruit sprites - empty

	// Select fruit variety back
	1 * 1	02 04 40 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8003
		\wx8000
		\wx8001
		\wx8002

	// Select fruit variety front
	1 * 1	02 04 41 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8000
		\wx8001
		\wx8002
		\wx8003

//@@WARNING DISABLE 100

	// Fruit
	1 * 1	02 04 20 // ID
		85
		1A // all bits on
		20 \w0 // no recolour needed for fruit
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0012 // store in register
		\2rst
		7E BE // get normal/snow/desert offset
		20 \wx7FFF
		\2+
		7E BD // add monorail/maglev offset
		20 \wx00FF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx001B \w0 \w0
		\wx001B

	// Beans
	1 * 1	02 04 22 // ID
		85
		7F 10 // read parameter for recolour sprite base
		20 \wx7FFF
		\2+
		1A // all bits on
		20 \w15 // add offset of recolour sprite for beans
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0012 // store in register
		\2rst
		7E BE // get normal/snow/desert offset
		20 \wx7FFF
		\2+
		7E BD // add monorail/maglev offset
		20 \wx00FF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx001B \w0 \w0
		\wx001B

	// No suitable cargo
	1 * 1	02 04 21 // ID
		85
		1A // all bits on
		20 \w0 // no recolour needed
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0012 // store in register
		\2rst
		7E BE // get normal/snow/desert offset
		20 \wx7FFF
		\2+
		7E BD // add monorail/maglev offset
		20 \wx00FF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx001C \w0 \w0
		\wx001C

//@@WARNING ENABLE 100

	// Fruit
	1 * 1	02 04 04 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0020 // real sprites

	// Beans
	1 * 1	02 04 05 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0022 // real sprites

	// Purchase
	1 * 1	02 04 02 // ID
		81 0C // callback
		00 FF
		01
		\wx8002 14 14 // sprite layout
		\wx001B // real sprites

//@@WARNING DISABLE 113

	// Random action 2 outside callback triggers re-randomisation
	1 * 1	02 04 0B // ID
		80
		02 // no more cargo
		10 // trigger bits 16 to 19
		10
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021
		\wx0021

//@@WARNING ENABLE 113

	// No suitable cargo
	1 * 1	02 04 03 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx000B // real sprites

	1 * 1	03 04
		01 FRUIT_TRACK
		04
		0D \wx0004 // fruit
		2E \wx0004 // fruit (and veg)
		39 \wx0005 // beans
		FF \wx0002 // purchase
		\wx0003 // no suitable cargo


	1 * 1	00 04 08 01 FRUIT_NON_TRACK
		08 "ISRR"

		// Sprite layout
		1A 02
			// 00 (x)
			45
			\dx00008F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842D \wx0006 // fruit
			00 00 00 // x/y/z offset
			10 03 0B // x/y/z extent
			04 13 // register - sprite offset
			\dx8000842D \wx0006 // fruit
			00 04 00 // x/y/z offset
			10 03 0B // x/y/z extent
			05 13 // register - sprite offset
			\dx8000842D \wx0006 // fruit
			00 08 00 // x/y/z offset
			10 03 0B // x/y/z extent
			06 13 // register - sprite offset
			\dx8000842D \wx0006 // fruit
			00 0C 00 // x/y/z offset
			10 03 0B // x/y/z extent
			07 13 // register - sprite offset

			// 01 (y)
			45
			\dx00008F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80008431 \wx0006 // fruit
			00 00 00 // x/y/z offset
			03 10 0B // x/y/z extent
			04 13 // register - sprite offset
			\dx80008431 \wx0006 // fruit
			04 00 00 // x/y/z offset
			03 10 0B // x/y/z extent
			05 13 // register - sprite offset
			\dx80008431 \wx0006 // fruit
			08 00 00 // x/y/z offset
			03 10 0B // x/y/z extent
			06 13 // register - sprite offset
			\dx80008431 \wx0006 // fruit
			0C 00 00 // x/y/z offset
			03 10 0B // x/y/z extent
			07 13 // register - sprite offset

		0B 02  // use callback for sprite layout

		10 \w900 // set little/lots threshold
		12 \dx00002000 // cargo types for randomisation triggers

		14 FF // catenary (none)
		11 00 // pylon placement (none)
		15 FF // prevent trains entering the tile from any direction


// Real sprites
// ------------
	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FF 04 04 // ground overlay sprite
		\wx00E2 // fruit sprites

	// Empty
	1 * 1	02 04 1C // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FF 04 04 // ground overlay sprite
		\wx00E1 // fruit sprites - empty

	// Select fruit variety 1
	1 * 1	02 04 40 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8000
		\wx8001
		\wx8002
		\wx8003

	// Select fruit variety 2
	1 * 1	02 04 41 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8003
		\wx8002
		\wx8000
		\wx8001

	// Select fruit variety 3
	1 * 1	02 04 42 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8002
		\wx8003
		\wx8001
		\wx8000

	// Select fruit variety 4
	1 * 1	02 04 43 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8001
		\wx8000
		\wx8003
		\wx8002

//@@WARNING DISABLE 100
//@@WARNING DISABLE 170

	// Fruit
	1 * 1	02 04 20 // ID
		85
		1A // all bits on
		20 \wx0000 // no recolour needed for fruit
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0005 // store in register
		\2rst
		7E 42 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0006 // store in register
		\2rst
		7E 43 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0007 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

	// Beans
	1 * 1	02 04 23 // ID
		85
		7F 10 // read parameter for recolour sprite base
		20 \wx7FFF
		\2+
		1A // all bits on
		20 \w15 // add offset of recolour sprite for beans
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0005 // store in register
		\2rst
		7E 42 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0006 // store in register
		\2rst
		7E 43 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0007 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

	// Empty
	1 * 1	02 04 22 // ID
		85
		1A // all bits on
		20 \wx0000 // no recolour needed
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0005 // store in register
		\2rst
		7E 42 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0006 // store in register
		\2rst
		7E 43 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0007 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001C \w0 \w0
		\wx001C

	// Purchase
	1 * 1	02 04 21 // ID
		85
		1A // all bits on
		20 \wx0000 // no recolour needed for fruit
		\2sto 1A
		20 \wx0013 // store in register - recolour offset
		\2rst
		1A
		20 \w0 // fruit variety
		\2sto 1A
		20 \wx0004 // store in register
		\2rst 1A
		20 \w1 // fruit variety
		\2sto 1A
		20 \wx0005 // store in register
		\2rst 1A
		20 \w2 // fruit variety
		\2sto 1A
		20 \wx0006 // store in register
		\2rst 1A
		20 \w3 // fruit variety
		\2sto 1A
		20 \wx0007 // store in register
		\2rst 1A
		20 \wx0000
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

//@@WARNING ENABLE 100
//@@WARNING ENABLE 170


	// Fruit
	1 * 1	02 04 04 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0020 // real sprites

	// Beans
	1 * 1	02 04 05 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0023 // real sprites

	// Purchase
	1 * 1	02 04 02 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0021 // real sprites

//@@WARNING DISABLE 113

	// Random action 2 outside callback triggers re-randomisation
	1 * 1	02 04 0B // ID
		80
		02 // no more cargo
		10 // trigger bits 16 to 19
		10
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022
		\wx0022

//@@WARNING ENABLE 113

	// No suitable cargo
	1 * 1	02 04 03 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx000B // real sprites

	1 * 1	03 04
		01 FRUIT_NON_TRACK
		04
		0D \wx0004 // fruit
		2E \wx0004 // fruit (and veg)
		39 \wx0005 // beans
		FF \wx0002 // purchase
		\wx0003 // no suitable cargo
