Papertapes
PDP8 Paper tapes
We recently acquired a library of PDP8 paper tapes dating from 1965 to 1970 and have read them with the ASR33 teletype. Many of the tapes are in ok shape and have fed through the reader without any problems so far. The ones that are in ASCII source code are reading fine. The binary tapes have been read with an optical papertape reader, designed by Adam Mayer.
The PDP-8 Family Paper Tape System User's Guide (DEC-08-NGCC-D) has a table on page INTRO-14 defining the formats, and another table on page A-1 that shows the encoding of 8-bit and 6-bit ASCII. Since the PDP was a 12-bit machine, two 6-bit ASCII characters can be packed into a single word.
Single precision
Signed floating-point multiply
Label
DEC-08-FMBA-PA 7/28/66 SINGLE PRECISION SIGNED MULTIPLY SUBROUTINE
Source
/TWO'S COMPLEMENT SINGLE PRECISION MULTIPLY ROUTINE
/RETURN HIGH ORDER PRODUCT IN AC, LOW IN MP1
MULT, 0
CLL
SPA /TEST FOR NEGATIVE MULTIPLIER
CMA CML IAC
DCA MP1 /STORE MULTIPLIER
DCA MP5
TAD I MULT
SNA /TEST FOR ZERO MULTIPLICAND
JMP MPSN+2
SPA /TEST FOR NEGATIVE MULTIPLICAND
CMA CML IAC
DCA MP2 /STORE MULTIPLICAND
TAD THIR
DCA MP3
MP4, TAD MP1 /MULTIPLY LOOP PROPER
RAR
DCA MP1
TAD MP5
SZL /TEST IF MULTIPLICAND SHOULD BE ADDED
TAD MP2
CLL RAR
DCA MP5
ISZ MP3 /TEST FOR END OF LOOP
JMP MP4
TAD MP1
RAR
MPSN, SZL
JMP COMP
DCA MP1
TAD MP5
MPZ, ISZ MULT /EXIT
JMP I MULT
COMP, CMA CLL IAC /COMPLEMENT PRODUCT
DCA MP1
TAD MP5
CMA
SZL
IAC
JMP MPZ
THIR, 7764 /ELEVEN IN DECIMAL
MP1, 0
MP5, 0
MP2, 0
MP3, 0
$
Signed floating-point divide
Label
DEC-08-FMCA-PA 7/65 SINGLE PRECISION SIGNED DIVIDED SUBROUTINE
Source
/DIGITAL-8-12-F
/SIGNED SINGLE PRECISION DIVIDE SUBROUTINE
/CALLING SEQUENCE:
/ C(AC) CONTAINS HIGH ORDER DIVIDEND
/ JMS DIVIDE
/ LOW ORDER DIVIDEND
/ DIVISOR
/ RETURN: C(AC)=QUOTIENT; REMAINDER IN HDIVND
/IF HIGH ORDER DIVIDEND IS EQUAL TO OR GREATER
/THAN THE DIVISOR; NO DIVISION TAKES PLACE AND C(L)=1
/PAGE 1
DIVIDE, 0
CLL
SPA /DIVIDEND<0?
CMA CML /YES COMPLEMENT AND SET C(L)
DCA HDIVND /HIGH ORDER DIVIDEND
SNL
CMA
DCA SDVND /SET DIVIDEND SIGN SWITCH
TAD I DIVIDE /FETCH LOW ORDER DIVIDEND
SZL
CMA CLL IAC /YES: COMPLEMENT
DCA LDIVND /LOW ORDER DIVIDEND
SZL /CARRY?
ISZ HDIVND /YES
ISZ DIVIDE
TAD I DIVIDE /FETCH DIVISOR
CLL
SMA
CMA CML IAC /NEGATE IT
DCA DIVSOR /SAVE DIVISOR
SNL /WAS IT <0?
CMA /YES: AC=-1
TAD SDVND
DCA SNSWER /ANSWER SIGN SWITCH
CLL
TAD DIVSOR /COMPARE DIVISOR
TAD HDIVND /WITH DIVIDEND
ISZ DIVIDE
SZL CLA /OVER FLOW?
JMP I DIVIDE /YES: DIVISOR<DIVIDEND
/DIGITAL-8-12-F
/PAGE 2
TAD M13 /13 SHIFTS
DCA DIVCNT
JMP DV2
/DIVIDE LOOP
DV3, TAD HDIVND
RAL
DCA HDIVND /DIVIDEND LEFT SHIFT
TAD HDIVND
TAD DIVSOR /COMPARE DIVISOR;DIVIDEND
SZL
DCA HDIVND /REMAINDER AFTER SUBTRACT
CLA
DV2, TAD LDIVND /QUOTIENT BITS
RAL /ENTER HERE
DCA LDIVND
ISZ DIVCNT /DONE 12?
JMP DV3 /NO: CONTINUE
TAD HDIVND /REMAINDER
ISZ SDVND /DIVIDEND<0?
CMA IAC /YES
DCA HDIVND
TAD LDIVND /QUOTIENT
ISZ SNSWER /ANSWER<0?
CMA IAC /YES: NEGATE
CLL
JMP I DIVIDE /EXIT
HDIVND, 0
LDIVND, 0
DIVSOR, 0
SDVND, 0
SNSWER, 0
DIVCNT, 0
M13, -15 /-13(10)
$
Single Precision Square Root Routine
DEC-08-FMAA-PA 7/10/65
/DIGITAL-8-9-F
/SQUARE ROOT ....... ENTER WITH SQUARE IN AC
/ EXITS WITH ROOT IN AC
/ ODD INTEGER METHOD
SQRT, 0
DCA SQR1 /SAVE INPUT
DCA ROOT /0 TO ANSWER
TAD SQR2 /-1; FIRST ATTEMPT
SQX, DCA SQRD
TAD SQR1 /COMPARE INPUT
CLL /WITH THIS TRY
TAD SQRD
SNL
JMP SQRF /TEST>INPUT; ALL DONE
ISZ ROOT /ADD +1 TO ANSWER
DCA SQR1 /INPUT=INPUT-TEST
TAD SQRD
TAD SQR3 /TEST=TEST-2
JMP SQX /CONTINUE
SQRF, CLA
TAD ROOT /FETCH ANSWER
JMP I SQRT /EXIT
SQR1, 0
SQR2, -1
SQR3, -2
SQRD, 0
ROOT, 0
$
Double Precision
Cosine
This one is short -- it calls sin(x-Pi/2)
.
Label
DEC-08-FMGA-PA 7/10/65 DOUBLE PRECISION COSINE SUBROUTINE
Source
/DIGITAL-8-18-F
/DOUBLE PRECISION COSINE SUBROUTINE
/CALLS DIGITAL-8-16-F
/POINTERS TO DIGITAL-8-16-F
ARG=741
DSIN=400
*1000
DCOS, 0
TAD I DCOS /FETCH ADDRESS OF
DCA ADDRSS /ARGUMENT
TAD I ADDRSS /FETCH HIGH ORDER
DCA X /ARGUMENT
ISZ ADDRSS /INCREMENT ADDRESS POINTER
TAD I ADDRSS /FETCH LOW ORDER
DCA X+1 /ARGUMENT
TAD X /IS ARGUMENT EQUAL
SZA CLA /TO ZERO
JMP TSIGN /NO: TEST THE SIGN
TAD X+1 /TEST LOW ORDER BITS
SZA CLA /FOR ZERO
JMP TSIGN /NOT EQUAL TO ZERO
CMA
RAR
DCA I ARGPNT
CMA
DCA I ARGPNT+1 /SET ANSWER TO 1
JMP EXIT
TSIGN, TAD X /SEE IF X>0
SMA CLA
JMP ARGPOS /ARGUMENT IS >0
TAD X+1 /ARGUMENT IS <0
CLL CMA IAC /NEGATE IT
DCA X+1
TAD X
CMA
SZL
IAC
DCA X
/DIGITAL-8-18-F
/PAGE 2
ARGPOS, CLL CLA
TAD X+1
CMA IAC
TAD PIOT+1 /SUBTRACT X FROM
DCA X+1 /PI/2
TAD X
CMA
SZL
IAC
TAD PIOT
DCA X
JMS I DSINPT /CALL SINE SUBROUTINE
X /ARGUMENT ADDRESS
EXIT, ISZ DCOS /RETURN TO CALL+1
JMP I DCOS /ANSWER IN ARG,ARG+1
X, 0
0
ARGPNT, ARG
ARG+1
ADDRSS, 0
DSINPT, DSIN
PIOT, 1444
1767
$
Sine
Label
DEC-08-FMFA-PA 7/7/65 DOUBLE PRECISION SINE SUBROUTINE
Source
/DIGITAL-8-16-F
/DOUBLE PRECISION SINE
/POINTERS TO DIGITAL-8-13-F
DMUL=0200
B=0341
C=0342
*400
DSIN, 0
TAD I DSIN /ADDRESS OF ARGUMENT
DCA TEMP
TAD I TEMP /HIGH ORDER
DCA X2
ISZ TEMP
TAD I TEMP /LOW ORDER
DCA X2+1
ISZ DSIN /FIX EXIT
TAD DSIN /SAVE ON PUSHDOWN LIST
DCA I PUSH
ISZ PUSH
TAD X2 /CHECK FOR ZERO
SZA CLA
JMP NEG
TAD X2+1
SZA CLA
JMP NEG /NO
CLA
DCA I PNT3 /SIN(0)=0
DCA I PNT3+1
XIT1, CLA CMA /EXIT
TAD PUSH
DCA PUSH
TAD I PUSH
DCA TEMP
JMP I TEMP
NEG, TAD X2 /CHECK FOR NEGATIVE X
SMA CLA
JMP POS
TAD X2+1 /SIN(-X)=-SIN(X)
CLL CMA IAC
DCA X2+1
TAD X2
CMA
SZL
IAC
DCA X2
/DIGITAL-8-16-F
/PAGE 2
JMS DSIN /RECURSIVE CALL FOR SINE
X2
XIT2, TAD I PNT3+1 /NEGATE THE ANSWER
CLL CMA IAC
DCA I PNT3+1
TAD I PNT3
CMA
SZL
IAC
DCA I PNT3
JMP XIT1
POS, CLL /IS X<PI?
TAD X2+1
TAD MPI+1
DCA TEMP
RAL /CARRY
TAD X2
TAD MPI
SPA
JMP PCHK
DCA X2 /SIN(X)=-SIN(X-PI)
TAD TEMP
DCA X2+1
JMS DSIN
X2
JMP XIT2
PCHK, CLA CLL /IS X<PI/2?
TAD X2+1
TAD MPIO+1
DCA TEMP
RAL
TAD X2
TAD MPIO
SPA
JMP ALG
SZA
JMP P2NG
TAD TEMP
SZA
JMP P2NG
CMA CLL /SIN(PI/2)=1
RAR
DCA I PNT3
CMA
DCA I PNT3+1
JMP XIT1
/DIGITAL-8-16-F
/PAGE 3
P2NG, CLL CLA
TAD X2+1
TAD MPI+1 /SIN(X)=-SIN(X-PI)
DCA X2+1
RAL
TAD X2
TAD MPI
DCA X2
JMS DSIN /RECURSIVE CALL FOR SINE
X2
JMP XIT2
ALG, CLA /ALIGN SCALING FOR ALGORITHM
TAD X2+1
CLL RAL
DCA I PNT2+1
TAD X2
RAL
DCA I PNT2
JMP I PNT4
/SYMBOLS AND CONSTANTS FOR THIS PAGE
X2, 0
0
TEMP, 0
PNT2, X
X+1
PNT3, ARG
ARG+1
PNT4, DALG
MPI, 4667 /-(PI)
4023
MPIO, 6333 /-(PI/2)
6012
PUSH, PUSH+1 / POINTER FOR PUSHDOWN LIST
/DIGITAL-8-16-F
/PAGE 4
*DSIN+200
DALG, JMS I DMTG /FORM (2/PI)*ARG
X
TOPI
JMS SCAL /GET RID OF EXTRA SIGN BIT
JMS SCAL /SCALING = 0 NOW
JMS ROUND
X
JMS I DMTG /GET X*X
X
X
JMS SCAL /GET RID OF EXTRA SIGN BIT
JMS ROUND
XSQR
TAD FYX /INI
DCA PNT / T
TAD FOUR / I
DCA CHK / A
DCA ARG / L
DCA ARG+1 / IZE
LOOP, CLL
TAD I PNT
TAD ARG+1
DCA ARG+1
ISZ PNT
RAL
TAD ARG
TAD I PNT
DCA ARG
ISZ PNT /INCREMENT POINTER FOR NEXT
JMS I DMTG
ARG
XSQR
JMS SCAL /GET RID OF SIGN BIT
JMS ROUND
ARG
ISZ CHK
JMP LOOP
CLL
TAD ARG /SHIFT ARG 1 PLACE
SPA
CML
RAR
DCA ARG
TAD ARG+1
RAR
DCA ARG+1
/DIGITAL-8-16-F
/PAGE 5
CLL /ADD IN LAST CONSTANT
TAD C1+1
TAD ARG+1
DCA ARG+1
RAL /CARRY
TAD ARG
TAD C1
DCA ARG
JMS I DMTG
ARG
X
JMS SCAL /PUT SCALING BACK TO ZERO
JMS SCAL /GET RID OF SIGN BIT
JMS ROUND
ARG
JMP I OUT
OUT, XIT1
SCAL, 0 /ROUTINE TO ADJUST SCALING
DCA TEM2
TAD I CTG
CLL RAL
DCA I CTG
TAD I BTG
RAL
DCA I BTG
TAD TEM2
RAL
JMP I SCAL
ROUND, 0
DCA TEM1
TAD I ROUND /ADDRESS OF HIGH ORDER
ISZ ROUND
DCA TEM2
TAD TEM1
DCA I TEM2
TAD TEM2
IAC
DCA TEM1
TAD I BTG
DCA I TEM1
TAD I CTG
SPA CLA /BIT 0=1??
JMP I ROUND /NO; EXIT
ISZ I TEM1 /YES: ROUND
JMP I ROUND
ISZ I TEM2 /CARRY
JMP I ROUND
/DIGITAL-8-16-F
/PAGE 6
/SYMBOLS AND CONSTANTS
X, 0
0
XSQR, 0
0
ARG, 0
0
PNT, 0
CHK, 0
TEM1, 0
TEM2, 0
DMTG, DMUL
BTG, B
CTG, C
FYX, C9
FOUR, -4
TOPI, 2427 /2/PI
6303
C1, 3110
3755
C9, 2367 /C3-C9 STORED IN BACKWARDS ORDER
0000
C7, 3331
7766
C5, 1505
0243
C3, 0420
5325
$
FORTRAN
This is a sample FORTRAN
program that is an interactive calculator. The comment refers to a PDP-5, the first 12-bit machine.
Label
SAMPLE PROGRAM FORTRAN SYM DESK CALCULATOR
Source
1;FORMAT(/,/,/,"THIS IS A DEMONSTRATION OF PDP FORTRAN.",/)
2;FORMAT("THIS PROGRAM WAS COMPILED IN ONE PASS ON A 4-K PDP-5
EQUIPPED WITH AN ASR-33 TELETYPE.",/)
3;FORMAT(/,/,"BY TYPING IN AN INTEGER FROM ONE TO FOUR TO INDICATE
THE FUNCTION, YOU MAY SIMULATE A DESK CALCULATOR.")
4;FORMAT(/,"TO ADD TYPE A 1, TO SUBTRACT TYPE A 2, TO MULTIPLY
TYPE A 3, TO DIVIDE TYPE A 4.",/)
5;FORMAT(/,"OK, TELL ME WHAT TO DO!",/)
6;FORMAT(E,E)
9;FORMAT(I)
100;TYPE 1
200;TYPE 2
300;TYPE 3
400;TYPE 4
500;TYPE 5
;ACCEPT 9,M
;ACCEPT 6,A,B
;GO TO(1000, 2000, 3000, 4000),M
;TYPE 7
;GO TO 500
1000;ANS=A+B
;GO TO 1500
2000;ANS=A-B
;GO TO 1500
3000;ANS=A*B
;GO TO 1500
4000;ANS=A/B
1500;TYPE 8,ANS
;GO TO 500
8;FORMAT("YOUR ANSWER IS ",E,)
7;FORMAT("PARDON MY HESITATION, LET'S TRY AGAIN.",/)
;END