
BRS Loader II=6-62

	define
	write A
	tsx wr
	A-.-2
	term

rel,	add (-trn
	add rlc
	alr
	lda pci
	trn np

re1,	lda (10
	sto pci
	r3c+lad-opr
	add mrl
	sto wdc
	ldx stk

re3,	add (slr
	slr fa
	sxa rbx
	init bsw, cwt
	com+xro-opr
	sto cks

cwt,	tix tcb

cwr,	r3c+com+lro-opr-opr
	sto cw
	add cks
	sto cks
	ldx (10

tcb,	lda cw
	trn rlz
	cyl
	llr rlc
	trn .+2
	llr mrl
tc1,	cyl
	sto cw

rbk,	r3c+lad-opr
fa,	xx
	lcd+lro-opr
	add cks
	sto cks
	ado fa
	ado wdc
bsw,	trn cwt		|trn cwt or rbk

rck,	r3c+com-opr
	add cks
rbx,	tze .		|r or re2
	write rcf
	text |checksum
|

rcf,	clc
	alr+hlt-opr

r,	r3c
	sto fa
	trn neg
	add (add
	trn hpr
	add (slr
	trn rel
abs,	ldx red
	sxa rbx
	ldx ab1
	sxa bsw
	r3c
	add fa
	sto wdc
	com+lro-opr
	sto cks
ab1,	tra rbk

rlz,	cyl
	tra tc1

re2,	llr fa		|switch
rec,	slr pfa
red,	tra r

np,	ldx syx
	lax 0		|tvn
	ldx tvx
	slx 0
	stx 1
	aux (-2
	sxa tvx
	tra re1

|Program card

pcd,	tac
	trn pcs
	add (add
	trn pcu
	ldx pfa

pce,	sxa rlc
	xcc
	sto mrl

pcb,	llr syx
	r3c
	sto wdc
	add (tra
	ldx pcx		|pct or ste
	tra re3

pcu,	add pfa
pcs,	axr
	tra pce

pct,	ldx fa
	tix .+1
	sxa syx
	clc
	sto pci
	tra r

|Initiation sequence and entries

ent,	tra rs
	tra ini
	ldx slc
	tra .+2
rs,	ldx ptc
	sxa pcx
	tra r

ini,	ldx ltc
	sxa re2
	load tvx, tvt-2
	load syx, syt
	load rlc, 20
	slr pfa
	lcc
	sto mrl
	stz sad
	stz pci
	tra hpr

|Search library tape

st1,	lda pci
	tze pct		|get secondaries

ste,	llr (tze vpr	|principal entry
	lda (tra st2
	tsx sca

	ldx rec		|set to reject pgm
stk,	sxa re2
	init pcx, sts
	stz pci
	tra r

sts,	lda pci		|reject secondaries
	tze r
slc,	tra ste

st2,	ldx syx
	sxa st3
	xcc
ltc,	add fa
	add (-2
	axr

st4,	tix .+1
st3,	lax		|scan symbol table appendix
	lpd
	trn .+2
	tze stg
	tix st4
	tra vpr

stg,	ldx ltc		|set to pick up pgm
	sxa re2
	init pcx, st1
ptc,	tra pct

neg,	add (-add	|start block test
	trn pcd
hpr,	cal+hlt 1-opr

|Diagnostic for missing programs

dia,	llr (tze vpr
	lda (tra di1
	tsx sca
	tra pat

di1,	slr t2
	init scx, di4
	init evx, di3
	write di2
	text |
missing

|
di2,	llr t2
di3,	lac
	tsx mpc
	lda (101001
	pno
vpr,	ldx t
	tra vpe

di4,	clc
dix,	alr+hlt-opr

|Patch

pat,	tbr
	trn sm
	llr (tze vpg
	lda (tra pa1
	tsx sca
	init tvx, tvt
	cal 1

sad,	0
	clc
	tra sad

pa1,	lda dix
	tra vph

|Scan transfer vectors

sca,	sxa scx
	slr evs
	sto evx
	ldx tvx
	sxa sc1
	tra scb

sc1,	ldx		|tvt=origin
	sxa vp
	sxa vp4
sc2,	ldx		|tvt+1=tvn
vpe,	tix vp

scb,	ado sc1
	ado sc1
	sto sc2
	ado sc2
	add (-ldx-tvt-2
	trn sc1
scx,	tra .		|exit

vp,	llx .		|get name
	sxa t

evl,	ldx syx
	aux (-syt
	tra eve

eva,	tix .+1
	lax syt
	lpd
	trn .+2
evs,	tze .		|vpg for patch, vpr for scan
eve,	tix eva
evx,	tra .		|undefined symbol exit

vpg,	lda (tra
	adx syt+1
vph,	ldx t
vp4,	stx .		|store transfer over name
	tra vpe

|Storage map

sm,	write sma
	text |
name	origin	entry

|
sma,	lda (lda syt-2
	sto sm1
	tra smb

sm1,	xx		|lda symbol
	tsx mpc
	lda (100101
	pno
	stz t2
	ldx tvx
	aux (-tvt
	tra smi

sml,	tix .+1
	llx tvt		|origin
sm2,	xx		|lda value
	lcd
	com
	tze .+2
	trn smi
	lda t2
	lcd
	trn smi
	slr t2
smi,	tix sml

	lda t2
	tsx opt
	lda (100101
pt,	pno
sm3,	xx		|lda value
	tsx opt
	pno
smb,	ado sm1
	ado sm1
	sto sm2
	ado sm2
	sto sm3
	add (-lda+trn
	com
	add syx
	trn sm1
	write smw
	text |end=|
smw,	lda pfa
	tsx opt
	pno
	tra dix

|Octal print subroutine

opt,	sxa opx
	load wdc, -5
	alr
	lda opb
opd,	sto ope

opa,	lal
opb,	cyl
	cyl
	llr (-7
	anl 20
	axr
	tze .+3
	lda pt
	sto ope
	lax tb1
ope,	xx		|pnt or cyl
	ado wdc
	tze opc
	trn opa
	lda (101001
opx,	tra .

opc,	lda pt
	tra opd

tb1,	char r0
	char r1
	char r2
	char r3
	char r4
	char r5
	char r6
	char r7

|Write subroutine

wr,	llx 0
	ixl

lp,	ixl
1a,	lax 1
	aux .-1
	pnt
	pnt
	prt+ixl-opr
	tix lp
	ixl
	trx 0

mpc,	sxa mpx
	tze mp1
	type
mpx,	tra .

mp1,	write mp2
	text |main|
mp2,	tra mpx

|Constants and temporaries

tvx,	0
syx,	0
wdc,	trn
rlc,	0
mrl,	0
cw,	0
pci,	0
cks,	0
pcx,	0
pfa,	0
t,	0
t2,	0

constants

tvt|	sad	1

start add ini
