The Initial Input Routine of the Parametron Computer PC-1

Eiiti Wada3

Abstract

Forty years ago, the PC-1, parametron computer 1, was born at Professor Hidetosi Takahasi's Laboratory.
The logical elements of the PC-1 were parametrons, which supported majority logic. The memory system
operated in a two frequency read/write scheme. The word selection mechanism applied error correctingcode to decrease the number of elements. Most of the hardware technologies were created by Eiichi Goto.
We studied the EDSAC computer precisely, however we developed our own architecture and programming
system based upon our own philosophy. The machine instruction set was chosen to ease programming.
The normal teletype on the market was employed, leaving the burden of code conversion tasks to software,
which seemed to us to have had almost in nite abilities.
However, the real memory capacity was indeed very small, which forced us to invent a clever way toimplement things. In this paper, after introducing the functions of the initial input routine R0, examplesof (i) code conversion table parasitic on the program body and (ii) the magic number method to control
the number of multiplications, both used in the initial input routine, are described.
The PC-1 is one of the rst computers which implemented interruption. That is, the peripheral devices
would interrupt the running program by saving the address of the next instruction to be executed andjumping to a xed location in the memory. As a simple experiment of multiple programming, cooperationof the binary to decimal conversion program and the printer control program by means of the circularbu er was performed.
At the end of this paper, the program lists of the selected routines are appended.

0 Introduction
The PC-1 (Parametron Computer 1)[0] was a binary, single-address computer developed at Professor Hidetosi
Takahasi's Laboratory of the Department of Physics, University of Tokyo, and one of the rst general purpose
computers using parametron logic and two frequency magnetic core memory. Its construction was started
in September 1957 and completed on March 26, 1958. The PC-1 closed its operation in May 1964.
The PC-1 was used for research works both in hardware and software at Takahasi's Laboratory and forscienti c computation by the researchers of the Faculty of Science.
The EDSAC computer was the most in uential in designing and implementing in all aspects because, in
those days, [1] was the only available textbook.
The arithmetic and control circuits were made of 4200 parametrons; numbers were 2's complement binary:short number word was 18 bit and long one was 36 bit; instruction word was 18 bit single-address, some 20
di erent instructions; memory: 512 short words; clock was 15 KHz; addition and subtraction 4 clock times,
multiplication 26 clock for short multiplier or 44 clock for long multiplier, division 161 clock, store 8 clock;power consumption: 3kva; oor area: 8 square meters. Input: photoelectric paper tape reader; output:
teletype.
The PC-1 seemed to be the rst computer that installed the interruption mechanism, which enabled us toexperiment with multiple programming in 1959. The research on modular computations referred to in [2]was conducted on this machine.
The present paper reviews the parametron circuits and memory structure in sections 1 and 2, then the
structure of memory and registers in section 3. In section 4, the teletype code used by the PC-1 is givenso that the readers can understand the details of the input/output routines. Section 5 is the summary of
the machine instructions. A few other instructions implemented later for experimental use are not included
here. In section 6, the mechanism of interruption is described brie y. The program used in the multiple
programming is listed in Appendix A. Section 7 sketches the initial input routine R0. A copy of the user's
guide reproduced from the program library and the program list will be found in Appendices B and C. In
section 8, I conclude. Appendices not mentioned above, D and E, are typical examples of the PC-1 input
and output routines.
3 Fujitsu Laboratories Ltd, e-mail: wada@u-tokyo.ac.jp01 Parametron
The parametron was invented by Eiichi Goto, when he was a graduate student, in 1954. It was a resonant
circuit of frequency f energized by a parametric excitation. When the circuit parameter was changed repeatedly with the twice frequency of the resonance, the circuit got energized. With respect to the excitation
frequency of 2f (gray line), the circuit might be energized in one of the two possible phases, 0 and  (brokenlines). (see Figure 0)

Parametron

Figure 0

One of the two phases was considered to represent 0 and the other 1, thus it was possible to represent one
bit of information.
I

II

Figure 1

III

Parametron connection

The parametron had a circuit shown in gure 0 right. All the parametrons were grouped in one of the threesets, I, II and III. Each set was excited in turn and the output of set I was fed to II, II to III, III to I
by connecting through the input transformers (Figure 1). The input signals were oscillation phases of theprevious set and the oscillation of the new set was determined by the majority of input signals (phases). So,
the parametrons realized majority logic (Figure 2). The negation was achieved by reverse coupling.
I

II

Figure 2

Parametron connection for majority logic

Figure 3 shows the typical operations with the possible constant input 0 or 1. (0 is represented as 0, 1 as
+ in the circle. The small cross on the input line indicates the negation.) In Figure 3, the rightmost circuitis the full adder. ([x,y,z] means majority of x, y, z.) One of the interesting circuits was a carry assimilator
which assimilated n digit carries in log2 n clock times.
x
x

x
- x∧y

y

x
+ x∨y

y

x

-

y

-

+ x⊃y

+ x⊕y

y

y
z

Figure 3

Parametron logic

1abs x⊕y⊕zc [x,y,z]

c0
x0
y0
c1
x1
y1
c2
x2
y2
c3
x3
y3
c4
x4
y4
c5
x5
y5
c6
x6
y6
c7
x7
y7

s0

s1

s2

s3

s4

s5

s6

