Subject: Some focal code

From: [email-masked] (Douglas W. Jones,201H MLH,3193350740,3193382879)
Date: 16 Feb 1994 21:08:02 GMT

I was debugging the X-windows interface to my emulator, and I needed to
make the thing burn cpu cycles while I tested the front panel behavior,
so I wrote a little FOCAL program.  It's a nice demo because it plots a
curve on the output, using the classic TTY approach to curve plotting,
and because anything that plots a curve that looks almost sinusoidal
looks very technical, even if it isn't.  Here's the code:

*WRITE ALL
C-FOCAL,1969

01.01 SET I=0
01.02 SET J=0.1
01.03 SET K=J-(I/10)
01.04 DO 2
01.05 SET I=I+J
01.06 SET J=K
01.07 GOTO 01.03

02.01 TYPE I,J," "
02.02 SET X=25+(10*I)
02.03 IF (-X) 02.04; SET X=0
02.04 IF (X-50) 02.05; SET X=50
02.05 IF (X) 02.09
02.06 TYPE " "
02.07 SET X=X-1
02.08 GOTO 02.05
02.09 TYPE "X",!

Block 1 is the main program.  Block 2 is the subroutine to do the
output and curve plotting.  It's not fast, but that just makes it look
like it's really computing something interesting.

					Doug Jones
					[email-masked]

---

From: [email-masked] (Charles Lasner)
Date: 17 Feb 1994 02:16:56 GMT

In article <[email-masked]>,
Douglas W. Jones,201H MLH,3193350740,3193382879 <[email-masked]> wrote:
<
<*WRITE ALL
<C-FOCAL,1969
<
<01.01 SET I=0
<01.02 SET J=0.1
<01.03 SET K=J-(I/10)
<01.04 DO 2
<01.05 SET I=I+J
<01.06 SET J=K
<01.07 GOTO 01.03
<
<02.01 TYPE I,J," "
<02.02 SET X=25+(10*I)
<02.03 IF (-X) 02.04; SET X=0
<02.04 IF (X-50) 02.05; SET X=50
<02.05 IF (X) 02.09
<02.06 TYPE " "
<02.07 SET X=X-1
<02.08 GOTO 02.05
<02.09 TYPE "X",!
<
<
<Block 1 is the main program.  Block 2 is the subroutine to do the
<output and curve plotting.  It's not fast, but that just makes it look
<like it's really computing something interesting.

If you remove all the long commands and replace them with the one-letter 
form, it'll run significantly faster.  (Focal, 1969 is a brute-force 
interpreter.)

cjl