
Microflit 2S


	define
	nword n, v
	repeat 13, n=n+n
	n=n+trn-2000+20
	n+v
	termin

	define
	routine v, n
	nword n, v-lis
	termin

	define
	number v, n
	nword n, -v
	termin

opsyn flex,flexo
opsyn char,character

lis,	llr bki		|entry point
bk1,	slr chc		|restore break instr

lse,	tsx lcr
lss,	clc
	sto chc
	stz num
pls,	llr ls1
lsq,	slr sgn
lsp,	stz sym
	stz let
	stz syl

lsr,	load lsa, add cht
	cal 1

ls1,	lcc
	trn ls1
lsa,	xx		|add cht
	trn lst

ls2,	ado lsa
	add et
	trn ls1
	slr let
	lcc
	add (774000
	tze err

lsd,	sto tem
	stz chc
	lda syl
	cyl
	cyl
	cyl
	add tem
	sto syl
	ldx (-4
ls3,	lax tbl+4
	cry
	cyl
	alo
	tix ls3
	lda (111111
	ana
	add sym
	cyr
	sto sym
	tra lsr

tbl,	400777
	377
	176
	74
	30

err,	lda (flex x
	ldx cr1

p3,	sxa p3x
	ldx (2
p31,	llr (666666
	anl 20
	tze .+2
	pno
	lar
	tix p31
p3x,	tra .

cht,	number 0, 76
	number 1, 25
	number 2, 17
	number 3, 7
	number 4, 13
	number 5, 23
	number 6, 33
	number 7, 27

	routine pls, 15
	routine pls, 10
	routine min, 35
	routine cr, 51
	routine ta, 45
	routine bar, 5
	routine bs, 43
	routine dot, 21
	routine eql, 11
	routine uc, 71
	routine lc, 75

lcp,	routine ins, 12
	routine con, 34
	routine pi, 14
	routine pr, 54
	routine beg, 64
	routine q, 56
	routine ser, 46
	routine bk, 62
	routine pn, 32
	routine alm, 6
	routine alm+1, 44
	routine alm+2, 72
	routine alm+3, 70

lst,	add (2000
	trn ls2
	add (-20
	trn lsd		|if digit
	add tls
	sto lsx
	lda let
	trn evl
	llr syl
sgn,	xx		|lac or lcc
	add num
	sto num
	ldx cc
cc,	lda chc
	llr lwt
	trn .+3
	llr num
	ldx crs
lsx,	xx		|exit to routines

uc,	add (lcp-lst
lc,	add (-add-lcp+1
	sto et
	tra lsp

alm,	add one		|a, l, x, m logic
	add one
	add one
	add (-msk
	tra lsd

ta,	slx
	lxr
	sxa baa
ta3,	tsx lcr
	lda baa
	tsx opa		|print addr
	lda hcn
	pno
	ldx baa

ta6,	sxa crs
	lda tab
	pno
	lax 0
	tsx pt
	tra eq2+1

bs,	trn .+2
	slx 0
	ado baa
	tra ta3

bar,	lxr
	trn ta6
	sxa baa
	tra ta6

cr,	trn .+2
crs,	slr chc		|addr of reg open
	slr lwt
	ldx cc
	sxa crs
cr1,	tra lss

min,	llr vsp		|minus
	tra lsq

dot,	llr baa

q,	lcc
	tra lsd

lcr,	lda crt
	pno
lca,	lda (111101
	pno
	lda (-add-lcp+1
	sto et
	trx

bk,	slr lwt
	trn ebk		|breakpoint
bk3,	lxr
	sxa bk1
	tra lse

ebk,	llr cc
	tra bk3

tr,	sto ac
	ado chc
	trn pr2
	slr lr
	xac
	sto xr

tr0,	lda bk1
	add (lda-slr
	sto pra
	add (tra-lda+1
	sto prc
	lda (flex ac 
	tsx p3
	lda ac
	tsx pt
	pno
	lda (flex lr 
	tsx p3
	lda lr
	tsx pt
	pno
	lda (flex xr 
	tsx p3
	lda xr
	tsx pt
tls,	tra lis

pr,	orl		|set proceed count
pra,	lda prc		|get instr to execute
	sto bix

pr1,	lcc
	add one
	sto chc
	tsx lcr
	ldx bk1
	llx 0		|set breakpoint
	slr bki
	llr (tra tr
	slx 0
	llr lr
	ldx xr

pr2,	lda ac
bix,	tra err
prc,	tra err

beg,	trn err		|go to routine
	lda .+4
	sto bix
	lxr+lro-opr
	sxa bix
	tra pr1

pn,	tsx lca		|print flexo
	lac
	tsx p3

eq2,	lda tab
	pno
	tra lss

ser,	trn err		|word search
	lda msk
	ana
	sto num
	tsx lcr
	ldx ll
	tra sr4

sr1,	xac
	add est
	trn sr3

sr,	llr msk
	lax 0
	ano
	lda num
	lpd
	trn sr3
	tze sr2

sr3,	aux one
sr4,	xcc
	add ul
	trn lse
	xcc
	add (lis
	trn sr1
	tra sr

sr2,	xac
	sto chc
	tsx opa		|addr
	lda hcn
	tsx p3
	ldx chc
	lax 0
	tsx pt		|contents
	lda crt
	pno
	ldx chc
	tra sr3

opa,	sxa opx		|print addr
	sto tem
	tra vsf

pi,	tsx lca		|print instr
	lac
	sto tem
	sto lwt
	tsx vs1
pix,	tra eq2

pt,	sto tem		|print word
	sto lwt
ops,	tra opt		|inst-con sw

eql,	lac
	sto lwt
	ldx pix

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

opp,	lal
opb,	cyl
	cyl
	llr (-7
	anl 20
	axr
	tze .+3
	lda p33
	sto ope
	lax opf
ope,	xx		|pno or cyl
	ado syl
	tze opc
	trn opp
	lda tab
opx,	tra .

opc,	lda p33
	tra opd

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

evl,	lda (syt
	tsx ev
	trn sgn
	lda (flex udf
	tra err+1

ev,	sxa evx
	load let, -400000
	axr
ev1,	lax 0
	llr sym
	lpd
	trn ev2
	com+cry-opr
	tze ev3
	trn ev2
	alr+com-opr
	add let
	trn ev2
	slr let
	sxa ev4

ev2,	aux (2
	xac
	add est
	trn ev1
evx,	tra .

ev3,	sxa ev4
	lax 1		|symbol lookup--pick up value
	com
	alc
	tra evx

ins,	add (vs1-opt
con,	add (tra opt
	sto ops
	tra lse

vs1,	sxa opx		|print as instr
	llr (760000
	anl+com-opr
	trn vsp
	cyl
	trn vsp
	cyr+com-opr

vsf,	tsx vsy		|op class
	tra opn

vsp,	lac		|addressable
	tsx vsy

vsy,	sxa vsx
	sto sym
	lda (syt+1
	tsx ev
ev4,	lda		|get best value
	com
	add tem
	sto tem
	ldx ev4
	lax 17777	|lda flex flad
	tsx p3
	lda (001000	|space
p33,	pno
	lda tem
	tze opx-1
	ldx vsf+1
vsx,	tra .

constants

mon,	-1
one,	1
hcn,	200303
crt,	101001
tab,	100101
lwt,	0
num,	0
sym,	0
let,	0
chc,	0
et,	-add-lcp+1
tem,	0
syl,	0
bki,	0
baa,	0
ac,	0
lr,	0
xr,	0
msk,	-0
ll,	0
ul,	17777
est,	est+1|
syt,
	flex A	ac
	flex L	lr
	flex X	xr
	flex M	msk

start add lis
