Code Monkey home page Code Monkey logo

pdp6's Introduction

PDP-6 Emulator

This project aims to revive the PDP-6 computer by DEC.

I started by writing a very low level emulator in C based on the schematics. Later I also wrote an accurate verilog simulation that also works on an FPGA.

Both are driven by a virtual front panel but the plan is to create a replica of the original panel.

The maintenance manual has flow charts, schematics and explanations: Volume1 Volume2

Screenshot of the front panel

C Emulator

The code is more or less a transcription of the schematics into C. This means you will not understand it unless you're familiar with the maintenance manual. Pulses are represented as functions, when a pulse triggers another pulse it does so by the pulse function which queues a pulse in a list of pulses that are to happen, sorted chronologically. Between pulses that happen at different times various things are done like checking external pulses and advancing the simulation state. The timing is not yet 100% accurate but it's pretty close.

Building

The supplied makefile assumes gcc (there are flags to silence some stupid warnings). Otherwise you need SDL and pthread.

Running

The cpu (apr), console tty, paper tape and punch, the data control and DECtape are implemented. 340 display is also sort of working. The panel is missing the repeat delay knobs, but the functionality is implemented.

File tree

NB: not up to date

emu	the C emulator
emu/main_panel.c	main file for emulator with panel simulation
emu/main_serial.c	main file for emulator with panel over serial line
emu/emu.c	top level emulator code
emu/cmd.c	command line interface
emu/apr.c	Arithmetic Processor 166 emulation
emu/mem.c	core and fast memory emulation
emu/tty.c	Teleprinter 626 emulator
emu/pt.c	Paper tape reader 760 and punch 761 emulation
emu/dc.c	Data Control 136 emulation
emu/dt.c	DECtape 551 and 555 emulation
emu/netmem.c	network protocol for shared memory
emu/util.c	various utility functions
emu/util.h
emu/test_*.c	test code, not too important anymore
emu/pdp6.h	main header
emu/args.h	argument parsing
emu/elements.inc	panel definition
emu/cmds.txt	command line interface documentation
emu/init.ini	emulator init file
emu/mem_*	core memory backing store

tools
tools/dtr2dta.c	convert between raw (dtr) and simh (dta) DECtape format
tools/mkpty.c	make a pty and connect to the controlling tty
tools/mkpty33.c	as above but try to pretend an ASR33
tools/as6.c	an assembler, roughly modeled on MACRO
tools/ld6.c	a loader of relocatable files
tools/pdp6bin.h
tools/pdp6common.c	useful functions for PDP-6 code
tools/pdp6common.h
tools/rel.c	I have no recollection of this code
tools/reltest.c	old test code to create a REL file
tools/test.s	old test code for the assembler/linker
tools/test2.s
tools/ptdump.c	print a paper tape file in octal
tools/dtdump.c	print dtr DECtape

code	random code for the PDP-6, mostly testing
code/bootstrap.txt	a list of boot loaders
code/dtboot.s		loads the first block from a DECtape
code/main.s		random entry
code/tty.s		tty character IO

panel	stand alone panel with lots of duplicate code

art	image files for the panel

misc	nothing important

To do

  • repeat and maint. switches on panel
  • improve timing
  • do more tests
  • ...

pdp6's People

Contributors

aap avatar larsbrinkhoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdp6's Issues

Toggling switches kills pdp6

This commit breaks something in pdp6: 8b0849d

How to repeat:

  1. Toggle "POWER".
  2. Toggle either "READ IN / START" or "MEMORY / INSTRUCTION CONTINUE".
  3. SDL window closes, pdp6 killed.

Problem writing to shared locations

3406 and 340D shares some memory locations without being overly careful about synchronizing access: PDP-10/its#1600 In particular they will both use halfword instructions to write ones or zeroes to the left half of the words in the table FLAGS. E.g. HRROS or HRRZS.

I have noticed that sometimes this will result in words being left all cleared.

Missing assembly files

When I run the makefile in the code directory it tell me that sysgen.rel is missing and after also opening the makefile I notice other .rel files are missing. Where can I find them so I can play around with the system?

Thank you for your time.

Running pdp6 emulator from script

I'd like to run the pdp6 emulator from a script, like this:

(cd .../pdp6/emu; ./pdp6 > pdp6.log 2>&1) &

This starts the program in the background, logging output to a file. However, in this case it will not open the SDL window to display the PDP-6 console.

Secondly, pdp6 shows a > prompt waiting for input. I'm not sure I need to enter a command or not to have the PDP-6 running?

Compiler issue in joy.c

I am using Fedora 40, and have hit a compilation issue in pdp6.

In tools/pdp6/emu/joy.c I had to add:

#include <unistd.h>

This was needed because close() was undefined and the compiler treated it as an error.

340 interrupt problem?

As described in #13.

This is what pdp6 does:

MB/713100000016 MA/000042 BLKO DIS,BLKOP  ;Last BLKO
MB/777777000144 MA/000016
MB/000000000145 MA/000016
MB/264000000111 MA/000043 JSR RECYC       ;Overflow cycle.
MB/044000000110 MA/000111
MB/200700000146 MA/000112 MOVE BLKOP,[-DLEN,,DLIST-1]
MB/777747000114 MA/000146
MB/777747000114 MA/000016
MB/713200000101 MA/000113 CONO DIS,100+DISCHN
MB/254520000111 MA/000114 JRST 12,@RECYC
MB/044000000110 MA/000111

MB/713100000016 MA/000042 BLKO DIS,BLKOP  ;BLKO from the start of the display list.
MB/777747000114 MA/000016
MB/777750000115 MA/000016
MB/020137261750 MA/000115 

MB/254000000110 MA/000110 JRST .          ;After this, just JRST . forever.

missing include for <sys/select.h>

