In the mid 1980s University College London wrote a terminal emulator for the BBC Micro which emulated a DEC VT52 and Tektronix T4010 vector graphic terminal so as to support scientific computing on their GEC 41xx series cluster, "Euclid".
This terminal emulator was interesting in that as an extension it allowed a control code to escape and send "MOS" commands to the machine directly. These could be anything from sending *FX commands to play sounds, change colours to setting keyboard macros using *KEY and playing them back.
Wanting to be able to connect my Sinclair QL to the University's serial port and using it as a terminal I first tried writing a basic emulator in SuperBASIC but this proved far too slow, so this prompted me to learn M68000 assembler and write a better one.
The UCLCC documentation on-line was very thorough. This allowed me to completely emulate their emulator, with a sub-set of the BBC Micro MOS commands too, and this emulator was the result.
The source and documentation for the emulator can be found here.
Alternatively, you can browse the source on-line:
You will need to get the Computer One assembler/editor/monitor suite to build it, which can be found on-line in the QL software repository.