The code seems to work quite well for 8 car trains but beyound that things start to go wrong, illustrated in this screenshot. I think the answer, (or lack there of) is somewhere in this bit of code.
Code: Select all
//
//choose sprites depending on position (D1)
486 * 30 02 00 90 81 40 00 0C 05
02 00 09 0B // 10th to 11th coach
03 00 08 08 // 5th car Second Panto
02 00 04 07 // 5th to 8th coach
04 00 03 03 // 3th car First Panto
02 00 01 02 // 2nd to 3rd coach
00 00 // 1st car Front
//
//check if at last vehicle (D1)
487 * 17 02 00 84 85 40 00 00 FF 01 01 00 00 00 00 00 90 00
//check if first vehicle (D1)
488 * 14 02 00 82 81 40 00 FF 01 00 00 00 00 84 00
//choose sprites depending on position (D0)
489 * 30 02 00 70 81 40 00 0C 05
02 00 09 0B // 10th to 11th coach
03 00 08 08 // 5th car Second Panto
02 00 04 07 // 5th to 8th coach
04 00 03 03 // 3th car First Panto
02 00 01 02 // 2nd to 3rd coach
00 00 // 1st car Front
////check if at last vehicle (D0)
490 * 17 02 00 64 85 40 00 00 FF 01 01 00 00 00 00 00 70 00
//
//check if first vehicle (D0)
491 * 14 02 00 62 81 40 00 FF 01 00 00 00 00 64 00
//check direction (D0 or D1):
492 * 14 02 00 60 82 FF 00 01 01 62 00 00 00 82 00
//
// set CB 16 (articulated vehicle)
//!!Warning (94): Redefining ID 05 not used since previous definition at sprite 484.
493 * 14 02 00 05 81 10 00 FF 01
7F 80 01 0B // 11 additional parts of veh-ID 7F (base articulated car)
FF 80 // end articulated vehicle
// set CB 1D (engine attach)
// allow only 1 * EMU (= 12 cars) in total
//!!Warning (94): Redefining ID 06 not used since previous definition at sprite 485.
494 * 14 02 00 06 82 40 10 FF 01
FE 80 00 0C // allow adding of max 12 cars
20 80 // error: "wrong number of cars"
// allow only S seris to, nothing else
495 * 18 02 00 07 81 C6 00 FF 02
06 00 FA FA
06 00 7F 7F
50 80 // error: "wrong type of car"
//process callback 10 (powered wagon) for direction 1
496 * 18 02 00 54 81 40 08 07 02
38 80 03 03
38 80 08 08
40 80
//process callback 10 (powered wagon) for direction 0
497 * 18 02 00 53 81 40 00 07 02
34 80 03 03
34 80 08 08
40 80
//check direction for callback 10:
498 * 14 02 00 52 82 FF 00 01 01 53 00 00 00 54 00
//
//begin wagon chain: check for CB 10 (powered wagon)
499 * 14 02 00 50 81 0C 00 FF 01
52 00 10 10
60 00
// switch between callback and graphics branch
500 * 23 02 00 09 85 0C 00 FF FF 02
05 00 16 00 16 00 // is CB 16, handle it
07 00 1D 00 1D 00 // is CB 1D, handle it
50 00 // graphics
ps. apologies if this just me being stupid.