On OpenBSD, fd_set is declared in <sys/select.h>.

fd_set fds;

diff --git a/emu/util.c b/emu/util.c
index fcaed91..4b1af68 100644
--- a/emu/util.c
+++ b/emu/util.c
@@ -3,6 +3,7 @@
 #include <ctype.h>
 
 #include <sys/socket.h>
+#include <sys/select.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <unistd.h>

ITS 138 additions

Some things needed to run ITS 138:

  • Microtape OH NOES
  • TTY device with four more lines - see AI memo 105
  • GE typeout and typein devices.
  • MAR for catching memory references.
  • One-proceed for single stepping in timesharing.

make fails on MacOS Ventura

trying to build PDP6 as part of ITS build and stand alone fails with this error.
Environment: Mac OS Ventura13.6.3 (22G436)
Xcode: 15.2

emu % make
cc -o pdp6 -g -O3 -Wall -Wno-parentheses -Wno-implicit-function-declaration  `sdl2-config --cflags` `pkg-config SDL2_image --cflags` -DGRAPHICS main_panel.c dis340.c joy.c emu.c apr.c mem.c tty.c pt.c dc.c dt.c netmem.c netcons.c cmd.c util.c threading.c rtc.c ../tools/pdp6common.c -lpthread -lm `sdl2-config --libs` `pkg-config SDL2_image --libs`
main_panel.c:792:1: warning: unused function 'drawgrid' [-Wunused-function]
drawgrid(Grid *g, SDL_Texture *s, Uint32 col)

.... More warnings here                              

threading.c:216:37: error: too many arguments to function call, expected 1, have 2
        pthread_setname_np(pthread_self(), name);
        ~~~~~~~~~~~~~~~~~~                 ^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:535:5: note: 'pthread_setname_np' declared here
int     pthread_setname_np(const char*);
        ^
1 error generated.                                                 
make: *** [pdp6] Error 1

Here is the full make output

emu % make
cc -o pdp6 -g -O3 -Wall -Wno-parentheses -Wno-implicit-function-declaration  `sdl2-config --cflags` `pkg-config SDL2_image --cflags` -DGRAPHICS main_panel.c dis340.c joy.c emu.c apr.c mem.c tty.c pt.c dc.c dt.c netmem.c netcons.c cmd.c util.c threading.c rtc.c ../tools/pdp6common.c -lpthread -lm `sdl2-config --libs` `pkg-config SDL2_image --libs`
main_panel.c:792:1: warning: unused function 'drawgrid' [-Wunused-function]
drawgrid(Grid *g, SDL_Texture *s, Uint32 col)
^
1 warning generated.                                               
dis340.c:835:12: warning: unused variable 'ev' [-Wunused-variable]
        SDL_Event ev;
                  ^
1 warning generated.                                               
apr.c:143:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                p += sprintf(p, " AR/%012lo", apr->n.ar);
                                     ~~~~~~   ^~~~~~~~~
                                     %012llo                       
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'                                    
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
apr.c:145:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                p += sprintf(p, " MB/%012lo", apr->n.mb);
                                     ~~~~~~   ^~~~~~~~~
                                     %012llo                       
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'                                    
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
apr.c:147:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                p += sprintf(p, " MQ/%012lo", apr->n.mq);
                                     ~~~~~~   ^~~~~~~~~
                                     %012llo                       
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'                                    
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
apr.c:124:1: warning: unused function 'pprint' [-Wunused-function] 
pprint(Apr *apr)
^
apr.c:137:1: warning: unused function 'tracechange' [-Wunused-function]
tracechange(Apr *apr)
^
5 warnings generated.                                              
mem.c:55:27: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                        fprintf(f, "%012lo\n", mem[a++]);
                                    ~~~~~~     ^~~~~~~~
                                    %012llo                        
1 warning generated.                                               
netmem.c:59:34: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                printf("write %06lo %012lo\n", a, d);
                              ~~~~~            ^
                              %06llo                               
netmem.c:59:37: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                printf("write %06lo %012lo\n", a, d);
                                    ~~~~~~        ^
                                    %012llo                        
netmem.c:70:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                printf("read %06lo %012lo\n", a, d);
                             ~~~~~            ^
                             %06llo                                
netmem.c:70:36: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                printf("read %06lo %012lo\n", a, d);
                                   ~~~~~~        ^
                                   %012llo                         
netmem.c:87:34: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
        printf("error address %06lo\n", a);
                              ~~~~~     ^
                              %06llo                               
5 warnings generated.                                              
cmd.c:192:20: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
        printf("%06lo: ", addr);
                ~~~~~     ^~~~
                %06llo                                             
cmd.c:196:22: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                printf("%012lo\n", *p);
                        ~~~~~~     ^~
                        %012llo                                    
cmd.c:498:24: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
                                printf("%012lo\n", w);
                                        ~~~~~~     ^
                                        %012llo                    
3 warnings generated.                                              
threading.c:216:37: error: too many arguments to function call, expected 1, have 2
        pthread_setname_np(pthread_self(), name);
        ~~~~~~~~~~~~~~~~~~                 ^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:535:5: note: 'pthread_setname_np' declared here
int     pthread_setname_np(const char*);
        ^
1 error generated.                                                 
make: *** [pdp6] Error 1

Improve audiovisual experience

The blinkenlights front panel simulator is great!

But I know what would make it ever greater: A full 3D model of a PDP-6. Do you know someone who is handy with 3D modelling software? (I don't.)

And then add another sense: sound. Clicking when flicking switches. Whirring DECtapes. Teletype printing. Punching paper tape!

Caching for network shared memory

I jotted down a diagram for states I imagine a cache for network shared memory could have. This could be per-region or even on a single word basis.

Screenshot from 2024-04-12 15-16-34

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.