The carry assimilator works as follows: The parametrons in
the gure are subscripted in each horizontal line 0, 1, etc fromthe left. The carry input to the highest full adder, c7, is 0 if
both x6 and y6 are 0 and 1 if both x6 and y6 are 1. If x60
and y60 are 1 then x61 and y61 become to 1 and x62 and y62
also become to 1, thus c63 is 1. In case both x6 and y6 are0, similarly c7 is 0. However, if x6 and y6 are 0 and 1, thentwo inputs to x61 and y61 cancel out and x5 and y5 will havethe casting vote. If x5 and y5 are again 0 and 1, then c6 isdetermined by x4 and y4 at x62 and y62 . In this fashion, carry
inputs c4 to c7 are determined at the third parametron column.
The carry inputs to c2 and c3 are determined at the second
parametron column. Thus, in general, the steps to assimilate
carries are log2 n.
Although not shown in Figure 4, the usual carry paths fromone full adder to the next exist. They are used in the repeatedadditions during multiplication. At the nal stage of multiplication, carries are assimilated using this circuit.

s7
c8

Figure 4

Carry assimilator

2 Memory
Most of the memory technologies of the PC-1 were also invented by Goto. Magnetic core memory of thePC-1 used sinusoidal waves rather than pulses for write/read operation. The core matrix consisted of a 36
2 256 rectangular wire net. In each writing operation, a sinusoidal wave of frequency f=2 was put throughthe selected one of the 256 row wires, and the 36 information bits were applied to the 36 column wires
in the form of the sinusoidal wave of frequency f , where the phase of the latter wave represented each
information bit. The cores on the cross points of both wires were subjected to the magnetizing force of theform I0 cos ft6I1 cos 2ft, and asymmetry of this wave form caused magnetization of the core in one or
the other direction. (Figure 5)
If/2

If(πphase)
If/2
If(0phase)
If/2+If(πphase)
If
If/2+If(0phase)

Memory write in

Figure 5

The reading out signals were obtained from the 2nd harmonic waves from the column wires. (Figure 6)
1 magnetization

If/2

If/2

Vf/2+Vf+..

magnetic field0

Figure 6

Memory read out

The address selection mechanism was based on the error correcting code[3].
2I(y0)

I(y1)Selection logic

Table 0

input
I(y0) I(y1 )
0I 0I
0I
+I
0I +I
+I
+I

I0

I1

I2

I0
02I
0
0
+2I

outputI1
I2
00
02I +2I+2I 02I
0
0

I3
+2I
0
0
02I

I3

Figure 7 Word selector
The transformers shown in Figure 7, when driven by input currents I(y0 ) and I(y1 ) of the same frequency
and the same amplitudes but in either phase, 0 or  , which are indicated by +I and 0I, will produce theoutput current shown in the Table 0. The parametrons will oscillate when driven with full amplitude, butwill not oscillate by weaker current. So, in this case, of the word selection parametrons driven by the output
current, only those that are fed by 62I oscillate, others remaining inactive. Now the di erence between the
maximal amplitude and the next one is only 2I and the discrimination power is not enough. However, byemploying, for example, the 7 bit Hamming error correcting code for 4 input lines, discrimination power is
7I vs 6I, which is enough for the purpose of selection. The PC-1 used 18 bit input lines and excited only
one word selection parametron out of 256.

3 Structure of Memory and Registers
Figure 8 left is the structure of the PC-1 memory. It consists of 512 short words. Like the EDSAC, two shortwords in 2n and 2n + 1 are used as one long word. Instructions are in the short words, but numeric data
may be in 18 bits or 36 bit. The instructions which refer to the long word operand must have even number
address and 1 in l/s bit. Some instructions, however, used the l/s bit for other purposes. Of three arithmetic
registers prepared in the arithmetic unit, the accumulator and the R register were used for programming.
The memory register was used to hold the multiplier and divisor. The contents of the arithmetic register
were assumed to be fractional, i.e. numbers represented are in the range of 01  n < 1.
Storage

Registers

long word
short word
short word
address 0

sign bitaddress 1

accumulator
36 bitsign bit
R register
36 bitfunction partaddress 510

address 511

18 bit18 bitInst. Register
address part18 bit36 bitFigure 8

l/s bit

Storage and registers

4 Teletype CodeThe PC-1 used the normal teletype for input/output without modifying the code. In those days, theteletype code used in Japan was of 6 bits. The lower 5 bits are similar to the 5 bits international teletypecode. Number digits and special characters have 1 in the most signi cant bit. However, since the codes of
the number digits are based on the character codes of the third row of the teletype, the code patterns andthe values of numerical digits were independent. Therefore code conversion tables were needed by input andoutput routines.

3

000000 Blank
000001 t
000010 CR
000011 o
000100 SP
000101 h
000110 n
000111 m
001000 LF
001001 l
001010 r
001011 g
001100 i
001101 p
001110 c
001111 v

Table 1010000 e
010001 z
010010 d
010011 b
010100 s
010101 y
010110 f
010111 x
011000 a
011001 w
011010 j
011011 FGRS
011100 u
011101 q
011110 k
011111 LTRS

Teletype code

100000 Signal
100001 4100010 100011 8
100100100101
100110 ,100111 .
101000 +101001101010 3101011101100 7101101 9101110101111 :

110000 2110001110010110011110100110101 5110110110111 =111000 0111001 1111010111011111100 6111101111110111111 Eraseabcdefghijklmnopqrstuvwxyz 0123456789 +-=,.:
Figure 9

Tape image

5 Machine Instructions
a n, al nb n, bl n
c n, cl n
d n, dl n
i n
jl n
k n
kl n
l n
ll n
n n, nl no np n, pl n
q n, ql nr n
rl n
s n, sl n
t n, tl n
v n, vl n
w n, wl n
x n
z n
zl n

