PiDP-8/I Software

Changes On Branch screen-mgr-none-dtach
Log In

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch screen-mgr-none-dtach Excluding Merge-Ins

This is equivalent to a diff from 9d08417d8e to 16b4f0c7e2

2020-04-19
23:41
Merged in trunk changes, leaving only the dtach changes in this branch. Leaf check-in: 16b4f0c7e2 user: tangent tags: screen-mgr-none-dtach
23:35
Merged the warning about Ctrl-A vs Ctrl-B for screen vs tmux down from the screen-mgr-none-dtach branch. check-in: 773103b2ea user: tangent tags: trunk
23:23
Cherry-picked the elements of branch screen-mgr-none-dtach that don't involve dtach, the only part of that branch that doesn't currently work. The main user-visible feature of this is the "none" option. check-in: 9d08417d8e user: tangent tags: trunk
23:04
Style pass on HACKERS.md: double space after period to single, Unicode characters where sensible (em dashes, curly quotes, ellipses...) and Markdown style tweaks. A few typo fixes and such as well. check-in: e71e805b5f user: tangent tags: trunk
2020-01-27
18:41
Clarified that SCREEN_MANAGER=none is for interactive use only in the README.md file, and made a test for this high up in the pidp8i script. check-in: bf005a02cd user: tangent tags: screen-mgr-none-dtach
17:45
Allow SCREEN_MANAGER=none mode to work under systemd: don't redirect commands through systemctl if isatty. check-in: 31a8e26aa0 user: tangent tags: screen-mgr-none-dtach
17:27
Installing a default etc/pidp8i.rc file if it doesn't already exist so users will have an example to work from. check-in: b9f771a73b user: tangent tags: screen-mgr-none-dtach
2020-01-26
21:34
URL fix check-in: 07a0439868 user: tangent tags: screen-mgr-none-dtach
21:33
Tweaked a potentially confusing message output from "pidp8i stop". check-in: d044732095 user: tangent tags: screen-mgr-none-dtach
20:53
Added the SCREEN_MANAGER=none feature, being an alternative to "make run" for running the simulator hard-attached to the local terminal while still making use of the media in the install tree, rather than the pristine pre-install versions. check-in: b6e58203de user: tangent tags: screen-mgr-none-dtach

Changes to Makefile.in.

485
486
487
488
489
490
491



492
493
494
495
496
497
498
	  done \
	)
	@sed -e 's#^build =.*#build = "@ABSPREFIX@"#' \
	     -e 's#^media =.*#media = os.path.join (build, "share/media/")#' \
	     -e 's#^os8mo =.*#os8mo = os8mi#' \
		 < $(PIDP8I_DIRS) > @prefix@/$(PIDP8I_DIRS)
	@chgrp @INSTGRP@ @prefix@/$(PIDP8I_DIRS)




instdirs:
	@echo "Creating installation directory tree..."
	@for d in $(INSTDIRS) ; do @INSTALL@ -m 755 -o @INSTUSR@ -g @INSTGRP@ -d @prefix@/$$d ; done

mediainstall: instdirs
	@echo "[Re]installing OS and program media..."







>
>
>







485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
	  done \
	)
	@sed -e 's#^build =.*#build = "@ABSPREFIX@"#' \
	     -e 's#^media =.*#media = os.path.join (build, "share/media/")#' \
	     -e 's#^os8mo =.*#os8mo = os8mi#' \
		 < $(PIDP8I_DIRS) > @prefix@/$(PIDP8I_DIRS)
	@chgrp @INSTGRP@ @prefix@/$(PIDP8I_DIRS)

	@# We need a directory for PIDs and such in some cases
	@@INSTALL@ -d -m 755 @prefix@/run

instdirs:
	@echo "Creating installation directory tree..."
	@for d in $(INSTDIRS) ; do @INSTALL@ -m 755 -o @INSTUSR@ -g @INSTGRP@ -d @prefix@/$$d ; done

mediainstall: instdirs
	@echo "[Re]installing OS and program media..."

Changes to README.md.

757
758
759
760
761
762
763























764
765
766
767
768
769
770
The `SCREEN_MANAGER` setting is for use by those that need something
other than GNU `screen`. There are several alternatives:

*   **screen**: The default, per above.

*   [**tmux**][tmux]: A popular alternative to `screen`, especially on
    BSD platforms.
























*   **none**: This mode is for interactive use, allowing you to
    run the installed simulator with the installed media without any
    screen manager at all.

    In this mode, the `pidp8i` and `pidp8i start` commands do the
    same thing: run the simulator directly attached to your current







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
The `SCREEN_MANAGER` setting is for use by those that need something
other than GNU `screen`. There are several alternatives:

