sequencer: refactor write_message() to take a pointer/length