Add the number in storage location n, nL into the accumulator.
Replace the accumulator with the bitwise exclusive or of the numbers in storage location n,nL and the accumulator.
Replace the accumulator with the bitwise logical and of the numbers in storage location n, nL
and the accumulator.
Divide the number in the accumulator and R register by the number in storage location n,nL and place the quotient in the accumulator, remainder in the R register. The remainder isalways positive.
If the tape reader is ready, read a character and place it into a0 !A a5 and clear a6 !A a35; if not
ready, jump to n.
Jump to n.
If the number in the accumulator is <0, jump to n.
If the number in the accumulator is >=0, jump to n.
If n < 1024, shift the accumulator n places to the left; if n >= 1024, shift the accumulator
logically 2048 0 n places to the right.
Same as l n except to shift the accumulator and the R register.
Clear the accumulator and subtract the number in storage location n, nL from the accumulator.
If the teletype is ready, place a0 !A a5 to the teletype; if not ready, jump to n.
Clear the accumulator and add the number in storage location n, nL into the accumulator.
Place the number in the R register and load the R register with the number in storage locationn, nL.
If n < 1024, shift the number in the accumulator n places to the right; if n >= 1024, shift the
number in the accumulator 2048 0 n places to the left.
Same as r n except to shift the accumulator and the R register.
Subtract the number in storage location n, nL from the accumulator.
Store the contents of the accumulator to storage location n, nL.
Multiply the number of the accumulator and the number in storage location n, nL and place
the product in the accumulator and the R register.
Do the same as vn vln and add the original contents of the R register multiplied by 2017 if w
n, 2035 if wl n to the product.
Store a7 !A a17 to the address part of storage location n.
Jump to n if a7 !A a17 is 0.
Jump to n if the content of the accumulator is 0.
4

6 Interruption
From the very beginning, the input/output instructions were designed to have busy jump facilities, by which,when the devices were not ready, instead of waiting for the completion of the operation, the programmer
could choose another path by jumping to that program context. However, one year's experience concluded
that the busy jump facilities were hard to use e ectively.
So in the summer of 1959, another approach was undertaken. That was interruption. i.e., the devices were
designed to interrupt the program whenever their state became ready for use.
The interruption designed at that time worked asfollows:
output code
0. When the device operations completed, theto printerfromconversion
from interrupt
program counter which held the location of thenext instruction was stored in the address partprohibit
1+ exdex
saveof location 510 and control was sent to 511 (lastinterruptofbufferaccumulator
storage location).
1. At the same time, further interruption was proplant link
yes buffer
hibited by setting a ip op, because, otherwise,in 510empty?
the return location would be overwritten by thenosubsequent interruption.
store codeload code
2. The jump instruction in 511 could lead the conto bufferfrom buffer
trol to the interruption process program.
3. At the end of the interruption process pro1+ index
printergram, after resetting the interruption prohibitof buffer
ready? yes
ip op, the program returned to the formernoroutine with the information in 510.
bufferIn the print routine like P2 (Appendix E), digits were
full? yesnoprinted after binary-decimal conversion and code
conversion to the teletype codes. However, one digit
restoreconversion was quicker than one digit printing by theaccumulator
teletype. Accordingly, the output conversion program placed the teletype code in the circular bu er
permitwithout waiting for the completion of the previous
interrupt
printing. Later, when the teletype nished one digit
return via 510
printing, it interrupted a running program, and the
Figure 10 Interruption process programinterruption process program, taking up the control,
started the teletype again with the next code takenfrom the circular bu er.
The program list is shown in Appendix A.

7 The Initial Input Routine R0
R0, the initial input routine of the PC-1, is similar to the initial orders of the EDSAC or the DOI (decimalorder input) of the ILLIAC I, in that the function codes are denoted by the mnemonic code, the address
numbers are denoted by decimal numbers etc. In the microscopic view, there are several di erences.
0. Because of the use of 6 bit teletype code, there were more characters available for programming.
Without shifting to the upper case, we could use all the small alphabetic characters, decimal digits,
and 6 special characters, (comma, period, colon, equal, plus and minus)
1. Instructions and directives were terminated by the special characters, thus it looked more user friendly.
(a) instructions and short numbers were delimited by commas.
(b) directives were delimited by periods.
(c) start addresses of the program segments were indicated by colons.
(d) code letters were de ned by equal signs.
(e) long numbers were delimited by plus or minus characters.
2. Teletype codes for number digits had no relation to the number values, a code conversion table had to
be used and it was allocated in the initial input routine. The address numbers of some instructions of
the initial input routine served as the code table.
3. A digit counter for reading fractional numbers was implemented using the magic numbers, that is theten odd numbered decimal fraction consisted of the most signi cant ten bits.
5

The user's guide of R0 is given in Appendix B. Program code is in Appendix C.
A short example of the usage of the initial routine follows:
0p=116,
fcode letter p is de ned to 116.g
fprint routine stored from 116g
0p: program of print routine: : :tlh, it, jlp,: : :ftlh, a number to be printed is stored in 0hL,
it, loads the address in the accumulator (Wheeler linkage),
jlp, is an unconditional jump to print routineg

