
Autoloader Punch

loc=17702

frontloading

	define
	write A
	tslr wr
	tra A
	term

|Title punch

tit,	feed 20

li,	cal
	lcc
	trn .-1
	add (-1000
	cyr
	trn .-1
	com
	add (add tba-400200
	sto li1
	add (1
	sto li2
	cla
li1,	xx
	trn don
	p6h
	p6o
li2,	xx
	p6h
	p6h
	p6o
	p6s
	tra li

don,	feed 40
	tra pa

|title punch constants

tba,	0	0	0	0
	313113	701007	212112	343443
	0	0	111111	0
	211311	344744	210012	343443
	0	0	001010	0
	212012	303443	021300	322722
	200002	311113	000300	011711
	111112	444443	210213	344307

	0	0	22	11
	311113	344443	313012	703443
	311311	344324	020002	111113
	12	444443	300000	742111
	131111	445564	2	11
	313111	701000	213112	303443
	211112	340043	300	700
	111311	421124	0	0

	300000	711111	0	0
	300213	742007	0	0
	111113	7	0	0
	111132	445562	0	0
	111311	444744	400000	0
	120000	421111	0	0
	311311	344300	0	0
	211112	344525	0	0

	211112	344443	223232	227272
	313113	343443	0	0
	211112	300743	0	0
	211202	344743	0	0
	131111	465544	130000	260000
	120021	421124	0	0
	111220	444231	320000	640000
	211112	344443	333333	777777

|Punch autoloader

pa,	clad (add cks
	tra pr

prl,	clad prg		|read-in mode block
	add (-add
	punch
prg,	xx
	punch
	add prg
	add one
pr,	sto prg
	add (-add-ck+1
	trn prl

	add (trn ent-1
	punch
	sto ckP
	feed 10
	add (llr ck-1
	tra pd

pdl,	xx		|data block
	lcc
	add pdl
	add (-llr-1
	alr+com-opr
	punch
	lac
	add ckP
	sto ckP
	clad pdl
	add one
pd,	sto pdl
	add (-llr-cw
	trn pdl

	clad ckP
	punch
	feed 10

pb,	add (sto ck-1-1	|bugger block
	punch
	add (-sto-ck+1
	punch
	punch
	add (trn cwt
	punch
	add (-trn-cwt
	punch
	add (trn sta
	punch
	feed 40

re,	r3c
	tra r

|Read relocatable blocks

rb,	r3c
s,	xx
	add ckp
	sto ckp
	clad s
	add one
	sto s
	sto cws
	llr FA1
	lac
	add one
	sto fa1
	add LA1
	trn ct

rk,	r3c
	add ckp
	add la1
	com
	trn .-1
	amz
	trn pun

rce,	write rcf
	text |Checksum
|
rcf,	clc
	alr+hlt-opr

r,	r3c
	trn neg
	add (add
	trn neg
	add (slr
	trn rl
rx,	write rsx
	text |Incorrect tape format. Assembly cannot be continued.
|
rsx,	clc
	alr+hlt-opr
	tra .-1

rl,	add (-trn+slr
	sto ckp
	com
	add (slr
	com
	sto fa1
	sto buf
	load s, sto buf+2
	slr cws
	r3c
	sto la1
	sto buf+1

cr,	r3c+cyr-opr
cws,	xx		|sto buf+
	cyl
	add ckp
	sto ckp
	llr fa1
	lcc
	add (-7
	sto CC
	clad s
	add one
	sto s
	sto cws

ct,	lac
	add CC
	trn rb
	tra cr

neg,	sto fa1
	add (add
	com
	trn rx
	feed 40
	clad fa1
	punch
	feed 100
	hlt+cal-opr
	tra tit

pun,	p6s
	add buf
	add buf+1
	cyl
	sto ckp
	p6s
	add (llr buf
	sto pua
	p6s

pua,	xx
	lcc
	add ckp
	sto ckp
	lac
	punch
	add pua
	add one
	sto pua
	com
	add s
	add (llr-sto-1+trn
	trn pua
	clad ckp
	punch
	p6s
	p6s
	tra r

|Write subroutine.

wr,	lac
	add (2
	sto wr1
	add (add 1-llr
	sto wr2

wr1,	xx
	slr wrx
	lcc
	add (tra-add+1
	sto wr1

	cla
wr2,	xx
	type
	step wr2
	add wr1
	trn wr2-1
	cal
wrx,	xx

vari
const

buf,

|New autoloader

|Uses codewords cycled right once, complemented checksum logic

loc|

cks,	0
la,	-cw
one,	1

za,	cyl
z,	sto cw
	r3c+lad-opr
fa,	sto ck-1
	lcd
	add cks
	sto cks
ent,	llr fa
	lac
	add one
	sto fa
	add la
	trn z+1		|set to trn cwt by first block

|End of read-in mode block, execute trn ent.

ck,	llr cks
	r3c+lpd-opr
	trn .+3
	amz
	trn beg
	clc
	alr+hlt-opr

beg,	r3c
	add rel
	sto fa
	trn fa
	r3c
	add mrl
	sto la
	add fa
	sto cks

cwr,	r3c 40
	sto cw
	add cks
	sto cks
	llr fa
	lcc
	add msv
	sto cwc

cbt,	llr cw
	lal+lro-opr
	trn za
	cyl
	llr rel
	trn z
	llr mrl
	tra z

cwt,	lac
	add cwc
	trn cbt
	tra cwr

sta,	llr cwr+1
	tbr 247		|anb, mlr, clc, pad
	slr rel
	sto mrl
	tra beg

msv,	-7
cwc,	0
rel,	0
mrl,	0
cw,	0

start add tit
m