|convert decimal fraction to binary

	zz=.

	define
	setdfc
	llr (tra .+2
	tra zz
	term

	define
	condfr
	llr (tra .+2
	tra zz+11
	terminate

zz,	slr zz+10
	llr (add zz+51
	slr zz+11+6
	llr (add zz+51+10
	slr zz+11+12
	cla
	sto zz+47
	sto zz+50
	hlt		|exit from set up

zz+11,	slr zz+43
	amz
	trn zz+27
	add (-1
	alo		|count
	add zz+47
	hlt		|add 10exp(-k), bits 0-17
	sto zz+47
	cla
	add zz+50
	hlt		|add 10exp(-k), bits 18-27
	sto zz+50
	lac		|pick up digit-k
	tra zz+12

zz+27,	cla
	add zz+11+6	|set to pick up 10exp(-k-1)
	add (1
	sto zz+11+6
	add (10
	sto zz+11+12	|set to pick up least significant
	cla
	add zz+50
	add (400000
	cll
	add zz+47	|form partial conversion
	trn .+2		|no. greater than 377777
zz+43,	hlt		|exit with partial conversion in AC
	cla
	add (377777
	tra .-3		|if overflow set no to 1-2_17

|data and storage

zz+47,	0	|most significant part of conversion
zz+50,	0	|least sign. part
zz+51,	31463	|10_1 - most significant part
	2436	|10_2
	203	|10_3
	15	|10_4
	1	|10_5
	0
	0
	0

zz+61,	314000	|10_1 - least significant part
	560000	|10_2
	044000	|10_3
	066000	|10_4
	237000	|10_5
	103000	|10_6
	0
	0	|buffers if more than 6 digits are given

|END OF DECIMAL FRACTION TO BINARY SUBROUTINE

|convert decimal integer to binary

	define
	condci
	llr (tra .+2
	tra zz+71
	term

zz+71,	slr .+11
	alo
	add zz+47
	cyl
	cyl
	add zz+47
	cyl
	lad
	sto zz+47
	hlt		|exit with partial conversion in AC

|END DEC INTEGER CONVERSION SUB

|convert octal no. to binary

	define
	convoc
	llr (tra .+2
	tra zz+103
	terminate

zz+103,
	slr .+10
	alo
	add zz+47
	cyl
	cyl
	cyl
	lad
	sto zz+47
	hlt		|exit with part. conv. in AC

|END OCTAL CONV SUB

start 0

|FOLLOW THE PEN
|IS-01

zz=.

define	findpen S
	cla
	add (tra S
	llr (tra .+2
	tra zz+1		terminate

define	follow
	tra zz+13	terminate

|SUBROUTINE
zz,	0		| xy coordinate
	slr zz+73
	sto zz+75
	lro+pen-opr		| display random points until one is seen
	lac	llr (355670	opr 612	dso 200	pen 40	trn .-5
	slr zz
zz+13,	llr zz
	lac	add (2	dso 200	pen	trn .-4	| find +y extreme.
	slr tt
	llr zz
	lac	add (-2	dso 200	pen	trn .-4	| find -y extreme.
zz+30,	lac
	add tt
	com+cyr-opr	| find -(y correction).
	add zz		|
	com+shr-opr
	sto tt
	llr zz
	lac	add (2000	dso 200	pen	trn .-4	| find +x extr.
	slr tt+1
	llr zz
	lac	add (-2000	dso 200	pen	trn .-4	| find -x extr.
	lac
	add tt+1
	com+cyr-opr	| find -(x corection)
	add zz		|
	alr
	shr
	lpd		| deposit sign bits in right AC
	clr 62		| and complement.
	add tt
	cyl
	add zz		| add total correction.
	sto zz
	dso 200
	pen		| sense whether new point is seen.
	trn .+3		|
	cla
zz+73,	0		| null exit.
	lac
zz+75,	0		| normal exit.
start
define
	grid NX,NY

	NX=NX+NX+NX+NX
	NX=NX+NX+NX+NX
	NX=NX+NX+NX+NX
	MX=NX+NX+NX+NX
	NX=MX+MX

	llr (777000
	lac
	add (401376
	add (-400377
	dis+com-opr
	dis+lpd-opr
	dis+com-opr
	dis+lpd-opr
	add (-NX
	trn .-5
	cll+lpd-opr
	add (-NY
	add (400377
	trn .-12
	terminate