7.0 Code Table Hidden in the Program
As aforementioned, the codes of number digits and number values were independent. So, we have to havethe code conversion table somewhere. In the rst version of the initial input routine, ten consecutive shortwords were used to accommodate the code table, just like the character table in the subroutine P2 shown inAppendix E, and each input character had to be compared to determine its numerical value. The conversion
using the table of other direction, i.e. a table from code to numerical value was considered to occupy a larger
area since the smallest code was 031 (4) and the largest 04 (6); the table size could be 28 short words,
which seemed too large for the 512 word computer. So, the accepted solution was to hide (or distribute) thecode table in the program body of the initial input routine. This really worked ne.
Table 2 is a list of digits, the corresponding code and the value of the codes. Each of the values + 56 was
the address where an instruction with the number in its address part had to be stored. The instructions ofthese locations were shown in the last column of the table. The total program is in Appendix C.
Similarly, other terminating characters were treated by assigning the pseudo instructions (in the program of
R0, this is referred to as the base orders) in the appropriate locations. The result are shown in Table 3. The
star marks in the column of content indicate 1 in the sign bit. To obtain the instructions (most of them arejump instructions), the content was added to *nl 12 (instruction in 14 of the initial input routine).
This was possible because the initial input routine was stored in a xed place and the addresses were
unchanged.
Table 2 Conversion table for digits
digit
code
value address content
Table 3 Base orders for special symbols
0111000-8
48
r 0
symbolcode
value address content directive
1
111001-749
l 1,100110-2630*s 45 jl 57
2110000-1640
p 2.
100111-25
31*s 3 jl 153101010-2234
x 3:101111-1739*el 54 x66
4100001
-31
25
jl 4
=
110111-947*nl 12 p 24
5110101
-11
45
kl 5
+
101000-24
32*s 6 jl 186111100-452
jl 6100010-30
26*s 6 jl 187101100
-20
36
rl 7
8
100011-29
27
Space 89101101-1937ll 9

7.1 The Magic Number
In the days of the PC-1, memory was the most crucial resource. One of the techniques used in the input
routine was counting the number of characters by means of the strobe, the magic numbers, in the course ofreading in a fractional number up to 10 decimal digits.
Reading in the fractional numbers, for instance, 0.25, the fractional part was rst read as an integer. So,
0.25 appeared in the accumulator simply as 25. Now, the number of characters already read in was 2.
Accordingly, the content of the accumulator was multiplied by 108 and then divided by 1010 .
When the decimal point was read, the magic number was loaded into the accumulator where the decimal tobinary conversion was performed . (The period was identi ed as the decimal point if the working area wascleared; otherwise, it served as the directive terminator.)
The magic number was 1.193359375 in decimal and 1.001100011 in binary representation. Since all digits
were odd, in the course of multiplication by 10 during the decimal to binary conversion, the sign bit always
remained as 1, i.e. the number seemed negative. And the least signi cant bit of the magic number was being
shifted to the left 1 bit each time. At the same time, the result of decimal to binary conversion creeped up
from the right.
The input of a long fractional number is terminated by + or -. When the input was terminated, the dummy
multiplication by 10 was repeated until the accumulator became positive, which meant the multiplication
by 10 was executed exactly 10 times. (The program list of R1 is in Appendix D.)
In the diagram below, the magic number for 6 digits is shown and the process of multiplication is attached.
6

The 6 digits magic number is calculated like this. Write down the numbers 20 ; 201 ; 202 ; : : : ; 205 . Thensumming up proceeds from the bottom seeing if the result of addition brings the odd digit in the last
position of that number. If the odd digit is produced, add that number; or else skip the addtion of thenumber by crossing it out. This brings up the number 1.59375 as shown below.
The magic number for 10 digits
1.10011 = 1.59375%from lower left

1.0
0.5--0.25---0.125
0.0625------0.03125-------0.015625--------0.0078125
0.00390625
0.001953125 +
1.193359375
1.001100011

The magic number for 6 digits

1.0
0.5
0.25
-------0.125
0.06250.03125 +1.59375
1.10011*1010 (1st)-----------11.0011+ 1100.11-----------1111.1111 = 15.9375
1.1111 = 1.9375*
1010 (2nd)-----------11.111+ 1111.1-----------10011.011 = 19.375
1.011 = 1.375
*
1 010
(3rd)
-----------10.11+ 1011-----------1101.11= 13.75

to upper right%

1.11= 1.75* 10 10(4th)-----------11.1+ 111-----------10001.1= 17.51.1= 1.5* 101 0(5th)-----------11+ 11-----------1111
= 15
1
= 1
* 1010(6th)-----------1+ 1-----------1010
= 10
0
= 0

8 Conclusion
The PC-1 played a remarkable role in the research of computer architecture and program library within ourgroup and helped a lot the research in computational physics and chemistry in the neighbour laboratories.
The preparation of the system programs was quite essential in all activities in and out of the group. In thispaper, some typical techniques used in our system programs were explained.
In retrospect of the research activity of that period of time, the members of the laboratory bene ted verymuch by having our own computer. In these relatively short years, we could learn the whole life cycleof computer development from the hardware elements to the program library. The home made computer
enabled us to make any experiments in hardware or software that came to mind promptly. The scarcenessof computers around us resulted in the original research in this eld.
After the fundamental system programs were prepared, more advanced programming systems had been developed, though I have to say, the PC-1 is too small for such ambitious projects. For instance, introductionof the symbolic addresses in the initial input routine was tried. This idea was implemented by people of thechemical department. They used a list mechanism to remember the unsolved symbols until symbol/location
correspondence is settled. The modular arithmetic system came from the idea of Takahasi. In this implementation, he used wl n operation to obtain the remainder of division by a large prime number. Let A and
R be the contents of the accumulator and the R register respectively and n be the address of the location
which holds h such that 235 0 h is the prime number with which the division of 235A + R will be made. His
method is to repeat the multiplication with wl n until the accumulator becomes zero. One day, a lp op of
the PC-1 was connected to a speaker cone and program could push or pull the cone generating a sound. The
sound pitch was controlled by adjusting the shift number of the shift instruction and the sound duration
was controlled by a busy jump facilities of output instruction. It is easy to implement this sort of program
hacking.
A few years later, the design of the next parametron computer was started. But, for this new machine,
PC-2, the initiatives of construction was in the hands of Fujitsu Ltd., it never gave us a big impact as thePC-1 did. The PC-2 was installed in the common computer room of the Faculty of Science, University ofTokyo and was used for a while by the community.
Every ve years, the members of the group who built the machine and maintained the library meet on March
26 to celebrate the birthday of our lovely PC-1.