*   **screen**: The default, per above.

*   [**tmux**][tmux]: A popular alternative to `screen`, especially on
    BSD platforms.

*   [**`dtach`**][dtach]: A minimalist alternative to `screen` which
    provides only its terminal attach/detach features.

    In addition to the virtues called out on the program’s home page,
    use of this option has a side benefit for some PiDP-8/I users:
    `screen` and `tmux` assume an [ANSI X3.64 terminal][ansit] (e.g. DEC
    VT102 or xterm), because they interpret escape codes to provide
    features such as their scrollback buffer. It is uncommon to find
    PDP-8 software that uses ANSI terminal escape codes since almost all
    PDP-8 computers sold predate that standard. Most PDP-8 software
    assumes a dumb teletypewriter, and of the software that does make
    use of a smart terminal, there’s a good chance it wants something
    else, such as a [Tek 4010][t4010] series terminal. These ANSI screen
    managers can therefore get in the way and mess things up.

    `dtach` doesn’t interfere with terminal escape code handling; thus
    this option.

    Unlike `screen` and `tmux`, there is no command layer enetered
    via an "attention" keystroke in `dtach`. The only key that `dtach`
    scans for from the terminal is the detach keystroke, which we leave
    at its default, <kbd>Ctrl-\\<kbd>.

*   **none**: This mode is for interactive use, allowing you to
    run the installed simulator with the installed media without any
    screen manager at all.

    In this mode, the `pidp8i` and `pidp8i start` commands do the
    same thing: run the simulator directly attached to your current
778
779
780
781
782
783
784


785
786

787
788
789
790
791
792
793
Raspbian, this is done by:

    $ sudo apt install tmux

Switching between configured screen managers must be done while the
simulator is stopped.



[gscr]:  https://www.gnu.org/software/screen/
[scons]: /wiki?name=Serial+or+Telnet+PDP-8+Console

[tmux]:  https://tmux.github.io/


## <a id="os8di"></a>The OS/8 RK05 Disk Image

For the first several years of the PiDP-8/I project, the OS/8 RK05 disk
image included with the PiDP-8/I software (called `os8.rk05`) was based







>
>


>







801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
Raspbian, this is done by:

    $ sudo apt install tmux

Switching between configured screen managers must be done while the
simulator is stopped.

[ansit]: https://en.wikipedia.org/wiki/ANSI_escape_code
[dtach]: https://github.com/crigler/dtach
[gscr]:  https://www.gnu.org/software/screen/
[scons]: /wiki?name=Serial+or+Telnet+PDP-8+Console
[t4010]: https://en.wikipedia.org/wiki/Tektronix_4010
[tmux]:  https://tmux.github.io/


## <a id="os8di"></a>The OS/8 RK05 Disk Image

For the first several years of the PiDP-8/I project, the OS/8 RK05 disk
image included with the PiDP-8/I software (called `os8.rk05`) was based

Changes to bin/pidp8i.in.

32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57



58
59
60
61
62
63
64
65
66
67
68
69
70



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88



89
90
91
92
93
94
95

bootdir="@BOOTDIR@"
prefix="@ABSPREFIX@"
sim="$prefix/bin/pidp8i-sim"
scanswitch="$prefix/libexec/scanswitch"
systemctl=$(uname -r | grep -qw Microsoft && echo /bin/nothing || echo /bin/systemctl)
ggrep=$(which ggrep grep 2> /dev/null | head -1)


if [ -e "$prefix/etc/pidp8i.rc" ]
then
    . "$prefix/etc/pidp8i.rc"
fi
[ -n "$SCREEN_MANAGER" ] || SCREEN_MANAGER=screen
if [ ! -t 1 ] && [ "$SCREEN_MANAGER" = "none" ]
then
    echo "The 'none' screen manager mode is meant for interactive use only!"
    exit 1
fi

