OPTION CONSOLE in a program spoils characters arriving on the serial console
============================================================================

Board:    Colour Maximite 2 G2, MMBasic 8.00.00b2 (first seen on 8.00.00b1)
Console:  BOTH (VGA 800x600, serial terminal Tera Term at 115200 baud)

>option list
480MHz Colour Maximite 2 G2
MMBasic 8.00.00b2
CURRENT VGA mode 800x600 RGB332
CURRENT DISPLAY 50,100
OPTION USBKEYBOARD DE

What happens
------------
A program reads keys with INKEY$ while text is pasted into the terminal.
If the program switches OPTION CONSOLE while the characters arrive,
some characters are lost and others arrive as rubbish - as if the
serial port were set up again each time.

pastetest.bas has three runs. In each run paste the same text (here 100
characters: a line of 70 digits, CR, "SELECT COUNT(*) FROM computer"),
then press Esc:

  Run 1: only INKEY$
         -> Received 100 characters, all correct
  Run 2: OPTION CONSOLE SCREEN / BOTH / SERIAL / BOTH after each key
         -> Received 96 characters, with rubbish
  Run 3: TEXT, then OPTION CONSOLE SCREEN, PRINT @ (to put the print
         position back), OPTION CONSOLE BOTH after each key
         -> Received 96 characters, also with rubbish

The output on 8.00.00b2 (CR shown as |; the rubbish as Tera Term
shows it):

Run 1: only INKEY$
Received 100 characters (CR shown as |):
0123456789012345678901234567890123456789012345678901234567890123456789|SELECT COUNT(*) FROM computer

Run 2: OPTION CONSOLE switching per key (as the editor)
Received 96 characters (CR shown as |):
012345678901234567890123ÓÊ¢ª²ºÂÊ¢ª²ºÂ01234567890123456789|SELECT COUNT(*) FROM comWÿ

Run 3: TEXT + PRINT @ per key (as the screen cursor)
Received 96 characters (CR shown as |):
0123456789012345678901234ÓÊ¢ª²ºÂÊ¢ª²ºÂÊ¢ª²ºÂÊ¢ª²ºÂÊjSELECT COUNT(*) FROM comp]Yî

On 8.00.00b1 it was the same (Run 2: 97 characters, Run 3: 96).

Typed keys are fine; it shows with pasted text (characters coming fast).

Why it matters
--------------
To write to the terminal only (escape sequences the screen would print
as text) or to the screen only (PRINT @ without moving the terminal's
cursor), a program has to switch OPTION CONSOLE. mmsql (SQLite manager)
now avoids switching while it reads keys.

Question: is this expected? Is there another way to send output to the
serial terminal only, or to the screen only?

Matthias
