PiDP-8/I SoftwareCheck-in [b6e58203de]
Not logged in

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | screen-mgr-none-dtach
Files: files | file ages | folders
SHA3-256: b6e58203defc2ad8c721c0c091dbec9c3476b861c0bb67d240c54ed8b1c4c735
User & Date: tangent 2020-01-26 20:53:46
Context
2020-01-26
21:32
Added the SCREEN_MANAGER=dtach option check-in: dd5ad30192 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
2020-01-14
15:26
Fixed an incorrect line break in os8-run.md Leaf check-in: 059aac0685 user: tangent tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.md.

739
740
741
742
743
744
745
746
747
748
749
750
751





















752
753
754
755
756
757
758

759

760
761
762
763
764
765
766
767
...
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
The `pidp8i` command may be configured by the optional `pidp8i.rc` file,
located by default in `/opt/pidp8i/etc/`.  This is a Bourne shell script
which is sourced by `pidp8i` if it exists, and recognizes the following
variables:


<a id="rc-screen-manager"></a>
### SCREEN_MANAGER=screen

By default, pidp8i installs and uses [GNU screen(1)][gnuscreen] to
manage screen sessions.  However, if you prefer to use [tmux(1)][tmux]
as a screen manager for the pidp8i session, you may set
`SCREEN_MANAGER=tmux`.  Note that if you make this change, you are





















responsible for installing tmux; on Raspbian, this is done by:

        $ sudo apt-get install tmux

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


[gnuscreen]: https://www.gnu.org/software/screen/

