                                                                                        >>37<<vv// />>12<<4>>12<</ >>37<<5552 >>37<<vv// >>37<<248>>37<< 2vvv8  />>37<</  78087 >>37<<vv//       11>>37<<11 12>>34<<21 >>37<<5552 >>37<<vv// >>17<<0>>14<<0>>17<< >>37<<55>>15<<s  />>37<</  11>>37<<11 >>37<<vv// >>37<<55>>15<<s              s>>37<<0  xvvv8       	555	 >>37<<5552 >>37<<55>>15<<s        s>>37<<0  2vvv>>16<<  1z53 >>16<<///>>16<<                                         
expensive typewriter  15 apr 1970

	f=20000

0/	jmp aa
	hlt
	jmp be1

/common storage

b,	f 401	/end of text

dimension foo(1)
dimension rpc(1)	/repeat count
dimension lsy(1),chc(1),lo1(1),lo2(1),lo3(1)

lpp,	60.	/lines printed per page
szp,	66.	/lines per page
syl,	0	/decimal no. typed in
num,	0	/value of expression
sy2,	0	/value preceding comma
poi,	0	/current line no.
guc,	0	/line count of "g"
gul,	0	/upper limit of "g"
prc,	0
bb,	f 400	/begin of current page
nf,	i	/last field assigned (for text)

paf,	0	/punch assigned
lnc,	0
ocp,	0
dpv,	0
csm,	0	/checksum
bc,	56	/break character for searches

/drum pointers

pfa,	0	/initial drum address
pfd,	0	/initial field
pwc,	0	/word count
phf,	0	/final field
pha,	0	/final drum address+1
pfr,	0	/read field
pfw,	0	/write field
dsn,	0	/-word count
                >>13<<x                                
define	move a,b
	lio a
	dio b
	termin

define	feed n
	law i n
	jda fee
	termin

define	init a,b
	law b
	dap a
	termin

define	write a
	jsp txx
	text a
	termin

/set up drum address from AC

pad,	0
	dap pax
	lac pad
	dap pfa
	dip pfd
pax,	jmp .

/read a blob into "a" buffer, returns origin of core area (a)
/in AC, leaves pwc, dsn, and pha set up (see pcc below)
/drum addr given in AC

pam,	0
	dap pay
	lac pam
	jda pad
	sub b	/end of text
	CAI
	law z-a
	AMI>>40<<>
	lia	/word count = min(size of buffer,size of rest of text)
	law a
	jda pcc
pay,	jmp .
                >>13<<>>32<<                                
/drum transfer, core address in AC, write if AC sign on,
/read if off, drum address set up by pad, word count in IO
/(may be 0)
/leaves word count in pwc, -word count in dsn (unless it was 0)
/end of drum area+1 in pha, AC is saved
/assigns more fields if necessary

