Trainer data structure in Generation II

NPC Trainer data
The in-game Trainer data is remarkably compressed.

Name
This is a string going anywhere from 2 to 8 bytes, containing the Trainer's name and ending in a 0x50 terminator. The rival's name is represented by a single byte - 0xE6.

Custom move marker
This is one byte marking whether the Pokémon in the party have custom moves or not. If not, it is set to 0 - if so, it is set to 1.

Pokémon
Depending on whether the custom move marker was set or not, each Pokémon's data is either 2 or 6 bytes long. If the move marker was set to 0, the Pokémon's data simply contains the Pokémon's level and species, in that order. Otherwise, it contains the full moveset after the level and species - 1 byte per move.

Terminator
This is a single byte (0xFF) which tells the processor to stop reading data.