dirkwhoffmann / vAmiga

vAmiga is a user-friendly Amiga 500, 1000, 2000 emulator for macOS
https://dirkwhoffmann.github.io/vAmiga
Other
306 stars 25 forks source link

Add RetroShell as a serial port device #820

Open dirkwhoffmann opened 8 months ago

dirkwhoffmann commented 8 months ago

In another repo, a user requested to control the emulator from within the Amiga to implement a smart warp boot mechanism (switching off warp mode when a specific task has finished).

A clean and easy way to solve this problem is to allow users to (virtually) plug RetroShell into the serial port.

At the moment, there are two serial port devices:

Proposal: Add two more devices:

I've already hacked together a small prototype as a proof-of-concept implementation:

Bildschirmfoto 2024-03-05 um 08 20 13
dirkwhoffmann commented 8 months ago

Another possibility would be to merge the RetroShell viewer and the RetroShell commander into a single device and to use a unique character to enter command mode.

As this is all about retro, we could use the ASCII character 16 (DLE, Data Link Escape). Once this character is detected, transmitted bytes are no longer just displayed in RetroShell but typed in. Command mode will be reset to text mode on the following line.

dirkwhoffmann commented 8 months ago

Unfortunately, I didn't find a way to echo the DLE character in Amiga DOS. There seems to be no way to specify an ASCII character by number inside a string, which would make the special character approach tedious to use.

If some Amiga DOS expert knows a solution, please let me know.

wepl commented 8 months ago

I think there is no way to create a DLE char with the standard tools. But it would be easy to create a command which outputs it or prepend the output with a DLE. On 1.3 you anyway need the Echo command to print something.

wepl commented 8 months ago

dle.zip attached a dle command which prints the argument prepended with a DLE

dirkwhoffmann commented 8 months ago

Thinking more deeply about the available options, I think the dual-device approach is superior. That is because I want to let the Commander send back the RetroShell output to the Amiga eventually, which the viewer (sniffer) should never do. In particular, the two devices will behave as follows:

The important part of the Commander is already implemented (but still needs to be ported over to vAmigaWeb).

In the Mac app, plug in the Commander into the serial port:

Bildschirmfoto 2024-03-06 um 12 40 01

In Kick 3.0 (which allows ser: to be addressed directly), send a RetroShell command simply via echo (no special characters needed):

Bildschirmfoto 2024-03-06 um 12 40 32

With the Commander plugged in, the command is executed inside RetroShell:

Bildschirmfoto 2024-03-06 um 12 40 35

With the Commander plugged in, you have complete control over the emulator. You can enable or disable warp mode as you like or anything else.

dirkwhoffmann commented 8 months ago

Sending RetroShell output to the Amiga also works (in the lower window, I've typed in type ser:) :

Bildschirmfoto 2024-03-06 um 15 06 15

There are two issues left:

dirkwhoffmann commented 8 months ago

With the latest code changes, RetroShell can be used inside a Terminal program such as A-Talk III (unlike the type ser: solution, there are no buffering issues, and communication is possible with high baud rates).

Important:

Bildschirmfoto 2024-03-07 um 07 16 16

There are some caveats, though:

Summing up:

dirkwhoffmann commented 3 months ago

Update: With the latest code changes, the Commander no longer crashes the emulator.

Before hitting Ctrl+Return:

Bildschirmfoto 2024-08-06 um 16 37 30

After hitting Ctrl+Return:

Bildschirmfoto 2024-08-06 um 16 37 39