                      
expensive typewriter 10b_ 5/19/64 a


equals flex,flexo
equals char,charac
define	write a
	law a
	jda txp
	terminate


0/	lio char35
	tyo
	jmp fst
	cks
	ril 1s
	spi
	jmp rsr
	ril 2s
	spi i
	jmp exs
	jmp tin
inb,	0

define swap
	rcl 9s
	rcl 9s
	termin

define sense switch

	szs switchx10
	termin
          
                                                                 /et 10a part 1

100/	load con+1,jsp tot
	cbs
	esm
	lio (7235
	tyo
	rir 6s
	tyo
	jmp bet

txt,	lio char34
	tyo
	dzm syl
	dzm lcc
	dzm lnc
	law i 3
	dac chc
	stf 5

repeat 0if vz txt-111,	[printx /
Try again.
You forgot the system tape.

/	start	]

txc,	cla>>05<<cli>>05<<clf 1
	sense 1
	jmp ent
	jsp tot
	jmp txc
	jsp pic
	jmp txc

pic,	dap pix
	cla
char34,	rcr 734
	sad (770000
	jmp crt
	sad (750000
	jmp bks
	stf 5
	skp i
pia,	lac dpt
	lio syl
	rcl 6s
	dio syl
	idx lnc
	isp chc
pix,	jmp .
	dio i b
	idx b
	jmp psx+1

crt,	dzm lnc
	clf 5
	lio syl
	rcl 6s
	idx foo
	idx lcc
	isp chc
	jmp fbw

clt,	dio i b
	lac lcc
	sub qvl
	sma
	jmp qnt
          
                                                                 	idx b
	add (130001
	dac i b
	idx b
	add (-z+100
	sma i
	jmp psx
	xct rel
	dio lsy
	lio char35
	tyo
	write bf1
	text -
The buffer is full.  Reading has been terminated.
To continue you must punch out and kill the buffer.
-
bf1,	jmp apr+2

fbw,	rcl 6s
	jmp clt-2

bks,	dac dpt
	lac pix
	sad (jmp rlt 2
	jmp pia
	szs 30
	jmp pia
	law i 1
	add lnc
	dac lnc
	spa
	jmp ibs
	law i 1
	add chc
	dac chc
	sas (-4
	jmp bkr
	add (3
	dac chc
	law i 1
	add b
	dac b
	lio i b
	jmp bkr+1

bkr,	lio syl
	cla
	rcr 6s
	dio syl
	jmp pix

ibs,	cli
	jmp ent
	tyo

psx,	dzm lnc
	law i 3
	dac chc
	jmp pix

rea,	jsp lcr
	jsp sln
          
                                                                 	law i 1
	add b
	dac b
	add (130000
	dac i lo1
	dzm syl
	law i 3
	dac chc
	lio lsy
	jmp rel+1

rel,	opr
	dio lsy
	rpa-i
	lac fxc
	dac rel
	cla 2
	rcr 7s
	sma i
	jmp rel
	lio (252525
	lac lsy
	sad (277		/check for parity with carr. ret.
	stf 2
	sad (77		/check for carr. ret. without parity
	stf 2
	sad (13
	jmp apr
	add (ril
	dac  .+1
	xx
	spi i
	jmp rer

rlt,	lio lsy
	jsp pic
	szf i 2
	jmp rel
	law z
	sub b
	sal 1s
	sub b
	add (a
	sma i
	jmp buful
	jmp rel

rer,	sense 1
	jmp rlt
	lac lsy
	sza i
	jmp rel
	dio lsy
	dac los
	lac chc
	dac tmp
	lio char34
	tyo
	write re1
	text -
Parity error.	Line=-
          
                                                                 re1,	law 1
	add lcc
	jda dpt
	write re2
	text -	Character=-
re2,	lac los
	jda ocp
	lio (3577
	tyo
	rir 6s
	tyo
	lac (jmp 100
	dac con+1
	cli 2
	lac tmp
	dac chc
	jsp pic
	cla
	jmp rel-2

typ,	jsp lcr
	lac num
	cma
	dac rpc
	load con+1,jmp ty1
	law ty1+1
	dap ty1+1

ty1,	idx .+1
	jmp .
	jmp beg
	jmp rea+1
	jmp prt+1
	lio (13
	tyo
	isp rpc
	jmp ty1-2
	jmp txp-3


ent,	lio (7235
	tyo
	rir 6s
	tyo
	szf i 5
	jmp end
	lio (77
	jsp pic
	stf 5
	jmp end

xyz,	szf 4
	jmp bet
	jmp 102

          
                                                                 
/et 10a part 2

define	dispatch a,b
	sad (b	jmp a	terminate

define	feed a
	law i a	jda fee	terminate

beg,	law a+2
	dac b
	dzm poi
	dzm lcc
	load a, 130000 a+1
	load a+1, 120000
	jmp bet

bes,	lio char35
	tyo
bet,	load mod,tyo
	dzm lo1
	dzm lo2
	dzm sy2
	dzm num
	load sgn,opr
	dzm syl

con,	cla 4007
	jsp tot
	jmp .-1
char35,	rcr 635
	dac chc
	law opt
	dap dsr

dsr,	lac .
	dap dsx
	and (770000
	sad chc

dsx,	jmp .
	idx dsr
	sas (lac ope+1
	jmp dsr
	cla
	lio chc
	rcl 6s
	sad (char r0
	cla
	rcr 4s
	sza i
	jmp evl
	lac (flexo X
	jda tys
	jmp con

tys,	0
	dap tyx
	lio tys
	law i 3
	dac chc
          
                                                                 	cla
	rcl 6s
	dispatch pcr,77

ty2,	isp chc
	jmp tys+5
	law i 3
	dac chc
	cla
	dzm fulflg
	lio tys
	rcl 6s
	dio tys
	lio (252525
	add (ril
	dac .+1
	xx
	sub (ril
	sad (12
	jmp tcr
	spi i
	add (200
	swap
mod,	xx
	isp chc
	jmp ty2+4
tyx,	jmp .

app,	jsp lcr
	jsp sln
	move lnc,foo
	law i 1
	add b
	dac b
	add (130000
	dac i lo1
	jsp ene
	jmp apr+2

apr,	dio lsy
	clf 3
	lac (120000
	dac i b
	idx b
	law i 1
	add foo
	dac num
	szf i 5
	jmp bet
	law bes
	dap dex
	jmp del+2

kll,	jsp lcr
	jmp beg

evl,	lac syl
	sal 2s
	add syl
          
                                                                 	sal 1s
	dac syl
	cla
	rcl 4s
	add syl
	dac syl
	jmp con

pcr,	law 4
	add chc
	cma
	jmp ty2+3

end,	jmp .
ene,	dap end
	jmp txt

prt,	jsp lcr
	clf 4
	lio char34
	tyo
	dzm foo

pr2,	law a
	dap num
	idx foo
prr,	sense 1
	jmp ct
	lio i num
	cla
	rcl 6s
	dispatch nxl,13
	dispatch xyz,12
	lac i num
	jda tys
	idx num
	jmp prr

sln,	dap slx
	dzm lnc
	law a
	dap lo1
	dap lo2
	lio i lo2
	cla
	rcl 6s
	dispatch eln,13
	sad (12
slx,	jmp .
	idx lo2
	jmp sln+5

eln,	move lo2,lo1
	idx lnc
	lac i lo2
	jmp sln+4

nxl,	szs i 20
	jmp err-2
	szf 4
          
                                                                 	jmp err-2
	lac foo
	jda dpt
	lio (36
	tyo
	lac i num
	jmp pr2+1

err,	dap erx
	lio char34
	tyo
	lio (flex ?
	repeat 3,ril 6s	tyo
	lio char35
	tyo
erx,	jmp .

lcr,	dap lcx
	jsp dlm
	jsp tot
	jmp .-1
	swap
	dispatch int,77
	dispatch int,36
	dispatch tcr,40
	jsp err
	jmp lcr+2

int,	move num,poi
lcx,	jmp .

tcr,	jsp err

ct,	lio (77
	tyo
	jmp bes

per,	jsp dlm
	lac poi
	sza i
	law 1
	dac syl
	jsp dlm
	jmp con-3

flf,	law a
	dap lo1
	dap lo2
	jmp flx

fln,	0
	clf 6
	dap flx
	lac fln
	spq
	jmp tcr
	sza i
	jmp flf
	cma
	dac chc
	law a
          
                                                                 
flb,	dap lo1
	dap lo2
	lio i lo2
	cla
	rcl 6s
	dispatch ilc,13
	sad (12
	stf 6
	idx lo2
	szf 6
	jmp qst
	jmp flb+2

ilc,	isp chc
	jmp .+2

flx,	jmp .
	lac i lo2
	jmp flb

qst,	isp chc
	jmp tcr
	jmp flx

chn,	jsp del
	lac sy2
	sza
	dac num
	jmp ins+1

dlt,	jsp del
	jmp bet+2

lin,	jsp lcr
	idx sy2
	sad (1
	add num
	dac sy2
	dac fln
	sub (2
	sad num
	jmp bet
	jsp fln+1

lir,	cla
	sense 1
	jmp ct
	lio i lo1
	rcl 6s
	dispatch lin+1,13
	lac i lo1
	jda tys
	idx lo1
	jmp lir

ins,	jsp lcr
	lac num
	dac foo
	dzm sy2
	jda fln
	move i lo2,lo3
	lac lo3

          
                                                                  	dap .+1
	lac .
	xct .+5
	jmp app+1
	lac lo2
	dap .+1
	lac .
	sad (120000
	jmp tcr
	lac b
	add (130000
	dac i lo2
	jsp ene
	law i 1
	add b
	dac b
	lac lo3
	dac i b
	idx b
	jmp apr+2

del,	dap dex
	jsp lcr
	lac sy2
	sza i
	add num
	jda fln
	move lo2,lo3
	lac num
	sub sy2
	sma i
	jmp tcr
	add sy2
	add (2

de1,	jda fln
	lac lo1
	add (130000
	dac i lo3
	jsp sln
	law i 1
	add lnc
	dac lcc
dex,	jmp .

min,	jsp dlm
	lio (cma
	jmp con-2

cmm,	jsp dlm
	move num,sy2
	jmp con-4

spc,	jsp dlm
	jmp con-3

          
                                                                 
bar,	jsp sln
	jsp dlm
	law i 1
	add lnc
	jmp per+4


tlc,	dap .+3
	lio (72
	tyo
	jmp .

udt,	cla 4007
	jsp tot
	jmp .-1
	rcr 6s
	dac chc
	jsp tlc
	law upt
	dap .+1
usr,	lac .
	dap usx
	and (770000
	sad chc
usx,	jmp .
	idx usr
	sas (lac upd+1	/end of upt
	jmp usr
	jmp tys-3

opl,	law i 1
	add poi
	dac poi
	dac num
	jmp lin+1


buful,	lac fulflg
	sza
	jmp bufulx
	write buful2
	text /
Buffer is almost full.  Please punch out.
/
buful2,	clc
	dac fulflg
bufulx,	jmp rel

          
                                                                 
/typewriter ring buffer routines

tin,	tyi
	dio i tpi
	idx tpi
	sas (100
	jmp exs
	law inb
	dap tpi
exs,	lio 2
	lac 0
	jmp i 1

tot,	dap tox
	lac tpo
	sad tpi
	jmp tox-1
	idx tox
	lio i tpo
	idx tpo
	sas (100
	jmp tox-1
	law inb
	dap tpo
	cla
tox,	jmp .

/reader service

rsr,	rrb
	lac (opr
	dac rel
	jmp exs+1

          
                                                                 pun,	jsp lcr
	load mod,ppa
	cli
	xct mod		/start punch
	stf 4
	jmp prz

sop,	jsp lcr
	sense 1
	jmp bet
	feed 12
	lio (13
	ppa
	feed 100
	jmp bet

fed,	jsp lcr
	lac syl
	and (377
	cma
	jda fee
	jmp bet

dlm,	dap dlx
	lac syl

sgn,	opr
	add num
	dac num

dlx,	jmp .

fee,	0
	dap fex
	cli
	ppa
	isp fee
	jmp .-2

fex,	jmp .

onl,	idx poi
	dac num
	jmp lin+1

qan,	jsp lcr
	stf 3
	lac num
	dac qvl
	jsp sln
	law i 1
	add lnc
	dac lcc
	jmp rea+1
qnt,	szf i 3
	jmp clt+5
	idx b
	add (130001
	dac i b
          
                                                                 	idx b
	jmp apr

equ,	jsp dlm
	jda dpt
	cli
	tyo
	jmp con-3

rep,	jsp lcr
	lac num
	cma
	dac rpc
	load con+1,jmp rp1
	law rp1+1
	dap rp1+1

rp1,	idx .+1
	jmp .
	jmp beg
	jmp rea+1
	jmp pun+1
	jmp sop+1
	isp rpc
	jmp rp1-2
	load con+1,jsp tot
	jmp beg

txp,	0
	dap txu
txu,	lio .
	ril 6s
	tyo
	ril 6s
	tyo
	ril 6s
	tyo
	idx txu
	sub (lio
	sas txp
	jmp txu
	jmp i txp

          
                                                                 
ocp,	0
	dap opx
	law 10
	dac rad
	lac ocp
	jda dpt
	law 10.
	dac rad
opx,	jmp .

dpt,	0
	dap dpx
	dzm dp1
dp4,	lac dpt
	lio (char r-
	spa
	tyo
	spa
dp0,	cma char r0
	dac dpt
dp3,	dac dp2
	mul (1
	div .+1
rad,	10.
	sas dp1
	jmp dp3
	dio dp1
	lac dp1
	sza i
	lio dp0
	tyo
	lac dp2
	sad dpt
dpx,	jmp .
	dac dp1
	jmp dp4
dp1,	0
dp2,	0

prn,	dzm prc
	idx prc
	lio prc
	jsp tot
	jmp .-1
	swap
	sad (char r(
	jmp prn+1
	sas (char r)
	jmp prn+2
	law i 1
	add prc
	dac prc
	sza
	jmp prn+2
	jmp con

          
                                                                 
fst,	lio char35
	tyo
	law inb
	dap tpi
	dap tpo
	rrb
	tyi
	cbs
	esm
	load con+1,jsp tot
	jmp beg

prz,	lac num
	sza i
	jmp pr2-1
	dzm foo
	jmp lin+1

          
                                                                 
hhh,	jsp lcr
	jmp beg

blk,	jsp lcr
	lio char34
	tyo
	hlt
	jmp fst
/utility subprogram


util1,	i 61
	idx util3
	jmp .+4
util,
util4,	lio util1
	mse
	mlc
util5,	mrs
	spi i
	jmp .-2
	ril 1s
	spi
	jmp 7301
	mrd
util3,	dio 7300
	law 7617
	and 7300
	sza
	jmp util5
	idx util1
	law util1+1
	dap .-3
	jmp util4

utili,	lio (7734
	tyo
	rir 6s
	tyo
	lsm
	jmp util

          
                                                                 
psr,	jsp lcr
	load con+1,jmp ps1
	law ps1+1
	dap ps1+1
ps1,	idx ps1+1
	jmp .
	jmp pun+1
	jmp sop+1
	jmp beg
	jmp rea+1
	jmp ps2+2

psk,	jsp lcr
	load psk-2,jmp ps2
	jmp psr+1
ps2,	load psk-2,jmp rea+1
	load con+1,jsp tot
	jmp bet

          
                                                                 
define	oper a,b
	a+bx10000
	terminate

opt,	oper spc,0
	oper con-4,77
	oper con-4,36
	oper bar,char r/
	oper tcr,char r_
	oper qan,char rq
	oper pun,char rp
	oper prt,char rw
	oper ins,char ri
	oper lin,char rl
	oper dlt,char rd
	oper kll,char rk
	oper app,char ra
	oper rea,char rr
	oper fed,char rf
	oper sop,char rs
	oper chn,char rc
	oper equ,char re
	oper rep,char rt
	oper typ,char ry
	oper blk,char rb
	oper hhh,char rh
	oper psk,char rm
	oper psr,char rn
	oper cmm,[char r,]
	oper min,char r-
	oper per,char r.
	oper prn,char r(
	oper con-4,72
	oper udt,74
ope,	oper onl,75

upt,	oper spc,0
	oper con-4,77
	oper con-4,72
	oper con-4,36
	oper utili,char ru
	oper spc,char r-	/+
	oper equ,[char r,]	/=
upd,	oper opl,char r9	/^

foo,	0
qvl,	0	/no. of lines to read
lcc,	0	/inputing to line (lcc
rpc,	0
lsy,	0
tmp,	0
los,	0
num,	0
syl,	0	/decimal no. typed in
sy2,	0
lnc,	0	/char. count within line
poi,	0	/output line pointer
chc,	0
lo1,	0
lo2,	0
lo3,	0
fulflg,	0	/buffer is over 3/4 full
prc,	0
tpi,	inb
tpo,	inb
fxc,	xct .
b,	a+2

          
                                                                 
constants

a,	130000 a+1
	120000

7750/	z,	0

start 0
          
                                                                                                              