pcc,	0
	dio pwc
	dap pcx
	lac pwc
	CAA|=
	jmp pcx-1
	dac dsn
	law i 1
	add pad
	add pwc
	dip phf
	dac pha
	idx pha
	lio phf
	lac nf
	AMI>>40<<>
	jsp fad
	lac pfd
	lio pcc
	spi i
	cla
	dac pfw
	xor pfd
	dac pfr
	dzm pc2
	lac pfa
	add pwc
	sub (i
	szm
	jda pc2
pc1,	lac pfw
	add pfa
	lia
	dia
	lac pfr
	add pwc
	sub pc2
	cli+swp-opr
pc3,	add pcc
	dac pam
	dcc
	hlt
	lac pam
	sas pcc
	jmp pc1
pcx-1,	lac pcc
pcx,	jmp .
                >>13<<f                                
pc2,	0
	lac pfw
	sza
	add (i
	lia
	dia
	lac pfr
	sza
	add (i
	add pc2
	lia
	lac (i
	sub pfa
	jmp pc3
                >>13<<                                
?MAIN LOOP

BE"=	LEM	?READ GARBAGE FROM DRUM
	LAW '
	MTA >>04<<>>20<<>>20<<
	NOP
	SZA I
	JMP >>20<<	?FIELD ' NOT ASSIGNED
	LIO [~>>05<<'
	DIA
	LAW A
	LIO [F ~<>>04<<+~>>05<<'
	DCC
	HLT
	LAC A+20	/look for end pointer at 372
	sza i
	lac a	/or get it from 352
	dac b
	and (-177777
	sza
	jmp ntd
	lac a+373-352	/current page
	dac bb
	law i 1
	add b
	and (770000
	dac nf
bee,
bes,	nam
	lem
	jsp t35
bet,	jsp dd
con-5,	dzm sy2
con-4,	dzm num
con-3,	cla
	dap sgn
	dzm syl
con,	clf 7
	dzm rpc
	jsp tot
	law opt-1
dse,	dap dsr
	lai
	rar 6s
	dip ope
	dip ept
	dac chc
	idx dsr
dsr,	lac .
	dap lcx
	and (770000
	sas chc
	jmp dsr-1

lcr,	lac dsr
	sub (lac opn
	sma
	jmp lcx
	jsp dlm
	jsp tot
	sad (40
	jmp rt
	dzm csm
	sas (77
	sad (36
	jmp int
tcr,	jsp t34
	write -?>>40<<-
rrt,	jsp t35
rt,	law 77
	jdp tys
	jmp bet
                >>13<<>>32<<                                
int,	lac num
	dac poi
lcx,	jmp .

ic1,	lai	/used as lai
	sad (char r0
	cla
	dac ocp
	sar 4s
	sza
	jmp tcr
	lac syl
	sal 3s
	add syl
	add ocp
	adm syl
	jmp con

udt,	jsp tot
	lio (72
	sas (72
	tyo
	lia
	law upt-1
	jmp dse

/assorted typewriter routines

tys,	0
	lio (770000
	rcl 6s
	sni i
tym,	tyo
	sas (770000
	jmp tys 2
	jmp i tys

t34,	dac tys
	law 34
	jmp tys 1

t35,	dac tys
	law 35
	jmp tys 1

tot,	dap .+3
	tyi
	lai
	jmp .
                >>13<<>>14<<                                
/dispatch  table

opt,	char lw prt	/print a page
	char li ins	/insert before line N
	char ll lin	/print a line or lines
	char ld dlt	/delete a line or lines
	char lk kll	/kill a page or N pages
	char la app	/append at end of current page
	char lr rea	/append a tape or N pages to buffer
	char lf fed	/feed tape
	char lv sin	/insert stop code before line N
	char ln nex	/move forward N pages
	char lc chn	/change a line or lines
	char lj jfp	/jump to page N
	char lt rep	/punch N pages with stop codes
	char ly typ	/print N pages
	char lb blk	/dismiss
	char lo cop	/combine this page with next
	char lu put	/save a line or lines for g
	char lg get	/insert block saved by u
opn,	char l  spc
	char lx xcp	/dismiss punch
	char lq wle	/change within line
	char lz wlz	/ditto, assuming search
	770000  con-5
	360000  con-5
	720000  con
	char l/ bar	/last line of page
	char l, cmm
	char l- min
	char l. per	/current line
	char l( prn	/comment
	char l>>56<<  ser	/search for string on this page
	char le equ	/print value
	740000  udt
	750000  onl	/print next line
	char l>>40<<  rt	/cancel command
ope,	ic1	/digits
                >>13<<w                                
upt,	char l  spc
	770000  con-4
	360000  con-4
	720000  con
	char l- spc	/+
	char l, equ	/=
	750000  onl	/print next line
	char lk kil	/kill entire buffer
	char l>>40<<  sev	/search entire buffer
	char ll lps	/set page size
	char l9 opl	/print preceding line
	char ln qut	/nightmare
	char lm mm1	/merging assembly
	char lc cc1	/certainly
	char lf fil	/file
	char la eap	/append new page
	char lp pne	/punch everything
	char l0 slp	/number of last page
	char l4 cpn	/number of current page
	char lw wbf	/print everything
	char lt tit	/title punch
	char ls spz	/set page length
	char lb bup	/set search break character
	char l/ but	/type current break character
	char l1 up1	/beginning of string
	char l2 up2	/end of string
	char lx swa	/swap high and low text
ept,	tcr	/illegal
                >>13<<	                                
/partial line numbers

up2,	lio wlq
	jmp pe1

up1,	lio wlp
	jmp pe1

/break character for searches

but,	lac bc
	jdp tys
	jmp rt

bup,	jsp tot
	sas (77
	dac bc
	jmp rt

/equals

equ,	jsp dlm
	jdp dpt
	law 36
	jdp tys
	jmp con-4

dlm,	dap dlx
	lac syl
sgn,	opr
	adm num
dlx,	jmp .

/slash, period, space

bar,	jsp sln
	lio lnc
	jmp pe1

per,	lio poi
	sni
	lio (1
pe1,	jsp dlm
	dio syl
spc,	jsp dlm
	jmp con-3

/minus, comma

min,	jsp dlm
	law 1000
	jmp con-2

cmm,	jsp dlm
	dac sy2
	jmp con-4
                >>13<<s                                
kl1,	sub (1
	dac lo2
	law i 1
	adm lo1
	add (1
	sad (f 400
	dac lo1
	dzm rpc
	jmp kl2

kll,	CAA|=	/command "k"
	law i 1
	dac rpc
	jsp sln
	idx lo2
	sad b
	jmp kl1
kl2,	lac lo1
	dac lo3
	jsp de0
	isp rpc
	jmp kll 2
	spq
	jmp bez

/commands "j","n"

jfp,	lio (f 400
	dio bb
	sub (1
	spq
	jmp bez
nex,	jdp knc
	dac bb
	jmp bez-2

/command "o"

cop,	jdp knc
	law i 1
	add lo2
	dac lo1
	dac lo3
	jsp de0
	isp rpc
	jmp kn1
bez,	dzm poi
	jmp bet

knc,	0
	cma
	dac rpc
kn1,	jsp sln
	idx lo2
	sad b
	jmp tcr
	jmp i knc
                >>13<<7                                
/set highest assigned field to IO 0-5
/low IO clear

fad,	dap fej
	dio >>56<<t1
fe0,	lac t1
	sub nf
	sza i
fej,	jmp .
	spa
	jmp f1e	/dismiss one
	lac (i	/assign one
	add nf
	ral 6s
	mta 300
	nop
	sni
	jmp fea
	lac (i
	jmp fe6

f1e,	lac nf
	ral 6s
	mta 204
	lac (-i
fe6,	adm nf
	jmp fe0

fea,	jsp txx
	text //34/
field >>40<</
	lac t1
	ral 6s
	jdp dpt
	jsp txx
	text .?
.35.	>>40<<.
	tyi
	jmp fe0
                >>13<<u                                
/command "K"

kil,	lac (f 400
	dac lo3
	dac bb
	law i 1
	add b
	dac lo2
	law rt
de0,	dap dex	/delete routine
	jmp de1

/command "d"

dlt,	law bet
del,	dap dex
	jdp ffl
	jda fln
de1,	lac lo2
	sad b
	jmp de2
	jda pam
	lac pha
	dac lo2
	lac lo3
	jda pad
	lio pwc
	lac (add a
	jda pcc
	lac pha
	dac lo3
	jmp de1

de2,	lac lo3
	dac b
	and (170000
	lia
	sub nf
	spa
	jsp fad
dex,	jmp .

ffl,	0
	lac sy2
	sza i
	lac num
	dac poi
	jda fln
	lac lo1
	dac lo3
	lac num
	sub sy2
	spa
	jmp tcr
	lac num
	jmp i ffl
                >>13<<>>17<<                                
/command "g"

get,	jda fln
	lac gul
	sza i
	jmp tcr
	lio guc
	dio foo
gv,	dac los
	stf 5
	jmp in2

/command "u"

put,	jdp ffl
	sub fln
	dac foo
	lac num
	jda fln
	law i a-aa
	add lo2
	sub lo3
	szm
	jmp tcr
	add (a
	dac gul
	idx foo
	dac guc
	lac lo3
	jda pad
	lac lo2
	sub lo3
	lia
	law aa
	jda pcc
	jmp bet

/command "A"

eap,	law 7734
	jdp tys
	jsp flp
	move b,bb
	dzm poi
	stf 4
	jmp in1
                >>13<<.                                
/commands "c","i"

chn,	jsp t34
	jsp del
	jmp ins 1

ins,	jsp t34
	law i 1
	add poi
	jda fln
in1,	move lo2,lo1
	dzm foo
	stf 5
	law aa
	jda los
	jsp tot
	jsp pic
	jmp .-2

/command "v"

sin,	jda fln
	lac (131313
	dac aa
	dzm foo
	law aa 1
	jmp gv

/command "a"

app,	jsp t34
	jsp sln
	idx lnc
	dac poi
	jmp in1

/command "L"

lps,	jsp dlm
	sub mps
	spa
	jmp tcr
	lac num
	dac lpp
	jmp rt

/command "S"

spz,	jsp dlm
	sub mps
	spa
	jmp tcr
	lac num
	dac szp
	jmp rt
                >>13<<>>37<<                                
/pack one character into output

pic,	dap pix
	cla
	rcr 6s
	sad (130000
	jmp psc
	sad (750000
	jmp bks
	dac dpt
pia,	lio dpt
	rir 6s
	law 7700
pim,	xct .
	cma
pid,	and
	dio chc
	ior chc
	dac i pid
	idx pim
	sad (xct pit+3
	jmp pii
pib,	lac dpt
	sad (130000
	jmp pix+1
	sas (770000
pix,	jmp .
	ral 6s
	sas chc
	jmp pia
	lac pad
	dac los
	idx foo
	jmp pix

psc,	lac dpt	/stop code
	sad (770000
	lac (130000
	sad (130000
	jmp pia-1
	lac pix
	dap pyx
	lio (77
	jsp pic	/if last char was not stop code or c.r.
pyx,	law .	/precede this with c.r.
	lio (13
	jmp pic
                >>13<<f                                
pit,	rcl 6s
	nop
	rcr 6s

pii,	law pit
	dap pim
	idx pad
	idx pid
	sas (and a
	jmp pib
	law pib
piw,	dap piy
	szf i 2
	jmp ibi
	lac b
	jda pad
	lac pid
	sub (and aa
	lia
	adm b
	lac (add aa
	dap pid
	jda pcc
piy,	jmp .

bks,	szf i 6	/backspace
	szs 30
	jmp pia-1	/quote it
	law i 1
	adm pim
	sas (xct pit-1
	jmp pix
	lac pad
	sad los
	jmp ibs
	sub (1
	dac pad
	law i 1
	adm pid
	law pit+2
	dap pim
	jmp pix
                >>13<<>>32<<                                
/initialize writer

los,	0
	dap tsx
	law pit
	dap pim
	lac los
	dac pad
	law aa
	dap pid
	dzm gul
	law i 7777
	dac dpt
tsx,	jmp .

ibi,	law i aa
	add los
	jdp inq
	law i aa
	add los
	adm lo1
	law aa
	dac chc
bid,	lac i los
	dac i chc
	idx chc
	idx los
	sas (a
	jmp bid
	lac chc
	dap pid
	dac pad
	law aa
	dac los
	jmp piy
                >>13<<n                                
ibs,	jsp t35
	idx pim
	lio (13
	szf 4
	jsp pic
in2,	law i 1
	add foo
	adm poi
	law i aa
	add los
	sza 5
	jdp inq
	jmp bet

inq,	0
	add b
	dac lo3
	dac lo2
in3,	lac b
	sad lo1
	jmp in4
	sub lo1
	sub (z-a
	spa
	cla
	add lo1
	jda pad
	lac b
	sub pad
	lia
	law a
	jda pcc
	lac pad
	dac b
	lac dsn
	adm lo3
	jda pad
	lio pwc
	lac (add a
	jda pcc
	jmp in3

in4,	jda pad
	law i aa
	add los
	lia
	lac (add aa
	jda pcc
	move lo2,b
	jmp i inq
                >>13<<>>53<<                                
/fetch one character for output

1c,	dap 1cx
	idx 1cs
1ca,	lac .
1cs,	xct .
	and (77
	sas (77
	sad (13
	jda 1ci
1cx,	jmp .

1ci,	0
	dap 1cj
	law 1ct-1
	dap 1cs
	idx 1ca
	isp dsn
	jmp 1cj-1
	lac pha
	jda pam
	dap 1ca
	lac 1ci
1cj,	jmp .

1ct,	ral 6s
	rar 6s
	opr
	jmp .+1
	law 1c+1
	jmp 1ci+1

1su,	0
	dap 1cj
	dzm dsn
	lac 1su
	dac pha
	jmp 1ci+2
                >>13<<k                                
/partial line commands

wlz,	dzm syl
	lac wlp
	dac sy2
	lac wlq
	dac num
wle,	jsp t34
	lac poi
	jda fln
	dzm >>56<<wwc
	lac lo1
	dac lo3
	jda 1su
	law aa
	jda los
	dzm foo
	lac sy2
	sza i
	jmp wld
	cma
	dac rpc
wlw,	jsp 1c
	lia>>05<<stf 6	/to quote backspace
	sad (77
	jmp wlx
	jsp pic
	isp rpc
	jmp wlw
wld,	jsp dlm
	sub sy2
	spq
	jmp wlr
	cma
	dac rpc
	jsp 1c
	sad (77
	idx >>56<<wwc
	isp rpc
	jmp .-4
wlr,	law i 1000
	dac rpc
	jsp tot
	lia>>05<<clf 6	/to let backspaces erase
	sad bc
	jmp wlw
	jsp pic
	jmp wlr 2
                >>13<<a                                wlx,	jsp pic
	jsp t35
	lac poi
	dac num
	add wwc
	jda fln
	lac lo3
	dac lo1
	jsp de0
	law i aa
	add los
	sza
	jdp inq
	dzm sy2
	jsp dd
	jmp con-3

/search routine

sev,	stf 4
ser,	law aa
	jda los
se1,	jsp tot
	jsp pic
	lac dpt
	ral 6s
	sas bc
	jmp se1
	jsp dlm
	sza
	jmp ses
	lac bb
	szf 4
	lac (f 400
sro,	dac bb
	law 1
	dac lnc
	lac bb
srs,	jda 1su
	law i 1
	dac >>56<<wlp
	dzm >>56<<wlq
srr,	law 1a4-1
	dap 1a3 3
	law aa
	dap 1a3 2
	jsp 1a3
                >>13<<d                                
sr1,	sad (77
	jmp sr9
	idx wlp
	jsp 1c
	sad (13
	jmp ssc
	sas >>56<<t2
	jmp sr1
	lac wlp
	dac >>56<<wlq
	lac dsn
	dac ocp
	law i 1000
	dac dsn
	lac 1ca
	dap 1a9
	lac 1cs
	dap 1a9 2
sr2,	idx wlq
	jsp 1a3
	jsp 1c
	sad (13
	jmp ssc
	sad t2
	jmp sr2
1a9,	law .
	dap 1ca
	law .
	dap 1cs
	lac ocp
	dac dsn
	jmp srr

1a3,	dap 1a4-1
	idx . 2
	lac .
	xct .
	and (77
	dac t2
	sad bc
1ax,	jmp 1aw
	sad (77
	jsp 1a5
	jmp .
1a4,	ral 6s
	rar 6s
	nop
	jmp . 1
	law 1a3 1
1a5,	dap 1a6
	idx 1a3 2
	law 1a4-1
	dap 1a3 3
	law 77
1a6,	jmp .
                >>13<<>>34<<                                
1aw,	lac lnc
	dac poi
	dac num
	jmp con-3

ses,	dac lnc
	jda fln
	lac lo1
	jmp srs

ssc,	szs 10
	jmp bet
	lac 1ca
	sub (lac a
	add pad
	sub b
	szf 4
	sma
	jmp mis
	add b
	jmp sro

mis,	write [-missing
>>40<<-]
	jmp bez

sr9,	dzm wlp
	idx lnc
	jmp sr1 3

/backspace, up arrow

opl,	law i 2
	adm poi
onl,	idx poi
	dzm sy2
	dac num

/command "l"

lin,	sza i
	jmp onl
	lac sy2
	sza
	sub num
	sub (1
	dac rpc
	add num
	dac foo
	add (1
	jda fln
	lac lo1
	dac lo3
	jda 1su
lir,	jsp t1l
	isp rpc
	jmp lir
	jmp tyt 2
                >>13<<>>53<<                                
/output one line

t1l,	dap t1x
	szs 20
	szf 3
	jmp t1c
	law 1
	add foo
	jdp dpt
	law 36
	jdp tys
t1c,	szs 10
	jmp rrt
	jsp 1c
	sad (13
	jmp tcr
	szf 3
	jda p1o
	lia
	xct tym
t1r,	sas (77
	jmp t1c
	idx foo
t1x,	jmp .

p1o,	0
	law 6000
	add p1o
	dap p1s
	lio (525
p1s,	sir
	rar 7s
	rcl 7s
	ppa
	law i 277
	A>>05<<IA
	xor (13
	add csm
	and (277
	dac csm
	lac p1o
	jmp t1r
                >>13<<>>76<<                                
ntd,	write [/
no text>>40<</]
	dsm

/command "b"

blk,	jsp t34
	jsp dd
	jsp dp
	dsm

prn,	law 1
	dac prc
	jsp tot
	sub (56
	SA=
	sad (1
	adm prc
	lac prc
	sza
	jmp prn+2
	jmp con

/decimal print

dpt,	0
	dac ocp
	dzm lnc
dpa,	dac dpv
	mul (1
	div .+1
rad,	10.
	sas lnc
	jmp dpa
	sni
	lio (20
	xct tym
	lac dpv
	dac lnc
	lac ocp
	sas lnc
	jmp dpa
	jmp i dpt

/text printer

txx,	dap txu
	lio i txu
	idx txu
	lac (607600
	rcl 6s
	sad ic1	/lai
txu,	jmp .
	sad . 2
	jmp txx 1
	swp
	xct tym
	lia
	jmp txu-3
                >>13<<>>35<<                                
/command "t"

rep,	feed 1
	init pu0,bet
	jmp typ+2

soo,	dap soj
	szf 3
	stf 4
	feed 20
	lio (13
	ppa
	law i 277
	add csm
	ior (100
	lia
	szf i 4
	jmp .+3
	szs i 50
	ppa
	dzm csm
	feed 40
soj,	jmp .

/command P

pne,	feed 1
	szs 60
	jmp pnh
	lac (20400
	jda 1su
	clf 1
pnf,	jsp 1c
	sad (77
	jmp png
	stf 1
	jdp tt1
	jmp pnf
png,	szf i 1
	jmp pnf
pnh,	feed 50
	init pu0,xcp
	jmp wbf 2
                >>13<<n                                /commands W, w, y

wbf,	clc
	jdp tys
	move (f 400,bb
	jsp flp
	lac prc
	dac num		/no. of pages of text
prt,
typ,	szf i 3
	jsp t34
	cla
	sub num
	dac rpc
	lac bb
	jmp pr1

tyn,	lac 1ca
	sub (lac a
	add pad
	sad b
	jmp tcr
	dac bb
pr1,	jda 1su
	dzm foo
pr2,	lac i 1ca
	sad (131313
	jmp prr
	jsp t1l
	mul .+2
	div lpp
	1
	sni i 40
	jmp pr2
	lac i 1ca
	sad (131313
	jmp prr
	jsp pr0
	szf 3
prs,	jsp soo
	jmp pr2+3

prr,	lac rpc
	szf 3
	jmp .+3
	sza i
	jmp tyt
	szs 40
	jmp prl
	szf 3
	jmp prq
	law 13
	jdp tys
	jmp prq+2
                >>13<<9                                
prl,	law 1
	mul foo
	div lpp
mps,	2
	A>>05<<I=
	jsp pr0
prq,	szf 3
	jsp soo
	jsp 1c
	isp rpc
	jmp tyn
tyt,	szf i 3
	jsp t35
	szf 3
pu0,	jmp .
	jmp bet

pr0,	dap pr9		/c.r. for lister mode
	TIIA|=
	lac lpp
	sub szp
	dac chc
pr8,	spa 
	szs 10
pr9,	jmp .
	lio (277
	szf 3
	ppa
	szf i 3
	xct tym
	law i 13
	add csm
	and (277
	dac csm
	idx chc
	jmp pr8

/command "f"

fed,	and (377
	cma
	jda fee
	jmp bet

/tape feed routine

fee,	0
	dap fex
	law 47
	sad paf
	jmp fe1
	arq
	jmp rby
	dac paf
fe1,	cli+13
	ppa
	isp fee
	jmp .-2
fex,	jmp .
                >>13<<0                                
/command "r"

rea,	sub (1
	dac num
	law 51
	arq
	jmp rby
	law i 1
	adm b
	sas (f 400
	idx b
	jda los
	dzm prc
	dzm foo
	stf 2
	stf 6	/to quote backspace
	rpa-i
rel,	lac (740000
	dac lsy
rek,	cks
	ril 1s
	spi
	jmp rei
	isp lsy
	jmp rek
	jmp ren

rei,	rrb
	rpa-i
	dio lsy
rln,	lac lsy
	rar 7s
	szf 4
	jmp rem
	spq
	jmp rel
	law 1000
	add lsy
	dap rp1
	law i 264
	xor lsy
	add csm
	and (277
	dac csm
	law i 5252
	szs i 60
rp1,	rar
	sma
	jmp rpe
                >>13<<>>12<<                                
rlt,	lio lsy
	jsp pic
	lac dpt
	sas (130000
	jmp rel
	stf 4
	dzm foo
	idx prc
	lac num
	spa
	jmp rel
	sub (1
	dac num
	sma
	jmp rel
ren,	lio (13
	lac dpt
	sas (130000
	jsp pic
	law i 51
	arq
	jsp piw
	lac pha
	dac b
	jmp bet

rby,	write [/
busy
>>40<</]	jmp bet
                >>13<<i                                
rpe,	jsp t34
	write [-ilp	page >>40<<-]
	law 1
	add prc
	jdp dpt
	write [-	line >>40<<-]
	law 1
	add foo
	jdp dpt
	law 36
	jdp tys
	law 10
	dac rad
	lac lsy
	jdp dpt
	law 10.
	dac rad
	law 3577
	jdp tys
	cli
	jmp rlt

rem,	lio csm	/look for checksum
	dzm csm
	clf 4
	sma
	jmp rln+4	/no delete bit punched
	law i 100
	and lsy
	szs 60 i
	A~IP|
	jmp rel
	jsp t34
	write [-cksm	page >>40<<-]
	lac prc
	jdp dpt
	law 3577
	jdp tys
	jmp ren+4
                >>13<<7                                
/find line, number in AC. returns with drum address of line
/in lo1, drum addr of next line in lo2, unless ask for line zero,
/in which case both point to line 1

fln,	0
	dap flx
	lac fln
	spa
	jmp tcr	/negative?
	lia
	cma
	dac chc
	lac bb
	dac lo2
	dac lo1
	sni
	jmp flx
fl0,	jda pam
	dap fl4
fl1,	law 77
fl4,	and
	sad (13
	jmp tcr	/ran off end of page
	sad (77
	jmp fl2
fl3,	idx fl4
	isp dsn
	jmp fl1
	lac pha	/get another buffer
	jmp fl0

fl2,	lac lo2	/cr found
	dac lo1	/beginning of this line
	lac pad
	add fl4
	sub (and a-1
	dac lo2	/beginning of next line
	isp chc
	jmp fl3
flx,	jmp .
                >>13<<a                                
/imply sign

cpn,	lio bb
	jsp fpe
	lio prc
	jmp pe1

/find last page

slp,	law cpn 2
flp,	lio b
fpe,	dap fpx
	dio chc
	dzm prc
	law fpi
	dap slx
	lac (f 400
	sas chc
	jmp sl0-1
fpy,	sas b
	idx prc
fpx,	jmp .

fpi,	idx prc
	idx lo2
	sad chc
	jmp fpy
	dac lo1
	jmp sl4

/find end of page
/set lnc = number of lines on page, lo1 = origin of page on drum,
/lo2 = drum address of stop code at end of page

sln,	dap slx
	dzm lnc
	lac bb
	dac lo1
sl0,	jda pam
	dap sl3
sl1,	law 77
sl3,	and
	sad (13
	jmp sl2
	sad (77
	idx lnc
sl4,	idx sl3
	isp dsn
	jmp sl1
	lac pha	/get another hunk
	jmp sl0

sl2,	lac pad
	add sl3
	sub (and a
	dac lo2
slx,	jmp .
                >>13<<>>14<<                                /command "M"
mm1,	ZAP
/command "N"
qut,	law 7776
	lio (620000
	dio num
qut+3,	dap .+2
	lac (dcc
	dac 0
	jsp t34
	jsp dp
	cli>>05<<cla
	dia
	lio num
	jmp i .-6

/command "C"
cc1,	cli>>05<<cmi
	tyo
	lio (150000
	dio num
	law 7776
	jmp qut+3

/command "X"
swa,	law 702
swa+1,	TAAX
	mta 401	/exchange
	nop
	law 101
	A+XA
	sas (1407
	jmp swa+1
	cli>>05<<cmi>>05<<cla
	tyo
	lio (610000
	dio num
	jmp qut+3
                >>13<<.                                
/dismiss

dd,	dap dxd
	law a
	dap .+1
	dzm .
	idx .-1
	sas .+2
	jmp .-3
	dzm a+21
	lac b
	dac a	/352
	dac a+20	/372
	lac bb
	dac a+21	/373
	lio (f 352
	dia
	law a
	lio (22
	dcc
	hlt
dxd,	jmp .

xcp,	law rt
dp,	dap ddx
	dzm paf
	law i 47
	arq
ddx,	jmp .

/command "F"

fil,	jsp dp
	law 16
	mta 204	/clear out old assignment
	jsp dlm
	and (17
	ral 6s
	ior (16
	mta 306
	jmp rby
	law 3477
	jdp tys
	ZAI
	ivk 16
	skp i
	jmp 2
	write [/
not ready/35/
>>40<</]	jmp bet
                >>13<<                                
?TITLE PUNCH

TIT=	LAW >>04<<<
	SAD PAF
	JMP x >>04<<
	ARQ
	JMP RBY
	DAC PAF
	JSP T~>>04<<
TTA=	TYI
	LAI
	SAD [<<
	JMP BET+"
	JDP TT"
	JMP TTA

?TITLE PUNCH SUBROUTINE

TT"=	>>20<<
	DAC TT'
	SAL 'S
	ADM TT'
	LAW I >>05<<
	DAC TT~
TT>>04<<=	IDX TT'
	MUL TT>>05<<
	ADD TT>>06<<
	DAP TT<
	CLA
	RCL 'S
	ADD TT>
	DAP x '
TT<=	LAC x
	XCT x
	AND [<<
	ADD TT>>06<<+"
	SWP
	PPA
	ISP TT~
	JMP TT>>04<<
	LIO TT>>06<<+"
	PPA
	JMP I TT"
                >>13<<A                                
?TITLE PUNCH TABLE

TT>>20<<=	>>20<<	>>20<<		?SPACE
	>>04<<>>04<<<>>06<<>>04<<>>20<<	>>04<<>>04<<>>06<<'	>>05<<'>>05<<'>>04<<>>04<<	?"='
	>>04<<'>>05<<'>>05<<'	>>05<<''>>04<<">>20<<		?~
	">>04<<"'<>>06<<	">>20<<>>05<<>>06<<>>05<<'	>>05<<'>>05<<''>>20<<	?>>04<<=>>05<<
	~>>04<<>>05<<'>>05<<'	>>05<<''>>20<<>>20<<>>20<<		?>>06<<
	'>>06<<'"'	>>06<<'>>04<<>>05<<'	>>05<<'>>05<<''>>04<<	?<=>
	>>20<<>>04<<>>05<<'>>05<<'	>>05<<'~>>04<<>>20<<>>20<<		?^
TT>>>40<<=	x "	RAR "	RAL >>05<<S
	RAR <S	RAR "
	>>20<<	>>20<<	>>20<<
	>>20<<	~>>04<<
	>>04<<'>>04<<'>>04<<'	~>>04<<>>04<<>>20<<'>>20<<	">>20<<>>20<<>>04<<>>20<<'	?>>20<<=?
	>>20<<>>04<<>>05<<'>>05<<'	>>05<<''>>20<<>>20<<'		?S
	'<>>06<<>>20<<'	'~>>06<<>>04<<>>20<<	>>04<<>>20<<>>04<<>>20<<~>>06<<	?T=U
	">>06<<'>>20<<>>04<<>>20<<	'>>20<<">>06<<~>>06<<		?V
	>>04<<>>20<<~>>20<<>>04<<>>20<<	~>>06<<>>04<<''>>04<<	">>20<<'>>04<<>>04<<'	?W=X
	'>>20<<>>04<<<>>20<<	>>04<<>>20<<'>>04<<'		?Y
	>>06<<'>>05<<'>>04<<>>06<<	>>04<<'>>20<<>>20<<>>20<<>>20<<	>>20<<	?Z
	">>04<<">>04<<">>04<<	">>04<<">>04<<>>20<<>>20<<		?=
	0	0	0
	0	0
tt3>>40<<,	0	1010	761010	/>>40<< (punches +)
	204040	360076		/j
	101024	427640	404040	/k,l
	760410	47676		/m
	41020	763442	424234	/n,o
	761212	120434		/p
	424222	547612	123244	/q,r
tt5>>40<<,	125252	100
tt6>>40<<,	tt0	1010	101010	/-
	42	340000		/)
	7600	34	420000	/| ,(
tt2>>40<<,	0	74
	121212	747652	525224	/a,b
	344242	422476		/c
	424242	347652	524242	/d,e
	761212	20234		/f
	424252	727610	101076	/g,h
	4276	420000		/i
	0	60	600000	/.
	0	0

variables
constants

	z=7700
aa,	a=aa+1000	aaa=aa+400
                >>13<<r                                
/bits of e.t.

aa,	lem
	lio (f
	jsp fad
	lio bb
	dia
	law (131313
	lio (1
	dcc
	hlt
	law bee
	dap 0
	jmp bee

constants

start 0
                >>13<<                                
/window
offset 0

tot 1/	jmp ew

7100/	131313
	131313
7140/
ew,	szs 50
	jmp df
	lac bb
	dip pfd
	dap pfa
	lio (600
	law 6300
	jda pcc
	law 13
	lio poi
	AMII<
	AMIA
	add (add-25
	dac >>56<<gc
	lxr (6300-1
	iam
	jmp ddt

di,	SXX
	law 77
	and i 0
	sad (13
	jmp dr-3
	sad (77
ddt,	SII>
	jmp di
	TXA
	dap dr
	nam
dr,	law .
	dap ddp
	law cd9
	dac cds
	lac (add-25
	dac >>56<<crc
	lac (300000
	dac cdy
dj,	lac (500000
	dac cdx
	isp crc
	jmp dr
	sas gc
	jmp de 1
	law 14
de,	jdp cd
	idx ddp
	szs 50
	jmp df
                >>13<<
                                
	cks
	ril 3s
	spi
	jmp df
ddp,	lac .
	ral 6s
	jdp cd
	xct ddp
	rar 6s
	jdp cd
	xct ddp
	jmp de

df,	tyi
	clf 3
	jmp tot 2

cdc,	ZAP
	law 200
	add dr 2
	dac cds
	jmp i cd

cds,	cd9
cdx,	500000
cdy,	300000

c9d,	sas (add
	jmp c8d
	idx cd4-1
	dap . 1
	jmp .

c8d,	law 3000
	dap cd6 2
	cma
	adm cdy
	xct cd4-1
	jmp cd1

cd8,	lac (-14000
	adm cdy
	jmp dj
                >>13<<6                                
/character display

cd,	0
	and (77
	sal 1
	add cds
	dap cd4-1
	cla
	dap cd6 2
	law cd5-1
	dap cd4
	xct cd4-1
	spa
	jmp c9d
cd1,	and (376000
	TAXA
	lio cdy
cd2,	A+XX<
	jmp cd3
	lac cdx
	dpy-i 200
cd3,	law 1000
	A+II
	lac (376000
	A>>06<<XXA=
	jmp cd2
	law 1000
	adm cdx
	idx cd4
	lac .
cd4,	xct .
	jmp cd1
	idx cd4-1
	xct cd4-1
	rcr 4s
	jmp cd1

cd5,	ral 7s
	TAI|
	ral 3s
	rar 8s
	jmp cd6

cd6,	law 2000
	adm cdx
	law .
	adm cdy
	jmp i cd

cd7,	lac (77777
	ior cdx
	SAA
	dac cdx
	jmp i cd
                >>13<<0                                
cd9,	0	0	/space
	27	740000	/1
	305214	462306	/2
	105014	462266	/3
	36100	437610	/4
	137114	462261	/5
	175114	462262	/6
	3610	441203	/7
	155114	462266	/8
	15114	452236	/9
	add	jmp i cd
	add	jmp dr	/stop
	51253	305010	/pointer
	add	jmp i cd
	add	jmp i cd
	add	jmp i cd

	175014	60276	/0
	100200	401002	//
	221245	211000	/s
	10764	211000	/t
	171004	37000	/u
	70404	10034	/v
	171003	20074	/w
	210501	12104	/x
	417104	417600	/y
	211445	223104	/z
	add	jmp i cd
	500200	0	/,
	add	jmp i cd
	add	jmp i cd
	add	jmp cd7	/tab
	add	jmp i cd
                >>13<<>>14<<                                
	0	400000	/>>40<<
	501004	217200	/j
	376202	421000	/k
	1774	0	/l
	370047	401170	/m
	370040	236000	/n
	161044	216000	/o
	776110	441400	/p
	414110	477640	/q
	370040	202000	/r
	add	jmp i cd
	add	jmp i cd
	20100	402010	/-
	1012	107000	/)
	2010	40201	/>>56<<
	342	120200	/(

	add	jmp i cd
	161044	237100	/a
	377104	414000	/b
	161044	212000	/c
	161044	237600	/d
	161245	226000	/e
	21760	440400	/f
	415114	457600	/g
	376100	434000	/h
	7	500000	/i
	add	jmp cdc
	4	0	/.
	add	jmp cdc 1
	add	jmp i cd
	add	jmp i cd
	add	jmp cd8
                >>13<<>>40<<                                
	0	0	/space
	30	600	/"
	0	140000	/'
	4010	40401	/~
	104422	110434	/>>04<<
	70402	10034	/>>05<<
	70020	100434	/>>06<<
	20242	120200	/<
	1012	105010	/>
	10027	740404	/^
	add	jmp i cd
	add	jmp dr	/stop
	51253	305010	/pointer
	add	jmp i cd
	add	jmp i cd
	add	jmp i cd

	20102	507010	/>>20<<
	4015	42206	/?
	115114	462262	/S
	2017	740201	/T
	177004	20077	/U
	76404	10037	/V
	177003	20077	/W
	306240	405143	/X
	6047	401003	/Y
	303214	461303	/Z
	add	jmp i cd
	50241	205024	/=
	add	jmp i cd
	add	jmp i cd
	add	jmp cd7	/tab
	add	jmp i cd
                >>13<<r                                
	601004	20100	/>>40<<
	101004	20077	/J
	376101	210501	/K
	377004	20100	/L
	376020	200577	/M
	376040	404177	/N
	175014	60276	/O
	376110	442206	/P
	175015	50336	/Q
	376111	452306	/R
	add	jmp i cd
	add	jmp i cd
	20103	702010	/+
	1014	77600	/]
	7	740000	/|
	1774	60200	/[

	add	jmp i cd
	370221	44574	/A
	377114	462266	/B
	175014	60242	/C
	377014	60276	/D
	377114	462301	/E
	376110	442201	/F
	175015	64262	/G
	376100	402177	/H
	1017	760200	/I
	add	jmp cdc
	104240	405042	/x
	add	jmp cdc 1
	add	jmp i cd
	add	jmp i cd
	add	jmp cd8
                >>13<<>>16<<                                                                                                   
