Jump to content
Science Forums

Recommended Posts

Posted (edited)

Programming a Neural Network on the Altair 8800 Using Front Panel Switches

Programming the Altair 8800 using its front panel switches requires manually entering machine code one byte at a time. Here's how you could implement a neural network:

Preparation

1. Understand the limitations:
   - You'll need to work in 8080 machine code (not BASIC)
   - Memory is extremely limited (typically 4K-8K)
   - Floating point math must be implemented in software
   - The program must be very simple

2. Simplified approach:
   - Implement a single perceptron (1-layer neural network)
   - Use 8-bit fixed-point arithmetic instead of floating point
   - Train on a simple problem (like AND or OR, not XOR)

Step-by-Step Switch Programming

1. Set Up Memory Address

1. Set the address switches to `0000` (start of memory)
2. Press `DEPOSIT NEXT` to confirm

2. Enter Machine Code

Here's a simple perceptron learning AND function (weights will be 8-bit signed integers):

```
; 8080 Machine Code for Simple Perceptron
; Inputs: B, C (0 or 1)
; Output: A (0 or 1)
; Weights at 0050-0052 (w1, w2, bias)
; Learning rate = 1

0000: 3E 00       MVI A,00    ; Initialize
0002: 32 50 00    STA 0050    ; w1 = 0
0005: 32 51 00    STA 0051    ; w2 = 0
0008: 32 52 00    STA 0052    ; bias = 0

; Training loop (one epoch)
000B: 06 00       MVI B,00    ; input 0,0
000D: 0E 00       MVI C,00
000F: CD 20 00    CALL 0020    ; Train with target 0
0012: 06 00       MVI B,00    ; input 0,1
0014: 0E 01       MVI C,01
0016: CD 20 00    CALL 0020    ; Train with target 0
0019: 06 01       MVI B,01    ; input 1,0
001B: 0E 00       MVI C,00
001D: CD 20 00    CALL 0020    ; Train with target 0
0020: 06 01       MVI B,01    ; input 1,1
0022: 0E 01       MVI C,01
0024: CD 20 00    CALL 0020    ; Train with target 1
0027: C3 0B 00    JMP 000B    ; Repeat

; Training subroutine (0020)
; Input: B,C = inputs, A = target
0020: DB 50       IN 50       ; Get w1
0022: 82          ADD B       ; w1*x1
0023: DB 51       IN 51       ; Get w2
0025: 81          ADD C       ; +w2*x2
0026: DB 52       IN 52       ; Get bias
0028: 87          ADD A       ; +bias
0029: D3 01       OUT 01      ; Display (for debugging)
002B: 3C          INR A       ; Threshold (simplified)
002C: D6 01       SUI 01      ; Convert to 0/1
002E: 91          SUB C       ; Compare to target (in C)
002F: CA 40 00    JZ 0040     ; If correct, done
0032: 3A 50 00    LDA 0050    ; Update w1
0035: 80          ADD B
0036: 32 50 00    STA 0050
0039: 3A 51 00    LDA 0051    ; Update w2
003C: 81          ADD C
003D: 32 51 00    STA 0051
0040: C9          RET         ; Return
```

3. Entering the Program

For each byte:
1. Set the data switches to the byte value (in binary)
2. Press `DEPOSIT` to store it
3. The address will auto-increment
4. Repeat for all bytes

4. Running the Program

1. Set address switches to `0000`
2. Press `RESET`
3. Press `RUN`

5. Observing Results

The program will:
1. Continuously train on AND function
2. Output intermediate results to port 1 (you'd need LED display)
3. The weights will be stored at 0050-0052

Edited by aemiliotis
Posted

Output of the Altair 8800 Neural Network Program

1. LED Display Output:
   - The simple program I provided outputs to port 01 (via `OUT 01` instruction)
   - This would light up the data lights on the front panel
   - The binary pattern represents the current output of the perceptron

2. Memory Inspection:
   - You could examine memory locations 0050-0052 to see the learned weights
   - Use the EXAMINE function on the front panel to view these values

Expected Output Patterns

For the AND function training:

1. Initial Phase (weights all zero):
   - Output lights would show 00 (always predicting 0)
   - All training samples would show incorrect initially

2. Learning Progress:
   - As weights update, you'd see the output change:
     - For inputs (0,0): Should output 0
     - For inputs (0,1): Should output 0
     - For inputs (1,0): Should output 0
     - For inputs (1,1): Should output 1
   - The lights would flicker as the weights adjust

3. Converged Solution:
   - Eventually you should see stable correct outputs:
     - Typical final weights might be something like:
       - w1 = 00000001 (binary) = +1
       - w2 = 00000001 (binary) = +1
       - bias = 11111111 (binary) = -1 (using two's complement)
     - This implements the AND function correctly

Interpreting the Lights

For the `OUT 01` instruction:
- The 8 data lights represent one byte of information
- In our simple program, only the least significant bit (rightmost light) matters:
  - Light OFF (0): Perceptron output 0
  - Light ON (1): Perceptron output 1

Example Observation Session

1. After several training cycles:
   - Input (0,0): Rightmost light OFF (correct)
   - Input (0,1): Rightmost light OFF (correct)
   - Input (1,0): Rightmost light OFF (correct)
   - Input (1,1): Rightmost light ON (correct)

2. If you examine memory:
   - Address 0050: w1 (probably 00000001)
   - Address 0051: w2 (probably 00000001)
   - Address 0052: bias (probably 11111111)

Limitations to Note

1. The output is extremely minimal - just one bit of information
2. There's no decimal display or formatted output
3. You're essentially watching binary patterns on lights
4. The program runs continuously - there's no "final output" unless you stop it

  • aemiliotis changed the title to Neural Network on the Altair 8800 Using Front Panel Switches
Posted (edited)

This is interesting, I am always interested in A.I. and neural network research. I have designed a neural network before for A.I. and this is a different approach to the subject which is cool using the LED lights to show information.

Edited by Vmedvil

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...