PicoSim - Check and Deploy (F2) walkthrough, for a real Pico
=============================================================

You need: a Pico running PicoMite MMBasic on USB, and no other program
(Tera Term, MMCC, PuTTY) holding its COM port.

1. Open blink.bas (or any small program) in PicoSim.
2. Press F2 (or Simulate > Check and Deploy to Pico..., or the Deploy button).
3. Pick the Pico's COM port. The newest port is usually the Pico; Device
   Manager > Ports shows "USB Serial Device (COMn)". Click Refresh after
   plugging it in.
4. Leave Method on XMODEM and "Read it back and compare" ticked.
   Click "Check and Deploy".

What should happen (the steps list shows each one):
  1 Connect and identify  - PicoSim sends Ctrl+C twice and Enter, waits for
                            the > prompt, then asks PRINT MM.DEVICE$ and
                            PRINT MM.VER. If the board doesn't match PicoSim's
                            hardware you're asked whether to carry on.
  2 Check the program     - the same check as Ctrl+F7. Problems stop it.
  3 Confirm               - "Code good, deploy now?"
  4 Write                 - XMODEM RECEIVE, block by block (or AUTOSAVE, a line
                            at a time, then Ctrl+Z).
  5 Read back             - LIST ALL, compared line by line ignoring spaces and
                            capitals. Differences are shown in the log.
  6 RUN                   - only if "RUN it on the Pico afterwards" is ticked.

Next time, F2 starts straight away if the same port is plugged in.

Things to try:
  - The AUTOSAVE method as well as XMODEM.
  - A program with a fault (e.g. an unknown command): step 2 should stop it.
  - Unplug the Pico, or open the port in Tera Term first: step 1 should fail
    with a clear message.
  - Cancel during a long program.

If anything goes wrong: click Copy Log (or open deploy_log.txt in the PicoSim
folder, next to PicoSim.ini) and paste it to Claude. Every byte sent (TX) and
received (RX) is in it, with times.

Settings in PicoSim.ini [Options]: DeployPort, DeployMethod (0 XMODEM,
1 AUTOSAVE), DeployVerify, DeployRun, DeployLineDelay (ms between AUTOSAVE
lines, default 15; raise it if lines go missing).

Pin hover tips
--------------
Run modules_test.bas or pwm_ain_test.bas and rest the mouse on a pin label on
the Pico picture: a yellow tip shows the GP and physical pin, its SETPIN mode,
the level / duty and frequency / voltage / servo angle, the program's name for
the pin, and the interrupt SUB. It changes as the program runs. The power and
ground labels have tips too.

Monitor real-world device (Draft 45)
------------------------------------
The console has a "Monitor real-world device" box. Ticked, the console becomes
a terminal on the real Pico, on the same COM port as Check and Deploy:
  - everything the Pico prints shows in the console (the > prompt too);
  - keys typed in the box at the bottom go straight to the Pico, Enter sends
    the line; Backspace, the arrow keys (command history), Esc and Ctrl+C are
    passed on too; the Ctrl+C toolbar button breaks a running program.
Untick it to let go of the port (e.g. for Tera Term).

Try:
  1. Tick the box with the Pico plugged in, press Enter: the > prompt appears.
     Type  ? MM.DEVICE$  and Enter.
  2. Deploy with "RUN it on the Pico afterwards" ticked: the box ticks itself
     and the program's output carries on in the console.
  3. Deploy while monitoring: the console lets go of the port for the deploy
     and takes it back afterwards.
  4. Press F5 to run the simulation while monitoring: monitoring stops (the
     console shows one or the other).