[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
on an image of a real RK05 disk pack that someone allegedly found in a
................................................................................
to make system-wide changes like this in our startup scripts.  We now
rely on you, the system’s administrator, to do it interactively with
`sudo` permissions.


## License

Copyright © 2016-2019 by Warren Young. This document is licensed under
the terms of [the SIMH license][sl].


[cprj]: https://tangentsoft.com/pidp8i/
[sm1]:  http://obsolescence.wixsite.com/obsolescence/2016-pidp-8-building-instructions
[sm2]:  https://groups.google.com/d/msg/pidp-8/-leCRMKqI1Q/Dy5RiELIFAAJ
[osd]:  http://obsolescence.wixsite.com/obsolescence/pidp-8-details







|

|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

|

|
|

>
|
>
|







 







|







739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
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
....
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
The `pidp8i` command may be configured by the optional `pidp8i.rc` file,
located by default in `/opt/pidp8i/etc/`.  This is a Bourne shell script
which is sourced by `pidp8i` if it exists, and recognizes the following
variables:


<a id="rc-screen-manager"></a>
### `SCREEN_MANAGER=screen`

By default, the PiDP-8/I software distribution installs and uses [GNU
`screen(1)`][gscr] to allow the simulator to run in the background yet be
reattached from a later terminal session, then possibly later to be
backgrounded once again. Without the intermediation of something like
`screen`, the simulator would either forever be in the background and
we’d have to export the console [another way][scons] or you’d have to
fire it up interactively any time you wanted to use it. This scheme lets
us have it both ways.

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`**: effectively aliases the `pidp8i` and `pidp8i start`
    commands, attaching the simulator to the local console. The `pidp8i
    stop` command becomes a no-op, since stopping the simulator is then
    done in the standard SIMH way: <kbd>Ctrl-E, quit</kbd>.

Note that the alternative screen managers are not installed by default.
If you set `SCREEN_MANAGER=tmux`, you must then ensure that `tmux` is in
fact installed before the `pidp8i` script goes to try and use it. On
Raspbian, this is done by:

        $ sudo apt install tmux

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

[dtach]: https://github.com/crigler/dtach
[gscr]:  https://www.gnu.org/software/screen/
[scona]: /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
on an image of a real RK05 disk pack that someone allegedly found in a
................................................................................
to make system-wide changes like this in our startup scripts.  We now
rely on you, the system’s administrator, to do it interactively with
`sudo` permissions.


## License

Copyright © 2016-2020 by Warren Young. This document is licensed under
the terms of [the SIMH license][sl].


[cprj]: https://tangentsoft.com/pidp8i/
[sm1]:  http://obsolescence.wixsite.com/obsolescence/2016-pidp-8-building-instructions
[sm2]:  https://groups.google.com/d/msg/pidp-8/-leCRMKqI1Q/Dy5RiELIFAAJ
[osd]:  http://obsolescence.wixsite.com/obsolescence/pidp-8-details

Changes to bin/pidp8i.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
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
...
143
144
145
146
147
148
149





150
151
152
153
154
155





156
157
158
159

160
161
162
163
164
165
166
...
175
176
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
########################################################################
# pidp8i.in - Collection of scriptlets for dealing with the pidp8i
#   systemd user service and its associated screen manager session.
#
# Copyright © 2015-2019 Oscar Vermeulen and Warren Young
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
................................................................................
if [ -e "$prefix/etc/pidp8i.rc" ]
then
    . "$prefix/etc/pidp8i.rc"
fi
[ -n "$SCREEN_MANAGER" ] || SCREEN_MANAGER=screen

is_running() {



    if [ "$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" = "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 just try to attach to the running simulator



    if 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
................................................................................
    # We want SIMH to have a sensible working directory: somewhere the
    # user can write files and which makes sense when giving SIMH
    # commands involving file paths.  This default is chosen because it
    # satisfies both criteria.
    # If you change the default here, change that script as well.
    set -e
    cd "$prefix/share/media"





    if [ "$SCREEN_MANAGER" = "tmux" ]
    then
        tmux new-session -s pidp8i -d "$sim" "$bscript"
    else
        screen -dm -S pidp8i "$sim" "$bscript"
    fi





    if [ -x $systemctl ]
    then
        systemd-notify --ready --pid=$(sim_child_pid)
    fi

    exit 0
elif [ "$verb" = "stop" ]
then
    # Someone (maybe the user via "pidp8i stop", maybe systemd via
    # "systemctl pidp8i stop") is telling us to stop the background
    # simulator.
    #
................................................................................
            # Give it time to complete, then kill it hard in case it
            # doesn't die on its own.
            echo -n "Stopping $sim simulator..."
            for sig in TERM KILL ; do pkill -$sig $sim ; sleep 1 ; done

            # The screen manager might still be running despite its
            # only child dying.  Nuke it hard if so.
            if is_running
            then

                if [ "$SCREEN_MANAGER" = "tmux" ]
                then
                    tmux kill-session -t pidp8i
                else
                    screen -S pidp8i -X quit
                fi
            fi

            exit 0
        fi
    done 

    exit 1
fi





|







 







>
>
>
|









>
>
>
|










|
>
>
>
|







 







>
>
>
>
>
|





>
>
>
>
>
|

|

>







 







|

>
|
|
|
|
|
<








1
2
3
4
5
6
7
8
9
10
11
12
13
..
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
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217
#!/bin/bash
########################################################################
# pidp8i.in - Collection of scriptlets for dealing with the pidp8i
#   systemd user service and its associated screen manager session.
#
# Copyright © 2015-2020 Oscar Vermeulen and Warren Young
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
................................................................................
if [ -e "$prefix/etc/pidp8i.rc" ]
then
    . "$prefix/etc/pidp8i.rc"
fi
[ -n "$SCREEN_MANAGER" ] || SCREEN_MANAGER=screen

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
................................................................................
    # We want SIMH to have a sensible working directory: somewhere the
    # user can write files and which makes sense when giving SIMH
    # commands involving file paths.  This default is chosen because it
    # satisfies both criteria.
    # If you change the default here, change that script as well.
    set -e
    cd "$prefix/share/media"

    # 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.
    scpid=$(sim_child_pid)
    if [ -x $systemctl ] && [ -n "$scpid" ] && [ $scpid -gt 0 ]
    then
        systemd-notify --ready --pid=$scpid
    fi

    exit 0
elif [ "$verb" = "stop" ]
then
    # Someone (maybe the user via "pidp8i stop", maybe systemd via
    # "systemctl pidp8i stop") is telling us to stop the background
    # simulator.
    #
................................................................................
            # Give it time to complete, then kill it hard in case it
            # doesn't die on its own.
            echo -n "Stopping $sim simulator..."
            for sig in TERM KILL ; do pkill -$sig $sim ; sleep 1 ; done

            # The screen manager might still be running despite its
            # only child dying.  Nuke it hard if so.
            if ! is_running || [ "$SCREEN_MANAGER" = "none" ]
            then
                echo "The PiDP-8/I simulator is not running."
            elif [ "$SCREEN_MANAGER" = "tmux" ]
            then
                tmux kill-session -t pidp8i
            else
                screen -S pidp8i -X quit

            fi

            exit 0
        fi
    done 

    exit 1
fi