7

A The Interruption Process Program
The interruption process program is stored in the location 470511. During the binary to decimal conversion
in the print routine, each time one character code is obtained, instead of output the code directly to theprinter, the code should be placed in the upper 6 bits position of location 470. Then this routine is calledby jumping to 474 using the normal linkage. The code is stored once in a cyclic bu er and then, when theprinter completed the printing action of the previous character and interrupted, the code will be output tothe printer by this program. The cyclic bu er must be speci ed by the preset parameters:
0h = the rst address of the bu er,
0n = the size of the bu er.
Note:
The instructions yl 30 and y 30 sets and resets ip op 30 respectively. This ip op is used to mask theready signals from the teletype. When the signal is not masked, it interrupts immediately; if it is masked,
it waits until the mask is turned o and then interrupts the program.
470
471
472
473
474
475
476
477
478
479
480
486!481
482
483
484
483!485
486
487
488
489
490
511!491
502!492
493
494
507!495
496
497
498
504!499
500
501
502
501!503
504
496!505
506
507
508
509
510
511

(
(

)
)
1
2
yl 30
a 473
x 510
p 470
t ( h)
p 478
a 472
x 478
s 490
z 485
jl 495p 487
jl 481
h
(
)
(
)
n+h
tl 488
p 495
s 478
z 508
p ( h)
o 505
p 495
a 472
x 495
s 490
z 503
jl 492
p 487
jl 499
p 495
s 478
z 495
pl 488y 30
jl ( )
jl 491

Constant
Constant
From code conversion, Prohibit Interruption
gPlant linkg
gWrite the code ingthe cyclic buffer
gAdvancd the input address
gof the cyclic buffer

gReset the address ofgthe cyclic buffer

The first address of the cyclic buffer
gThe location to save thegaccumulator
The last address of the cyclic buffer + 1
Save the accumulatorggJump to 508 if buffer is emptygRead the code to print from the buffer
Print the code if printer is readyggAdvance the output address ofgthe cyclic bufferggggReset the address of thegcyclic buffergIf the buffer is full, jump to 495g

Restore the accumulator
Reset the interruption prohibit
Return to the mail routine
Entrance to the interruption program8

B Instruction for use of the basic input routine R0
B.0 Introduction
The PC-1 is a stored program computer and uses the binary system within the machine for the representationof numbers and addresses. In using the PC-1, the program as well as the numerical data should rst be
stored in the machine's memory, before computation starts. This may be done, for one thing, by preparing
a tape in which all the instructions and numbers are represented in binary form, and reading in this tapeby pressing down the \initial load switch". However, writing down the instructions and numbers in binary
notation is by no means simple.
The basic input routine \R0" enables the instructions and numbers punched on tape in decimal, alphanumeric notation to be read and placed in the PC-1 memory. R0 decodes the teleprinter code of the PC-1
perforator, converts the decimal numbers into binary form, adds the operation codes and places the assembled words in speci ed locations in the memory. When all the instructions and numbers have been stored,
R0 causes the machine to start the program by transferring control to a speci ed word in the memory. R0
provides further facilities of turning the relative addresses on tape into absolute addresses, and adding one
or more parameters to the words before they are stored in the memory. Input routine R0 itself occupies thelocations 067 of the PC-1 memory and is stored there by placing the binary tape of R0 in the tape reader
and pressing down the \initial load switch".

