Remotely control Picotron from the host
# from inside picotron
load -u #prt
save /appdata/system/util/prt.p64This will install the PRT cartridge, which will listen for commands from prt-server.
# from inside picotron
# use the location of wherever you saved the prt cart
cp /appdata/system/util/prt.p64/exports/appdata/system/util/host.lua /appdata/system/utilThis will install the host command, which can be used run commands from the host inside of Picotron.
# from inside picotron
# use the location of wherever you saved the prt cart
cp /appdata/system/util/prt.p64/exports/appdata/system/terminal/prt.lua /appdata/system/terminalIf you are using PUSH, you can integrate PRT directly into the terminal. The push module adds a shell command (prt) that can be used instead of the cart. When using PRT as a PUSH module, command output will be displayed in the terminal window.
Supported commands are start, stop, restart, status.
To control Picotron from host, open the PRT cart inside of Picotron. You can then issue a command by sending a command to the port 7426 (PICO)
Examples:
echo -n "<command>" | nc -N localhost 7426echo -n "<command>" > /dev/tcp/localhost/7426(bash)nc localhost 7426(to get an interactive terminal)
You can create a simple script to act as a wrapper:
#!/usr/bin/env bash
echo "$@" > /dev/tcp/localhost/7426Then, you can send commands using prt <command>
- The
loadcommand can be used to load a cartridge. - You can load a folder or a cartridge.
- The
runcommand can be used to run the currently loaded cartridge. - You can start a cart with its exact path.
- You can build or extract a cart with
cp. - You can change directories with
cd, though it may be better to use absolute paths.
To control the host from Picotron, start prt-server on the host.
Install prt-server from npm:
npm install -g picotron-remote-terminalOr build from source:
git clone https://github.com/Rayquaza01/picotron-remote-terminal/
cd picotron-remote-terminal
npm install
npm run build
npm install -g .
You can then issue commands by running host <COMMAND> from Picotron.
- Only non-interactive commands work.
- Only characters that can be displayed in Picotron work (so emojis, nerd fonts, ANSI codes, etc. won't display correctly).
- The commands are run with the same PWD as the Picotron terminal where you ran them.
- Relative paths work for accessing the Picotron drive, but absolute paths are used according to the host system.
- You can't run commands when inside of a virtual path (such as
/ram,/system, or inside of a.p64). - You can use pipelines.