The program was originally written for an IBM 1130 mainframe, on punched cards which I have kept ever since. I initially recreated the Fortran code by reading the statements printed along the top of the cards (not easy, because they were hard to read and there were some misleading character substitutions). Having got something close to the original Fortran in machine-readable form I then translated it to BASIC, which was relatively straightforward.
The program plots Cornu's Spiral, on a pen-plotter back in 1970 or thereabouts but on the screen now of course. I don't claim to understand how it works, although there are evidently some iterative calculations there. I've listed the code below.
Code: Select all
SIZE = 720
VDU 23,22,SIZE;SIZE;16,20,16,0
ORIGIN SIZE,SIZE
GCOL 1
FOR X =-1.0 TO 1.0 STEP 0.1
LINE X*SIZE,-SIZE,X*SIZE,SIZE
NEXT
FOR Y =-1.0 TO 1.0 STEP 0.1
LINE -SIZE,Y*SIZE,SIZE,Y*SIZE
NEXT
GCOL 15
V1=0.001
CIRCLE FILL 0,0,4
FOR J=1 TO 2
K=0
V=0
MOVE 0,0
REPEAT
D=V/100
X2=0
X3=0
Y2=0
Y3=0
X1=1
Y1=0
Z=D
FOR I=1 TO 99 STEP 2
X2=X2+COS(PI*Z*Z/2)
Y2=Y2+SIN(PI*Z*Z/2)
Z=Z+2*D
NEXT
Z=2*D
FOR I=2 TO 98 STEP 2
X3=X3+COS(PI*Z*Z/2)
Y3=Y3+SIN(PI*Z*Z/2)
Z=Z+2*D
NEXT
X4=COS(PI*V*V /2)
Y4=SIN(PI*V*V /2)
X=(D/3)*(X1+X4+4*X2+2*X3)
Y=(D/3)*(Y1+Y4+4*Y2+2*Y3)
DRAW X*SIZE,Y*SIZE
V=V+V1
K=K-1
IF K<-100 THEN
CIRCLE FILL X*SIZE,Y*SIZE,4
K=0
ENDIF
UNTIL ABS(V)>=5
V1=-0.001
NEXT J
ORIGIN 0,0
END