B.1 Basic Functions
Every instruction of the PC-1 is punched in exactly the same form as it is written in the text. That is,operation code consisting of letter, either followed or not followed by a letter \l", and followed by a decimal
integer denoting the address, and terminated by a comma, such as a40, x106, pl150, ... Nonsigni cantzeroes at the head of the address may be omitted, so that one may punch a40 instead of a0040. Sequence of
instructions punched one after another on tape is normally placed in consecutive locations in the memory.
The location of the rst instruction in a sequence must be speci ed by a \directive" in front of the sequence,
which has the form M:, indicating that the sequence should occupy the storage locations M, M+1, M+2, ...
in the memory.
Example: The tape 100: pl150, vl152, sl154, tl156, jl130, causes the memory locations 100  104
to be loaded by the following words.
locatoin instruction contents of the memory100
pl 150001101100010010110
101vl 152001111100010011000
102
sl 154010100100010011010
103
tl 156000001100010011100
104
jl 130011010100010000010
A program tape will consist of one or more sections of such sequences, or subprograms. Blank section ofsome ten centimeters should be left at the head of the program tape, and the program should begin with a\carriage return and line feed" (CR LF), which clears the working positions of R0 prior to reading essential
information.
The complete program should end with a control code jlM. (terminated by a period \."), which stops theoperation of R0 and starts the program by causing the control to be transferred to the location M.
Notes:
1. When the address is 0, this may altogether be omitted, for example, \jl0" may be written
simply as \jl".
2. It is preferable to leave a short blank section in front of each section of the program, and topunch a CR LF at the beginning of each. This serves the purpose of easy identi cation of the subprograms
and also it enables the reloading of some part of the program by manually transferring control to the location0.
3. R0 ignores \blank" symbols.
4. \Erase" symbol is not ignored by R0, so that mispunched characters overpunched by 6 holes
should be removed in the tape-editing stage.

B.2 Input of Intergers
Input of numbers occurs just as the input of instructions, that is, the number is regarded as if it were an
instruction without operation code, or with the operation code \0" (blank tape). Any positive integer N(0N<217 ) can be read in by punching N in decimal notation and terminating by a comma \,".

9

Ex. 150: 12345, causes an integer 12345, or a fraction 1234522017 to be stored in memory
location 150.
Negative integers 0N can be read in by punching an integer 218 0N, where 0<N217 .
Ex. 02 can be read in by punching 262142,.
Long numbers are usually regarded as pairs of short positive integers (N1 , N2 ) in the form
218 N1 +N2 . This is the standard way of reading in the numerical constants in library subroutines.
Note:
For input of numerical data as well as constants in programs specially drawn up by the user, thiswould be quite inconvenient, and a universal input auxiliary routine R1 will be used for reading in signed
long numbers, either integral or fractional. For input of signed, short numbers, R3 may be used instead of R1.

B.3 Relative Addresses
R0 o ers an ample facility of using the preset parameters in the instructions and constants. Namely, any
number of alphabets can be written as code letters in a word, except at the head, in which case it isinterpreted as the operation code. Each code letter causes a number (a parameter), speci ed by a precursor
tape, to be added to the word before it is stored in the memory. Actually, the speci ed parameter values forthese code letters are stored in the storage locations 5787, but in general, the programmer is supposed tohave no knowledge of exact storage locations for individual code letters.
There are several code letters that are reserved for speci c purposes and cannot be assigned arbitrary values
by the programmer. These are:l=2048 (=211 ), used to indicate \long" instructions.
t=tM (M is the current address of the storage location where the word is to be stored).
=Mo : the storage location of the rst wored of the current sequence of instructions. This isr
assigned by the directive Mo :.
\LF" punched as a code letter is an erase symbol and serves the purpose of canceling the characters within
the same word already read from tape. This function of LF is made use of by the CR LF at the head of thetape to insure uniform initial state in the operation of R0.
Setting the values to the code letters is done by a tape of the following form: e.g.
0h=131072, 0m=18, 0a=256, ...

using a new control symbol \=". Another way of setting the code letters is of course by storing these values
by ordinary directives, e.g.
61:131072, 63:18, 80:256, ...

but this is inconvenient since it requires a precise knowledge of memory locations for individual code letters.
Notes:
1. Teleprinter control characters (\space"(SP), \upper case"(UC), \lower case"(LC), \carriage
return"(CR) and \line feed"(LF) are treated by R0 as letters. Hence, these characters punched at the headof a word (that is, next to a terminating symbol) are regarded as ( ctitious) operation codes. These symbols(except LF) punched in positions other than the head of a word is interpreted as code letters, and can inprinciple be used as variable code letters, except CR, the corresponding memory location for which is usedby an instruction in R0. However, using teleprinter control characters as code letters is not recommended.
2. Code letters o and g are set to 28 and 68 respectively, usless otherwise speci ed (see next
section). SP, h, m and n are set to zero by R0 tape.
3. Initial 0 in 0h=131072, only serves the purpose of making the letter h to be interpreted as acode letter, and hence can be replaced by any other letter or teleprinter control symbol.
4. Setting of parameter values using \=" symbol destroys the current store address, in case it isdone between program sections.

B.4 Use of Code Letters
The directive M: sets the code letter r automatically to M, the location of the rst word in the current
sequence of instructions, and hence any word within the same sequence can be referred to by relative
address by use of this code letter, e.g.
jl1r,means jumping to the second instruction in the same section of the program.
The code letter t is actually the instruction to store the assembled word to ultimate place in the memory,and hence its values is always equal to tN, where N is the current destination of the word. Hence this code
letter can be used to refer to the word itself, e.g.
it becomes pM (i+t=p)
gt becomes iM (g+t=i)10

tllt becomes oM (tllt+t=o)where these words are supposed to be placed in location M. Use of code letter t for purposes other than theabove is not recomended.
A standard use of variable code letters is to indicate the location of the rst word in each subroutine, e. g.
instead ofprogram of print routine ,116:
we punch at the head of the complete program tape0p=116: ...

and the subroutine tape begins with
0p:
program of print routine ,so that this closed subroutine can be called in by an instruction pairit, jlp, instead of it, jl116,.
This use of code letters greatly simpli es the use of library subroutines. The code letter o is used to referto the storage location 28 which is used to store the independent variable in some closed subroutines. The
code letter g(= 68) is used to refer to the working spaces of all kinds of program. However, the numericalvalue of either o or g can be modi ed for the programmer's convenience.
Code letters may appear in the directives as well as in instructions. It may also be used in setting of variable
code letters, e.g.
0a=116, 0b=28a, 0c=36b,

is equivalent to 0a=116, 0b=144, 0c=180, and jla. has the same e ect as jl116.

B.5 Special Directives
0t:This sets the r-parameter equal to the current store address.

This causes the following instructions to be stored starting in the storage location speci ed by
the previous directive.

0r:

This causes the following instructions to be stored starting in the N-th storage location of thepreceding section of the program.

Nr:This causes the following instructions to be stored in a new location, skipping N storage locationnext to the preceding program.

Nt:

This sets the parameter h equal to the current store address. (0h=0t, is unacceptablesince the symbol \=" destroys the store instruction.) This combination is placed before a subroutine
having directive 0h:, to place it next to the end of preceding program. (h may be replaced by anyother variable code letter.)

0t:0h=0r,

B.6 Control Code with \."tN. (kN., zN.)

parameter.

Stores the following program starting in the location N, without resetting the r-

Stores the following program in a new location skipping N storage location next to the preceding
program.

Nt.
N.

Stops tape. When the machine is restarted, the following program is stored starting in thelocation N.
Stops tape. When the machine is restarted, the following program is stored skipping N storage
locations.

tNt.
tt.
8.

Special case of tNt. Stops the tape without destroying the current store address.

Stops tape. When the machine is restarted by inital start key, the following program is stored
starting in the current storage locations. (analogous to tt. in e ect.)
Replaces the store instruction by jlN, that is, transfers control to the word at N, leaving
the word following in tape in the accumulator. Successive words will be read one by one and placed in
the accumulator, each time R0 is called in, transferring control to the same word. (This is used when
input of one word is called for during program.)t57.jl,zN.

11

Used to restore the operation part of the store instruction to the original one (t), in case it
has been modi ed (to, say, jl).

t57.

Print the letter X without disturbing the memory. (When more than one letter is
to be printed, it is recommendd to use an interlude. See below.)t57.o56,X,t57.

B.7 Input During Program
Although R0 is primarily designed for the input of the program, it is also suitable for such purposes asreading in numerical values called for by program a few at a time. A slight modi cation on R0 will make it
still more adaptable for such uses.
If R0 is called for by jl40 in a program, the last current store address remains unaltered. If it is called forby jl55, the current contents of the accumulator replace the current store address, so that the word readcan be stored in locations speci ed by the program.
Exit from R0 may be made in the usual way by punching jlN. at the end of the number sequence. However,
it is more convenient to provide for the exit by means of some unused symbol. In case R1 is not used, either\+" or \-" symbol may be used to send control to a location N. This is done by replacing the word in 32 or
26 respectively by a pseudo-instruction (212980+N). CR and LF can also be very conveniently used for theexit from R0. This is e ected by 23:jlN,.
Using the input routine thus modi ed, it is also possible to terminate a number by CR and LF, in which case,the number is left in 0oL (28L) as a long integer.
Note: The original program of R0 sets the machine to dynamic stop on reading + or -.

B.8 Interlude
It is sometimes useful to do some simple operations, such as calculating constants used in the main program,printing table heading, etc. by temporarily placing a short program in the memory and transferring control
to this program, before the main program has been stored. This type of program is called the interlude. At
the end of an interlude, control should be transferred to R0 by, say, jl40, and subsequent program is usually
written over the interlude, so that no extra space need be reserved for it. Following are examples of shortprograms that are often used as interludes.
1. 0t:c49,jl4,jlr.:
This has the e ect of increasing the current store address by one, if it is odd, and hence
may be placed before an even subroutine in order to make sure that the location of the rst
word be even.
2. 0t:s,o1r,l2,o3r,jl6r,jlr.:
This causes carriage return and line feed to occur during input.
3. 0t:ir,zl40,o2r,jlr,jlr.:
This causes the contents of the tape following it to be copied directly by the teleprinter,and may be used to print relevant information concerning the program, e.g. table heading.
Blank tape at the end sends control back to R0.

C The Initial Input Routine R0
Location
38!0
1
2
3
25!4
45!5
52,7!6
7
46!8
9
10
11

Order
al 28
jl 49
0
(
0)
a 64
t 64
i 6
zl 6
rl 12
kl 20
a 33
x 12

Notes
Decimal to binary conversion
Constant
Temporary storage for binary number
Add function
Store function and parameter
Read code, number or symbol
Jump if blank
Shift teletype code to address part
Jump if code letter
Add address base
Assemble load order

12

12
13
14
18!15
16
17
18
19
9!20
21
22
23
24
25
26
27
28
29
30
31
32
33
13!34
35
36
37
38
39
56,23!40
41
42
44!43
44
45
46
47
48
1!49
50
51
52
58!53
54
19!55
56
18!57
58
59
60
61
62
63
64
65
66
67

p ( 0)
kl 34
a 47
t 18
p 29
a 64
(
0)
jl 55
a 33
x 24
s 4
z 40
p ( 0)
jl 4
*s 6
SP 8
(
0)
(
0)
*s 45
*s 3
*s 6
CR 56
x 3
pl 28
rl 7
ll 9
jl 0
*el 54
p 2
tl 28
t 64
i 43
zl 43
kl 5
jl 8
*nl 12
r 0
l 1
al 2
tl 28
jl 6
p 57
a 49
x 57
jl 40
t (67)
jl 53
28
00parity
digit
(
0)
2048
(
0)
68

Load number or base order
Jump if number
Modify base order into switch order
Set switch order
Load address
Add function and parameterswitch order(jl18,jl57,jl15,x66,p24)
Jump to "set transfer order"
Add address base
Assemble load order
Examine whether code letter is LF
Jump to clear order in case of LF
Load parameter(4) Jump to "add function" order(-) Base order for "jl 18" (* means 1 in sign bit)(8) Constant, function part is SP
gWorking space for
gdecimal to binary conversion(,) Base order for "jl 57"(.) Base order for "jl 15"(+) Base order for "jl 18"
Address base, function part is CR(3) Store binary number
(7)
(9)

g
gDecimal to binary conversiong(:) Base order for "x 66"(2) Load 0
Clear working space for conversion
Read function, number or symbol
Jump if blank(5) Jump if function letter(=) Base order for "p 24"
(0)
(1) g
gDecimal to binary conversion(6)gIncrease "transfer order"
Set "transfer order"(Blank) Jump to clear order(t) Transfer order(CR)(o) o-parameter(SP)(h) h-parameter(n) n-parameter(m) m-parameter(LF) Working space for function and parameters(l) l-parameter for long word order(r) r-parameter(g) g-parameter, End of tape
May 1, 1958
E. Wada13

D Read Subroutine R1
R1
Input of Signed Long Integers and Decimal Fractions
Special; even; 28 storage locations (normally 88{115);
used with initial input routine R0.
R1 is used to read in long integers and decimal fractions of either sign into successive long storage locationsin the memory. During the reading in of R1, the initial input routine is slightly modi ed so as to enable
use of the control symbols \+" and \-" during its operation. With this routine, any number less than 235
followed by a \+" will be read as a positive integer, and any number followed by a \-" as a negative integer.
Numbers exceeding this limit will be interpreted modulo 236 . If the number is preceded by a decimal pointwith or without a zero (\0." or \.") and followed by a sign it will be read in as a decimal fraction of thatsign. Any number of digits up to 10 may follow the decimal point. For instance, 201 can be punched .5+ or
0.5+ instead of .5000000000+, but punching more than 10 digits will give incorrect result.
Long numbers and short words may appear mixed on the tape and they are stored successively in theirnatural order on the tape, but the location of long numbers must always be such that they are stored ineven storage locations. Control symbols \+" and \-" cause storage address of the number to be increasedby 2. Hence no extra \," should be placed after long numbers. No code letter nor function symbol can beused with long numbers.
18!0
1
0r!2
3
4
5
18!6
7
18!8
7r!9
10
11
12
13
16r!1415
16
13r!1718
11r!19
20
21
22
23
24
25
26
27

88:
zl 2r
jl 15
p 4r
jl 41
156416
nl 28
p 12r
jl 9r
p 5r
t 23r
p 64
kl 19rpl 28
kl 17r
v 48
ll 5
k 14r
dl 26r
tl 28
p 57
x 24r
a 40
x 57
(
)
tl ( )
jl 40
38146
254976t 26.
212988r
t 31.
212980r
212986r
28r.

g decide whether the symbol just read is a decimal point
gor a control symbol. If the latter, jump to 15

place the "magic number" in 28 and 64(by 41 and 42 of R0)"magic number" 1.193359375
place "pl 28" in 23r on reading "+"place "nl 28" in 23r on reading "-"place " pl 28", "nl 28" in 23r.
gtest whether an integer or a fraction
g by reading C(64)g test whether multiplied
g 10 times
gMultiply by 10 up to ten times
Divide by 1010
Set store order for long number
Increase address of store orderby 2
Becoms "pl 28" or "nl 28" depending on signg Store a long number in ultimate
gstorage location
g1010

g

(-)

jl 8r

(.)
(+)

jl r
jl 6r

E Print Subroutine P2
P2
Print one signed decimal in 0oL (without layout or round o )Closed; Self setting; 36 storage locations;Time is determined by typing speed.
Prints the signed number in 0oL to H places of decimals, leaving R210H in R register where R is the re14

mainder. H is determined by a preset parameter. Each number is preceded by a decimal point and followed
by a sign.
Preset parameter:
0h = H
Number of digits to be printed.
Notes:1. For example, 0 is printed, if H is 10, as.0000000000+

and 00:5 as.5000000000-

01 will be printed as.0000000000-

2. Before P2 is called in, digit position r0 must be cleared.
3. The output tape perforated by P2 less than ten digits may be used as an input tape for use with R1.
In this case, however, no space should be placed between numbers.
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
5r!18
9r!19
20
32r!21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

0p:
a 12r
CR t
x 35r
pl o
rl 35
kl 18r
nl o
rl 35
p 9r
jl 19r139264143360j 2
sg ( )LTRS h155648
f 10r
p 22r
x 33r
p 15r
x 14r
q 22r
v 13r
rl 13
a 17r
x 27r
a ( )
CR t
rl 18
a 14r
z 33r
jl 21ra ( )CR tjl ( )

Print a decimal point
Plant link
gLoad the number ingR register
Test sign
Change sign
Load the number in R registerggg
gTable ofgcharcters
g
g
g
g
g

4200008
4300008
1022-4
Counter
4600008
Base orderStore address to selecta code of sign
Store counter
Shift the number to acc.
gMultiply by 1022-17g

Add base order

gSelect the codegPrint a digit
Store fraction in R register
Subtract 1 from counter
Test countgPrint signg
Link

References[0] H. Takahasi ed: Parametron Computers, Iwanami Shoten, 1968. (in Japanese)[1] M. V. Wilkes, D. J. Wheeler and S. Gill: The Preparation of Programs for an Electronic Digital
Computer. Addison-Wesley Press, Inc. 1951.
[2] D. Knuth: The Art of Computer Programming, vol 2, Seminumerical Algorithms, 3rd ed. p. 291.
[3] H. Takahasi and E. Goto: Application of Error Correcting Codes to Multiway Switching, UNESCO
International Conference on Information Processing (Paris 1959) G 2.9.
15