PDP-8 buildsΒΆ
Re-implementing the venerable PDP minicomputers with modern hardware
Git repository: https://git.jeelabs.org/embello/tree/explore/1638-pdp8
Weblog postsΒΆ
- The PDP-8, half a century ago β Feb 2016
- TFoC β PDP-8 in 256 lines of C β Sep 2016
- STM32F103 emulating a PDP-8 β Oct 2016
- PDP-8/L & DF32 disk on FPGA β Oct 2016
PDP-8 in a Blue PillΒΆ
The PDP-8 is a surprisingly simple computer, easily emulated in software as the above weblog posts illustrate. Here is another build, running on the βBlue Pillβ (which costs about as much as that coin next to it):
This one is really as basic as it gets. It has the FOCAL language interpreter in flash memory and emulates a single 4 Kword βfieldβ using 8 KB RAM. A USB console driver is included, so itβs all plug-and-play.
This emulator is written in Forth, which allows for very concise coding. Here is the implementation of 6 of the 8 opcodes in a PDP-8, as well as the main instruction fetch/decode/execute handler:
: op0 ( u -- ) addr m@ 10000 or ac and ac! ; AND
: op1 ( u -- ) addr m@ ac + low13 ac! ; TAD
: op2 ( u -- ) addr dup m@ 1+w dup rot m! 0= if ++pc then ; ISZ
: op3 ( u -- ) addr ac dup low12 rot m! clr12 ac! ; DCA
: op4 ( u -- ) addr pc over m! 1+w pc! ; JMS
: op5 ( u -- ) addr pc! ; JMP
op6 and op7 are more involved and omitted here for brevity...
create op-tab ' op0 , ' op1 , ' op2 , ' op3 , ' op4 , ' op5 , ' op6 , ' op7 ,
: cycle ( -- ) execute one instruction
iena @ 2/ iena ! bit 0 determines whether interrupts are enabled
pc dup 1+w pc! m@
dup 7 rshift %11100 and op-tab + @ execute ;
The entire emulator consists of a little over 100 lines of source code and can be found on this Git page. Installation details are in the README.