PiDP-8/I Software

Changes To Incandescent Thought
Log In

Changes to "Incandescent Thought" between 2019-04-01 14:57:25 and 2019-04-01 19:06:16

9
10
11
12
13
14
15


16
17
18
19
20
21
22
23
24
25
26

27

28
29
30
31
32
33
34
35
36

37
38
39
40
41






42
43
44
45
46
47
48
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38

39
40
41



42
43
44
45
46
47
48
49
50
51
52
53
54







+
+










-
+

+








-
+


-
-
-
+
+
+
+
+
+








Davie's program has been [forked several times](https://github.com/timdawg/Deeper-Tought-2/network), but this mode of operation remains in all of the versions I've tried.

When Ian Schofield created the [incandescent lamp simulator](/wiki?name=Incandescent+Lamp+Simulator) (ILS) for the PiDP-8/I, he changed the external interface in a couple of ways which prevented it from being used with any of these versions of Deeper Thought.

When I rewrote the ILS, one of the things I did was add a compatibility interface for programs like Deeper Thought which remain dependent on the old `gpio.c` module interface. This article describes the steps you must take to build a version of Deeper Thought against our new ILS.

If you are running a single-core Pi (e.g. Zero, original A+, original B+...) there is little point to doing this. Just stop the PiDP-8/I simulator and run your chosen version of Deeper Thought directly, as its GPIO method will work the same as our NLS method.


# Modifying `deeper.c`

The first thing you have to do to build any version of Deeper Thought against the current version of the PiDP-8/I software is copy its `deeper.c` file into the PiDP-8/I software's `src/misc` subdirectory:

    $ cd ~/pidp8i                  ⇠ or wherever the PiDP-8/I source code is
    $ cp /path/to/deeper/thought/deeper.c src/misc

Use your favorite Linux text editor to make a few adjustments to `src/misc/deeper.c` to get it to build:

1. Add the following line between the big block comment at the top of the file and the `#include` lines following it, at line 156 or so:
1. Add the following lines between the big block comment at the top of the file and the `#include` lines following it, at line 156 or so:

        #define _XOPEN_SOURCE 500
        #include "gpio-common.h"

2. Remove these lines, found up among the `#include` lines:

        extern void *blink(void *ptr); // the real-time multiplexing process to start up
        extern uint32 ledstatus[8];     // bitfields: 8 ledrows of up to 12 LEDs
        extern uint32 switchstatus[3];  // bitfields: 3 rows of up to 12 switches

3. Replace the block of code beginning with the `pthread_create()` call and ending with `sleep(2)` — inclusive — with the following:
3. Replace the block of code beginning with the `pthread_create()` call and ending with `sleep( 2 )` — inclusive — with the following:

        pidp8i_simple_gpio_mode = 1;
        if (start_pidp8i_gpio_thread ("Deeper Thought 2") != 0) exit (EXIT_FAILURE);

With that done, you must reconfigure the software to get it to recognize that `deeper.c` has been added to the `src` subdirectory. If you're happy with your current configuration, this will do the trick:
        if (start_pidp8i_gpio_thread ("Deeper Thought 2") != 0) {
          fprintf( stderr, "Failed to start GPIO thread.  PiDP-8/I panel attached?\n" );
          exit (EXIT_FAILURE);
        }

With that done, you must reconfigure the software to get it to recognize that `deeper.c` has been added to the `src` subdirectory. If you're happy with your current PiDP-8/I software configuration, this will do the trick:

    $ make reconfig

Otherwise, re-read `README.md` and run `configure` manually:

    $ ./configure --with-your-new-option-set