• Blinkenlights from user code

    From Jonathan Harston@jgh@mdfs.net to alt.sys.pdp11 on Sun Aug 7 15:52:16 2022
    From Newsgroup: alt.sys.pdp11

    In Unix, user code can't "see" I/O locations. Is there an API to access
    the blinkenlights? V5 and V6 had the switch() call that read the
    switches, but it was dropped in V7, and there's nothing that would
    write to the lights. Is there any way of writing to the lights in Bell
    or BSD Unix? I'd love to be able to do something like this on my
    PiDP (running BSD2.11):

    #include <whatever.h>
    main()
    {
    somethingsomething(42); /* Set lights to 00101010 */
    }

    jgh
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From John Levine@johnl@taugh.com to alt.sys.pdp11 on Mon Aug 8 02:39:06 2022
    From Newsgroup: alt.sys.pdp11

    It appears that Jonathan Harston <jgh@mdfs.net> said:
    In Unix, user code can't "see" I/O locations. Is there an API to access
    the blinkenlights? V5 and V6 had the switch() call that read the
    switches, but it was dropped in V7, and there's nothing that would
    write to the lights.

    The lights weren't programmable on any PDP-11 I used. They showed
    the PC or address register or some other internal thing.

    If your emulated PDP-11 has programmable lights, it shouldn't be
    very hard to write a device driver that lets you write a word
    of data and puts it in the lights.
    --
    Regards,
    John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
    Please consider the environment before reading this e-mail. https://jl.ly
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bob Eager@news0009@eager.cx to alt.sys.pdp11 on Mon Aug 8 08:21:28 2022
    From Newsgroup: alt.sys.pdp11

    On Mon, 08 Aug 2022 02:39:06 +0000, John Levine wrote:

    It appears that Jonathan Harston <jgh@mdfs.net> said:
    In Unix, user code can't "see" I/O locations. Is there an API to access
    the blinkenlights? V5 and V6 had the switch() call that read the
    switches, but it was dropped in V7, and there's nothing that would write
    to the lights.

    The lights weren't programmable on any PDP-11 I used. They showed the
    PC or address register or some other internal thing.

    If your emulated PDP-11 has programmable lights, it shouldn't be very
    hard to write a device driver that lets you write a word of data and
    puts it in the lights.

    On older PDP-11s you could write to the switch register bus address and
    the value would appear on the DATA lights.

    Of course, you'd need a set-user-ID program (or a device driver) to do
    that.
    --
    Using UNIX since v6 (1975)...

    Use the BIG mirror service in the UK:
    http://www.mirrorservice.org
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From John Levine@johnl@taugh.com to alt.sys.pdp11 on Mon Aug 8 15:40:25 2022
    From Newsgroup: alt.sys.pdp11

    According to Bob Eager <news0009@eager.cx>:
    On older PDP-11s you could write to the switch register bus address and
    the value would appear on the DATA lights.

    Really? I programmed 11/20, 11/45, and 11/05 quite extensively and don't recall that on any of them.

    Looking at the 11/45 handbook I see the address for the switches is called switch and display register,
    so it's possible that worked, but they sure didn't document it very well.
    --
    Regards,
    John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
    Please consider the environment before reading this e-mail. https://jl.ly
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Johnny Billquist@bqt@softjar.se to alt.sys.pdp11 on Mon Aug 8 20:12:46 2022
    From Newsgroup: alt.sys.pdp11

    On 2022-08-08 00:52, Jonathan Harston wrote:
    In Unix, user code can't "see" I/O locations. Is there an API to access
    the blinkenlights? V5 and V6 had the switch() call that read the
    switches, but it was dropped in V7, and there's nothing that would
    write to the lights. Is there any way of writing to the lights in Bell
    or BSD Unix? I'd love to be able to do something like this on my
    PiDP (running BSD2.11):

    #include <whatever.h>
    main()
    {
    somethingsomething(42); /* Set lights to 00101010 */
    }

    You can do it.

    There are just a few things you need to sort:
    1. You need to have a recent version of 2.11BSD, in which the patch to
    control the secure level have been added.
    2. You need to set the secure level to 0 (I think it is) before going multiuser, so the system do not go into a more secure mode.
    3. Open /dev/kmem from your program, and read/write to the address where
    the CSR for the switch register is.

    If you have a secure mode you will only be able to read, and not write.

    I think a few people have already written such programs, which you might
    be able to find by searching for them as well.

    Johnny
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Johnny Billquist@bqt@softjar.se to alt.sys.pdp11 on Mon Aug 8 20:14:50 2022
    From Newsgroup: alt.sys.pdp11

    On 2022-08-08 04:39, John Levine wrote:
    It appears that Jonathan Harston <jgh@mdfs.net> said:
    In Unix, user code can't "see" I/O locations. Is there an API to access
    the blinkenlights? V5 and V6 had the switch() call that read the
    switches, but it was dropped in V7, and there's nothing that would
    write to the lights.

    The lights weren't programmable on any PDP-11 I used. They showed
    the PC or address register or some other internal thing.

    They were on several models. But it's a question of selecting what you
    display on the data lights.

    In addition to the switch register, there is also the WAIT instruction,
    which puts R0 on the data bus, which is also possible to see on the
    front panel. However, this isn't as stable as the switch register, but
    this is what most OSes used to display some kind of idle pattern.

    Johnny
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Johnny Billquist@bqt@softjar.se to alt.sys.pdp11 on Mon Aug 8 20:16:28 2022
    From Newsgroup: alt.sys.pdp11

    On 2022-08-08 10:21, Bob Eager wrote:
    On Mon, 08 Aug 2022 02:39:06 +0000, John Levine wrote:

    It appears that Jonathan Harston <jgh@mdfs.net> said:
    In Unix, user code can't "see" I/O locations. Is there an API to access
    the blinkenlights? V5 and V6 had the switch() call that read the
    switches, but it was dropped in V7, and there's nothing that would write >>> to the lights.

    The lights weren't programmable on any PDP-11 I used. They showed the
    PC or address register or some other internal thing.

    If your emulated PDP-11 has programmable lights, it shouldn't be very
    hard to write a device driver that lets you write a word of data and
    puts it in the lights.

    On older PDP-11s you could write to the switch register bus address and
    the value would appear on the DATA lights.

    If you selected to show the display register on the data lights, yes.

    Of course, you'd need a set-user-ID program (or a device driver) to do
    that.

    If we talk Unix. Under RT-11, it's very straight forward. Under RSX you
    need to have your program privileged/mapped to the I/O page. Under
    RSTS/E I have no idea...

    Johnny
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Johnny Billquist@bqt@softjar.se to alt.sys.pdp11 on Mon Aug 8 20:18:08 2022
    From Newsgroup: alt.sys.pdp11

    On 2022-08-08 17:40, John Levine wrote:
    According to Bob Eager <news0009@eager.cx>:
    On older PDP-11s you could write to the switch register bus address and
    the value would appear on the DATA lights.

    Really? I programmed 11/20, 11/45, and 11/05 quite extensively and don't recall that on any of them.

    The 11/45 definitely had this. Not sure about the other two models.
    Suspect the 11/05 did not, and the 11/20 I cannot remember at all how it
    was.

    Looking at the 11/45 handbook I see the address for the switches is called switch and display register,
    so it's possible that worked, but they sure didn't document it very well.

    Not much to document. If you look in the handbook on the front panel
    operation you find the additional details apart from the switch/display register as such.

    Johnny
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bob Eager@news0009@eager.cx to alt.sys.pdp11 on Mon Aug 8 21:07:01 2022
    From Newsgroup: alt.sys.pdp11

    On Mon, 08 Aug 2022 20:16:28 +0200, Johnny Billquist wrote:

    On 2022-08-08 10:21, Bob Eager wrote:

    On older PDP-11s you could write to the switch register bus address and
    the value would appear on the DATA lights.

    If you selected to show the display register on the data lights, yes.

    Of course, you'd need a set-user-ID program (or a device driver) to do
    that.

    If we talk Unix. Under RT-11, it's very straight forward. Under RSX you
    need to have your program privileged/mapped to the I/O page. Under
    RSTS/E I have no idea...

    The original question was about 2.9BSD.
    --
    Using UNIX since v6 (1975)...

    Use the BIG mirror service in the UK:
    http://www.mirrorservice.org
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bob Eager@news0009@eager.cx to alt.sys.pdp11 on Mon Aug 8 21:08:25 2022
    From Newsgroup: alt.sys.pdp11

    On Mon, 08 Aug 2022 20:12:46 +0200, Johnny Billquist wrote:

    3. Open /dev/kmem from your program, and read/write to the address where
    the CSR for the switch register is.

    Which requires a set-user-id program, or running as root (unless you
    choose to let all users write to kernel memory).
    --
    Using UNIX since v6 (1975)...

    Use the BIG mirror service in the UK:
    http://www.mirrorservice.org
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bob Eager@news0009@eager.cx to alt.sys.pdp11 on Mon Aug 8 21:28:19 2022
    From Newsgroup: alt.sys.pdp11

    On Mon, 08 Aug 2022 21:07:01 +0000, Bob Eager wrote:

    On Mon, 08 Aug 2022 20:16:28 +0200, Johnny Billquist wrote:

    On 2022-08-08 10:21, Bob Eager wrote:

    On older PDP-11s you could write to the switch register bus address
    and the value would appear on the DATA lights.

    If you selected to show the display register on the data lights, yes.

    Of course, you'd need a set-user-ID program (or a device driver) to do
    that.

    If we talk Unix. Under RT-11, it's very straight forward. Under RSX you
    need to have your program privileged/mapped to the I/O page. Under
    RSTS/E I have no idea...

    The original question was about 2.9BSD.

    Sorry, 2.11BSD.
    --
    Using UNIX since v6 (1975)...

    Use the BIG mirror service in the UK:
    http://www.mirrorservice.org
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From drb@drb@ihatespam.msu.edu (Dennis Boone) to alt.sys.pdp11 on Mon Aug 8 19:34:46 2022
    From Newsgroup: alt.sys.pdp11

    On older PDP-11s you could write to the switch register bus address and
    the value would appear on the DATA lights.

    Some DEC operating systems had a light pattern they moved around in
    the lights from the backstop process.

    De
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From =?UTF-8?Q?Walter_F=2EJ=2E_M=C3=BCller?=@wfjm.andro@gmail.com to alt.sys.pdp11 on Tue Aug 9 01:39:16 2022
    From Newsgroup: alt.sys.pdp11

    On Tuesday, August 9, 2022 at 2:34:52 AM UTC+2, Dennis Boone wrote:
    Some DEC operating systems had a light pattern they moved around in
    the lights from the backstop process.
    What is displayed on a 11/45 or 11/70 console on the data lights can be controlled via a rotary switch. The display register is one option, and that register can be written by any code with access to the I/O page. The data path is another option. And here the WAIT instruction comes in, as Johnny already mentioned. WAIT loads R0 into the internal machine register which is displayed in this case before it waits for an interrupt. That is used by the idle task on DEC and BSD operating systems and causes the typical look. The code for 2.11BSD is for example in
    https://www.retro11.de/ouxr/211bsd/usr/src/sys/pdp/mch_xxx.s.html#s:_idle
    A stand-alone program which shows all kinds of patterns is under
    https://github.com/wfjm/w11/blob/master/tools/mcode/sys/blink.mac
    --- Synchronet 3.21d-Linux NewsLink 1.2