Small update on the PET 2001 online emulator:
I implemented copy & paste. This may be invoked either by the context menu of the emulated sceen or in the case of paste via menu command or keyboard shortcut (Ctrl/Cmd + V).
(The screen context menu with copy and paste commands, here showing the “Paste” authorization button brought up by Apple Safari as a security feature. Chrome will show a permission dialog once.)
System paste works on all major (desktop) browsers, while the implementation by context menu commands is not supported by Firefox (text-areas will be used as a fallback).
While copy exports the current screen as Unicode text to the clipboard, paste may be a bit more interesting. This converts any text found in the clipboard to PETSCII (case is evaluated for individual lines and you may include the usual markup for PETSCII codes) and types this automatically into the emulated PET.
This way, we may enter programs, supply input to a running program, or we may do all of this at once in a single batch operation.
E.g., the following will enter a program, run it, and supply two arguments to the input commands:
10 PRINT "RECTANGLE" 20 INPUT "SIDE A"; A 30 INPUT "SIDE B"; B 40 PRINT "AREA: "; A*B RUN 4 5
resulting in the following operation:
Here’s a write-up with a bit more detail:
And here’s the emulator in question: https://www.masswerk.at/pet