Cassette
The cassette input and output is based on square wave signals. The cassette out is generating a square wave signal by switching the Q flag between 0 and 1. The cassette input is linked to the EF4 flag unless used by other external HW like the Floppy Disk, Thermal Printer and/or 80 Column interface cards.
Every bit is generated either by a high or low square tone to represent a 0 or 1. Where the start tone is a long square wave with a high tone and every 255 bytes a new long high tone is generated.