is_running() {
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        return 1
    elif [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux has-session -t pidp8i 2>/dev/null



    else
        procs=`screen -list pidp8i | $ggrep -Pc '\d\.pidp8i'`
        test -n "$procs" && test $procs -gt 0 && return 0 || return 1
    fi
}

sim_child_pid() {
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        echo ""
    elif [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux list-sessions -F '#{session_name} #{pid}' | awk '/^pidp8i / {print $2}'



    else
        screen -ls pidp8i | grep -Eo '[[:digit:]]+\.pidp8i' | grep -Eo '^[[:digit:]]+'
    fi
}

# Were we given a command line argument?
if [ -z "$1" ]
then
    # No, so try to run or attach to the running simulator
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        exec $0 start
    elif is_running
    then
        echo Joining simulator session already in progress...
        if [ "$SCREEN_MANAGER" = "tmux" ]
        then
            exec tmux attach-session -d -t pidp8i



        else
            exec screen -r -S pidp8i
        fi
    else
        cat <<ERROR
Either the simulator isn't running, or it isn't running under a ${SCREEN_MANAGER}
session owned by @INSTUSR@.  Did you start the simulator via systemd?







>



















>
>
>













>
>
>


















>
>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

bootdir="@BOOTDIR@"
prefix="@ABSPREFIX@"
sim="$prefix/bin/pidp8i-sim"
scanswitch="$prefix/libexec/scanswitch"
systemctl=$(uname -r | grep -qw Microsoft && echo /bin/nothing || echo /bin/systemctl)
ggrep=$(which ggrep grep 2> /dev/null | head -1)
dtsock=$prefix/run/pidp8i-dtach.sock

if [ -e "$prefix/etc/pidp8i.rc" ]
then
    . "$prefix/etc/pidp8i.rc"
fi
[ -n "$SCREEN_MANAGER" ] || SCREEN_MANAGER=screen
if [ ! -t 1 ] && [ "$SCREEN_MANAGER" = "none" ]
then
    echo "The 'none' screen manager mode is meant for interactive use only!"
    exit 1
fi

is_running() {
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        return 1
    elif [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux has-session -t pidp8i 2>/dev/null
    elif [ "$SCREEN_MANAGER" = "dtach" ]
    then
        test -e $dtsock
    else
        procs=`screen -list pidp8i | $ggrep -Pc '\d\.pidp8i'`
        test -n "$procs" && test $procs -gt 0 && return 0 || return 1
    fi
}

sim_child_pid() {
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        echo ""
    elif [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux list-sessions -F '#{session_name} #{pid}' | awk '/^pidp8i / {print $2}'
    elif [ "$SCREEN_MANAGER" = "dtach" ]
    then
        test -e $dtsock && fuser -f $dtsock | cut -f2 -d' '
    else
        screen -ls pidp8i | grep -Eo '[[:digit:]]+\.pidp8i' | grep -Eo '^[[:digit:]]+'
    fi
}

# Were we given a command line argument?
if [ -z "$1" ]
then
    # No, so try to run or attach to the running simulator
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        exec $0 start
    elif is_running
    then
        echo Joining simulator session already in progress...
        if [ "$SCREEN_MANAGER" = "tmux" ]
        then
            exec tmux attach-session -d -t pidp8i
        elif [ "$SCREEN_MANAGER" = "dtach" ]
        then
            exec dtach -a $dtsock
        else
            exec screen -r -S pidp8i
        fi
    else
        cat <<ERROR
Either the simulator isn't running, or it isn't running under a ${SCREEN_MANAGER}
session owned by @INSTUSR@.  Did you start the simulator via systemd?
165
166
167
168
169
170
171



172
173
174
175
176
177
178
    # Start the simulator
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        exec "$sim" "$bscript"
    elif [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux new-session -s pidp8i -d "$sim" "$bscript"



    else
        screen -dm -S pidp8i "$sim" "$bscript"
    fi

    # Tell systemd where to find the backgrounded simulator so it can
    # stop it via systemctl.  Skipped on non-systemd systems and where
    # SCREEN_MANAGER=none.







>
>
>







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
    # Start the simulator
    if [ "$SCREEN_MANAGER" = "none" ]
    then
        exec "$sim" "$bscript"
    elif [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux new-session -s pidp8i -d "$sim" "$bscript"
    elif [ "$SCREEN_MANAGER" = "dtach" ]
    then
        dtach -n $dtsock -z "$sim" "$bscript"
    else
        screen -dm -S pidp8i "$sim" "$bscript"
    fi

    # Tell systemd where to find the backgrounded simulator so it can
    # stop it via systemctl.  Skipped on non-systemd systems and where
    # SCREEN_MANAGER=none.

Changes to etc/pidp8i.rc.

1
2
3
4
5
# PiDP-8/I runtime configuration file.  See it README.md file or
# https://tangentsoft.com/pidp8i/doc/trunk/README.md#runtime

# Alternatives: none, tmux
SCREEN_MANAGER=screen



|

1
2
3
4
5
# PiDP-8/I runtime configuration file.  See it README.md file or
# https://tangentsoft.com/pidp8i/doc/trunk/README.md#runtime

# Alternatives: dtach, none, tmux
SCREEN_MANAGER=screen