
Macro-flit 6-18-62=part 1

	ncn=4


	|macro-flit definitions

	define	clad A
		lda A
		terminate

	define	load A,B

		llr (B
		slr A
		terminate


	define	call A

		llr (tra .+2
		tra A
		terminate

	define	subr A,T

		llr (tra T
		tra A
		terminate

	define	type

		pnt
		pnt
		pna
		terminate

	define	print A

		add (A
		type
		terminate


	xx=hlt	npi=11	nmi=44	nds=24	nsy=144


14000|	tra flt

14006|		ep1=.
		ep2=ep1+1
		alh=ep2+1
		rsq=alh+1
		rs1=rsq+1
		opt=rs1+1
		rcm=opt+1
		rsl=rcm+2
		flt=rsl+1

6000|		mil,	|Macro-instruction and symbol storage
	mil+1416| low,	|Symbol table end
	low+1|	mai,	|Macro-instruction index
	mai+nsy+nsy+1| dsm,-char lr	|Dummy symbols
	dsm+nds|dsp,	|M-I parameter values
	dsp+nds|dsv,	|M-I argument values
	dsv+nds|dss, 1	|Argument translation indicators
	dss+nds|cor,	|List of constant origins
	cor+ncn+ncn+1| loc,	|Current location
	loc+1|	psi,	|Psuedo-instruction list
	psi+nmi+nmi+nmi+1|	tva,
10242|	tv,
	tra rm
	tra np2
	tra ps2
	tra aly
	tra alm
	tra evs
	tra rm3

dfs,	sto sym
	slr t3
	load rst, tra dfj
	tra q1+4

dfj,	load rst, cla
	tra rsl

evs,	slr esx
	sto sym
	load sgn, opr
	cla
	sto wrd
	add one
	sto def
	load ex, tra exx
	tra e2

exx,	llr wrd
	add def
esx,	xx

|Reset to convert next word

rnw,	cla
	sto wrd
	sto syl
	sto nsm
	sto amn
	sto asa
	clc
	sto cni
	sto dsi
	sto dsn
	add one
	sto def

sp,	cla
	add (opr
	sto sgn
	sto sga
	cla
	sto let
	sto liu
	sto num
	sto sym
	sto chc

|Read and condense one character

r,	call rch

cfc,	lal
	ala
	add (666660
	cry
	ala
	add (666660
	cry
	ala
	add (666740
	cry
	ala
	add (666000
	cry
	ala
	add (666000
	cry
	cll
	add (tra dtb

|Dispatch on character value

	sto rt
	clc
rt,	xx

|Character dispatch table

dtb,	trn i	|blank tape
	trn i	|not used
	trn l	|e
	trn n-8	|8
	trn i	|not used
bt,	xx	||
	trn l	|a
	trn n-3	|3
	trn p	|space
qt,	xx	|=
	trn l	|s
	trn n-4	|4
	trn l	|i
	trn p	|+
	trn l	|u
	trn n-2	|2
	trn r	|color
	trn d	|.
	trn l	|d
	trn n-5	|5
	trn l 	|r
	trn n-1	|1
	trn l	|j
	trn n-7	|7
	trn l	|n
	trn ca	|,
	trn l	|f
	trn n-6	|6
	trn l	|c
	trn m	|-
	trn l	|k
	trn i	|not used


	trn l	|t
	trn i	|nu
	trn l	|z
kt,	trn i	|backspace
	trn l	|l
tt,	xx	|tab
	trn l	|w
	trn i	|nu
	trn l	|h
	trn tt	|carriage ret.
	trn l	|y
	trn i	|nu
	trn l	|p
	trn i	|nu
	trn l	|q
	trn i	|nu
	trn l	|o
	trn r	|stop
	trn l	|b
	trn i	|nu
	trn l	|g
	trn i	|nu
	trn n-9	|9
	trn i	|nu
	trn l	|m
	trn rcu	|upper case
	trn l	|x
	trn i	|nu
	trn l	|v
	trn rcl	|lower case
	trn n	|0
rdt,	trn r	|nullify

rcu,	add one

rcl,	sto cas
	tra r

|Storage word termination characters (tab and carr ret)

tab,	add syl
	add chc
sv,	trn rnw
	call evl
	add pss
	trn tb3
	clad def
	trn ust

tb3,	clad aml
	add one
	sto aml

tb4,	llr loc
	lcc
	sto ts
	add one
	com
	sto loc
	cla
	add pss
	trn bs
	lac
	add fwd
	trn ptl

tb2,	clad wrd

ts,	xx
	tra bs-1

|Location assignment termination character

b1,	add def
	com
	trn bnp

b2,	llr (400000
	tra b3

b,	add syl
	add chc
	trn itt
	call evl
	add nsm
	com
	sto asi
	trn ba1
	add asa
	sto asm
	llr amn
	slr aml

ba1,	clad pss
	trn b1
	clad def
	trn usb

|Form origin for next block
hbnp,	llr wrd
	lcc
	amz
	com
	llr (17777
	anl

b3,	lcc
	sto loc
	clc
bs,	xx


ptl,	slr loc
	clad (flex ipl
	subr alm, alh

rch,	slr rcx
	call rcm
	slr fwd
	alr
	sto t
rcx,	xx
tSyllable separation characters (plus, minus, space)

p,	add chc
	add syl
	trn r
	cla
m,	sto t2
	call evl
	add one
	sto syl
	llr t2
	lcc
	trn sp
	add em
	tra sp+2

|Evaluate syllable and accumulate word value

evl,	slr ex
	clad mii
	trn wsp

ev2,	clad let
	trn el
	add num

sga,	xx
	add amn
	sto amn

en,	clad num
sgn,	xx
	add wrd
	sto wrd
	clc
ex,	xx

ndf,	sto def
	llr sym
	slr r2
	tra ex

el,	add sgn
	add (-opr
	com
	trn el1
	add nsm
	trn el2
	amz
	com
	trn e2
	add sym
	sto asa
	clc
	tra el3

el1,	cla
el2,	add one
el3,	sto nsm


|Evaluate symbol (logarithmic search)

e2,	load t1, 4000
	cla

e5,	add low
	sto ea
	sto ea1

e,	clad sym
	trn esm
	cla
ea,	xx
	trn et
	tra eup

esm,	cla
ea1,	xx
	trn edn
et,	add sym
	trn eqt

eup,	load e1, tra e1+1
	clad t1
	cyr
	sto t1
	add mon
	trn ndf
	add one

e1,	xx
	add ea
	sto ea
	sto ea1
em,	com
	add low
	com
	trn eup
	add low
	add (-add-low+1
	trn e

edn,	llr (com
	tra eup+1

eqt,	add one
	trn edn
	add ea
	sto e4
	cla

e4,	xx
	sto num
	tra en


|Relative address syllable (.)

rl,	add chc
	trn rl1
	llr (opr
	tra rl2

rl1,	llr sgn
rl2,	slr rl3
	llr loc
	lcc

rl3,	xx
	add wrd
	sto wrd
	llr one
	slr syl
	llr mii
	lcc
	trn r
	add rl3
	add (-opr
	trn rl4
	add (400000-40

rl4,	add one
	subr prs, r

|Process alphabetic or numeric character

l,	sto let
	add cas
	trn ln
	clc
	sto liu
	tra ln

l2,	clad sym
	cyr
	add t
	sto sym
	tra r

n-9,	add mon
	add mon
	add mon
	add mon
	add mon
	add mon
	add mon
	add mon
	add mon
n,	com
	ala

n2,	add num
	cyl
	sto num
	cyl
	cyl
n1,	xx
	lad
	sto num
	cla

ln,	add chc
	add one
	sto chc
	add (-3
	trn l2
	llr let
	lcc
	trn r
	sto num
	sto let
	sto chc
	add one
	sto syl
	llr sym
	slr api

|Read three more characters for P-I or M-I

	llr t
	slr syn
	load t1, 2
	subr rch, ln1

ln4,	add one
	trn ln3
	tra rch+1

ln1,	cyr
	add (775777
	trn ln2
	add (777575
	trn ln2
	add (762201
	trn ln4
	add (775575
	trn ln2
	add (621777
	trn ln2
	add (776177
	trn ln2

ln3,	clad t1
	trn rch+1
	add mon
	sto t1
	clad syn
	cyr
	add t
	sto syn
	tra rch+1

ln2,	add (1
	trn ln3

|Search for pseudo or macro instruction

spi,	clc
	sto spz
	add psi
	add (add-3
	sto sp1
sp0,	clad sym

sp1,	xx
	trn sp3

sp2,	clad (-3
	add sp1
	sto sp1
	com
	add (add psi
	trn sp0
	clc
	add mdi
	trn dmi
	clc
	add spz
	trn ipi
	tra sp4

sp3,	add one
	trn sp2
	sto spz
	add sp1
	sto sp5
	clad syn

sp5,	xx
	com
	trn sp2
	amz
	com
	trn sp2
	add mdi
	trn mdm

sp4,	add sp5
	sto sp6
	cla

sp6,	xx
	sto sp7
	com
	trn mac
	clc

sp7,	xx

|Parameter assignment routine (equal sign).

q,	add syl
	com
	trn ipa
	add let
	com
	trn ipa
	add sym
	sto t3
	clad (trn ilf
	sto bt
	sto qt
	sto ct
	add (qq-ilf
	sto tt
	tra rnw

qq,	add chc
	add syl
	trn rnw
	call evl
	add def
	trn usq

q1,	llr t3
	slr sym
	llr wrd
	slr t3
	clc
	sto let
	add one
	sto def
	call evl
	add def
	trn vsm

qu,	add e4
	add (-add-1
	sto v7
	tra vs6

|Address tag routine.

c,	call evl
	add syl
	com
	trn c2
	cla
	sto asi
	sto aml
	add sym
	sto asm

c2,	llr loc
	lcc
	sto t3
	trn rnw
	clc
	add def
	trn c1
	add wrd
	lad
	trn mdt
	add mon
	trn rnw
	tra mdt

c1,	add syl
	com
	trn rnw


|Enter new symbol and value in symbol table

vsm,	clad low
	add (-2
	sto low
	add one
	sto v3
	add hih
	trn sce
	llr sym

vs1,	clad v3
	add one
	sto v5
	sto v1
	add one
	sto v3
	add (-add-3
	sto v2
	sto v6
	add one
	sto v4
	sto v7
	add (-low+2
	trn vs2

vs3,	lcc
v6,	xx
vs6,	clad t3
v7,	xx


|Reset terminating character switches

rst,	clad mii
	load ct, trn c
	trn rsm
	sto mdi
	add (trn b-1
	sto bt
	add (q-b
	sto qt
	add (tab-q
	sto tt
	tra rnw

rsm,	add (trn df2
	sto bt
	add (da-df2
	sto qt
	add (sw-da
	sto tt
	tra rnw

vs2,	cla
v5,	xx
	lpd
	trn vs4
	lac
	trn vs3
vs5,	cla
v1,	xx
v2,	xx
	cla
v3,	xx
v4,	xx
	tra vs1

vs4,	cry
	trn vs3
	tra vs5

|Pseudo-instructions octal, decimal, and noinput

oct,	add (opr
	tra dec+1
dec,	add n2
	sto n1

noi,	cla
	sto syl
	llr t
	tra cfc
t0
|Pseudo-instruction character

ch,	call rch
	cyr
	add (757577
	trn chr
	add (617777
	trn chl
	add (756177
	trn chm
	tra ilf

chr,	add one
	trn ilf
	add (cyr-1
	tra ch2

chm,	add one
	trn ilf
	add (opr-1
	tra ch2

chl,	add one
	trn ilf
	add (cyl-1

ch2,	sto ch4
	call rch
	cyr
ch4,	xx
	sto num
	tra r

|Pseudo instruction flexo

fx,	cla
	sto num
	load t1, 333333
	call rch
	lal
	add num
	cyr
	sto num
	llr t1
	lal
	sto t1
	trn rch+1
	tra r

|Restore

rm,	load low, add low
	load psi, sto psi+npi+npi+npi+1
	load rst, tra rma
	clad (llr ist
	tra rmb

rm1,	xx
	lcc
	sto sym
rm2,	xx
	slr t3
	tra vsm

rma,	clad rm2
	add one
rmb,	sto rm1
	add one
	sto rm2
	add (-llr-ist-nsy-nsy
	trn rm1
	load rst, cla
	load mai, sto mil+1
rm3,	clc
	sto pss
	tra np1

|Pseudo-instruction start

sta,	clad (trn ilf
	sto bt
	sto qt
	sto ct
	add (s-ilf
	sto tt
	llr t
	tra cfc

s,	add pss
	trn ep1
	call evl
	add def
	trn uss
s2,	llr wrd
	tra ep2

|Begin new pass

ps2,	llr one
	slr pss
	load psi, sto psi+npi+npi+npi+1
	clad (sto mil+1
	llr mai
	sto mai

np1,	lac		|begin pass
	add (add
	sto con
	com
	sto hih
	add one
	sto nco
	cla
	sto nca
	sto asm
	add one
	sto mii
	add (17
	com
	sto loc
	add (cor+20
	sto cn6
	add one
	sto cn7
	add (add-1
	sto co7+1
	load n1, opr
	clad pss
	trn rs1

np2,	cla
	sto api
	load bs, tra rnw
	clc
	sto cas
	tra rst

start
