module BBS::Petscii

The Commodore 64’s character set on the telnet line: a 40×25 screen, colours and cursor moves as single control bytes, and the lowercase character set (letters swap case against ASCII).

A session switched with session.petscii! sends everything it writes through an Encoder, so the code above it keeps writing UTF-8 text with ANSI colours and cursor moves (a Flow, a FakeOS, a door), and reads the C64’s keys as the usual key symbols. PETSCII control codes can be written directly too: they are the C0 and C1 code points of a UTF-8 string, so "#{BBS::Petscii::YELLOW}READY." is yellow on the C64.