                                                    
MACRO FIO-DEC _  part 1, 2-13-62

ncn=10	nfw=220	nds=30	ncd=20	ncl=10


4340/		pbf,	/punch buffer
	pbf+101/	flx,	/flexo input buffer
	flx+nfw/	dsm,	/dummy symbols
	dsm+nds/	dss,	/argument translation indicators
	dss+nds/	dsv,	/m-i argument values
	dsv+nds/	pdl,	/dummy symbol specifications
	pdl+ncd/	cv1,	/constants dummy symbol levels
	cv1+ncl/	cv2,	/constants value levels
	cv2+ncl/	cv3,	/constant signs
	cv3+ncl/	cv4,	/constants definite on this level
	cv4+ncl/	cor,	/list of constant origins
	cor+ncn+1/
		cr2,	/second constants origin
	cr2+ncn+1/
		ck1,	/checksum
	ck1+1/	org,	/block origin
	org+1/	psi,	/pseudo instruction index
	psi+1/	mai,	/macro instruction storage
	7750/	low,	/symbol table end

	xy=1	one=(1

define
	error ROU,RET,NAM
	law RET
	jda ROU
	NAM
	terminate

0/
          
                                                                 
/start over entry

	lat
	sma
sov,	jmp xy

so1,	swap
	init so3,pss

so4,	ril 1s
	clc
	spi
	law 1
so3,	dac xy
	index so3,(dac pss+5,so4
	lac npa
	sma
	jmp np2

so5,	lac pss
	spa
	jmp ps1
	jmp ps4
          
                                                                 
/reset terminating character switches

rst,	law rsk
rsl,	dap rsx
	lio mii
	init bs,rnw
	init ct,c
	init dtb+57, lp
	spi
	jmp rsm
	dio mdi
	init bt,b
	init qt,q
	law tab
	jmp rs1

rsm,	init bt,df2
	init qt,da
	law sw
rs1,	dap tt
rsx,	jmp xy

/reset to convert next word

rsk,
rnw,	init lp1,cv1
	init prs,pdl
	init rt,ilf

rsw,	dzm wrd
	clf 5		/syl
	dzm nsm
	dzm amn
	dzm asa
	clf 6		/dsi
	law 1
	dac def
	law r

rss,	lio (opr

sp,	dio sgn
rsp,	dap spx
	dzm let
	clf 4		/liu
	dzm ovb
	dzm num
	dzm dnm
	dzm sym
	dzm chc
spx,	jmp xy
          
                                                                 
/read and dispatch on one character

r,	jsp rch
	add (dtb
	dap .+2
	clc
	jmp xy

/re-dispatch on last character read

r2,	lac rcp
	jmp r+1

/dispatch table

dtb,	jmp p	jmp n	/space, 1
	jmp n	jmp n	/2, 3
	jmp n	jmp n	/4, 5
	jmp n	jmp n	/6, 7
	jmp n	jmp n	/8, 9
	jmp il	jmp r	/i, stop code
	jmp il	jmp il
	jmp il	jmp il

	jmp n	bt,jmp	/0, slash
	jmp l	jmp l	/s, t
	jmp l	jmp l	/u, v
	jmp l	jmp l	/w, x
	jmp l	jmp l	/y, z
	jmp il	jmp cqt	/i, comma
	jmp il	jmp il	/color
tt,	jmp 0	jmp il	/tab

	jmp il	jmp l	/middle dot, j
	jmp l	jmp l	/k, l
	jmp l	jmp l	/m, n
	jmp l	jmp l	/o, p
	jmp l	jmp l	/q, r
	jmp il	jmp il
	jmp pm	jmp rt	/+/-, )
	jmp ovr	jmp lp	/. ,(

	jmp il	jmp l	/a
	jmp l	jmp l	/b, c
	jmp l	jmp l	/d, e
	jmp l	jmp l	/f, g
	jmp l	jmp l	/h, i
	jmp rch+1	jmp rl	/l. c., period
	jmp rch+1	jmp il	/u. c., backspace
	jmp il	dtc,jmp tt	/car ret
          
                                                                 
/case dependent characters

cqt,	szf 3
qt,	jmp q
ct,	jmp c

pm,	szf 3
	jmp p
	jmp m

/process alphabetic or numeric character

l,	dac let
	szf 3		/cas
	stf 4		/liu
	jmp ln

l2,	lac sym
	ral 6s
	ior t
	dac sym
	jmp r

n,	law 17
	and t
	dac t1
n2,	lac num
	ral 3s
	xct .+1
n1,	xx		/opr=octal, add num=decimal
	dac num
	add t1
	sza
	jmp n3
	lac t1
	xor num
n3,	dac num
	lac dnm
	ral 2s
	add dnm
	ral 1s
	add t1
	dac dnm

ln,	idx chc
	sub (3
	spq
	jmp l2
	lac let
	sma
	jmp r
	lac sym
	dac api
	jsp rsp
          
                                                                 
/read three more characters for p-i or m-i

	lac t
	dac syn
	setup t1,3
	jsp rch

ln4,	sza i
	jmp spm		/space
	sad (54
	jmp spm		/minus
	sad (36
	jmp spm		/tab
	sad (77
	jmp spm		/cr

ln3,	isp t1
	jmp .+2
	jmp rch+1
	lac syn
	ral 6s
	ior t
	dac syn
	jmp rch+1

/over bar indicator

ovr,	law 1
	dac ovb
	jmp r
          
                                                                 
/search for pseudo or macro instruction

spm,	clf 2
	lac psi
	lio mdi

sp2,	dap sp1
	lac api

sp1,	sad .
	jmp sp3
	idx sp1

sp7,	idx sp1
	lac i sp1
	spa
	jmp sp2
	law i 5
	add sp1
	sas (sad mai-2
	jmp sp2
	spi
	jmp dmi
	szf 2
	jmp sp4
	jmp ipi

sp3,	stf 2
	idx sp1
	dap sp5
	lac syn

sp5,	sas .
	jmp sp7
	spi
	jmp mdm

sp4,	idx sp5
	dap sp8
	lac i sp5
	sma

sp8,	jmp i .
	idx sp5
	jmp mac
          
                                                                 
/address tag routine (comma)

c,	lac loc
	spa
	jmp rnw
	jsp evl		/def in io on return
	spi
	jmp c1
	lac loc
	sad wrd
	jmp c2
	szf 5		/syl
	dzm sym
	jsp mdt

c2,	szf 5
	jmp rnw
c3,	dzm asi
	dzm aml
	move sym, asm
	jmp rnw

c1,	szf 5
	jmp rnw
	lac loc
	dac t3
	jsp vsm
	jmp c3
          
                                                                 
/parameter assignment (equal sign)

q,	lac let
	szf 5		/syl
	jsp ipa
	sza i
	jsp ipa
	lac ovb
	sza
	jsp ipa
	lio sym
	dio scn
	init bt,ilf
	dap qt
	dap ct
	init tt,qq
	jmp rnw

qq,	jsp sch
	jmp rst
	jsp evl		/def in io pss in ac
	spi i
	jmp q2
	spq
	jmp rst
	jsp usq

q2,	lio scn
	dio sym
	move wrd,scn
	clc
	dac let
	law 1
	dac def
	jsp evl
	lac def
	spq
	jmp q1
	lac scn
	dac i ea
	jmp rst

q1,	move scn,t3
	jsp vsm
	jmp rst

sch,	dap sck
	szf 5		/syl
	jmp .+3
	lac chc
	szm
	idx sck
sck,	jmp xy
          
                                                                 
/evaluate syllable and accumulate word value

evl,	dap ex
	lac sym
	jda per
	dac sym
	lac mii
	spa
	jmp wsp

ev2,	lac let
	spa
	jmp el
	add num

sga,	xct sgn
	add amn
	dac amn
en,	lac num
sgn,	xx
	jda ed

evx,	lac pss
	lio def
ex,	jmp .

ndf,	clc
	dac def
	dac t3
	jda ed
	lio sym
	dio lus
	lac ovb
	sub pss
	sas one
	jmp evx
	jsp vsm
	idx vct
	jmp evx

el,	lac sgn
	sad (opr
	jmp el1

el2,	law i 1
	dac nsm
	jmp e2

el1,	lac nsm
	szm
	jmp el2		/if +1
	sza
	jmp e2		/if -1
	law 1
	dac nsm
	move sym, asa
          
                                                                 
/evaluate symbol (logarithmic search)

e2,	law 4000
	dac t1
	clo
	lac low
	jmp e1+1

edn,	lac (sub
	dip e1
	lac t1
	rar 1s
	dac t1
	sad (1
	jmp ndf
	lac ea
e1,	t1
	dac ea
	sub low
	spa
	jmp eup
	lac ea
	sub (lac low-1
	sma+sza-skp
	jmp edn

ea,	lac .
	sub sym
	szo
	cma
	sma+sza-skp
	jmp edn

eqt,	sza
	jmp eup
	idx ea
	lac i ea
	dac num
	lac ovb
	sza i
	jmp en
	lac num
	lio pss
	cma
	sza
	jmp evk
	spi
	jmp ndv
	lac vct
	add vc1
	dac num
	dac i ea
	idx vct
	jmp en
          
                                                                 
eup,	lac (add
	jmp edn+1

ndv,	clc
	dac def
	move sym,lus
	jmp en

evk,	spi i
	jmp en
	move sym,lus
	error alu, en, flex mdv

ed,	0
	dap edx
	lac ed
	add wrd
	sza
	jmp ed1
	lac ed
	xor wrd
ed1,	dac wrd
edx,	jmp xy
          
                                                                 
/insert symbol in symbol table

vsm,	dap vsx
	law i 2
	add low
	dac low
	dap v1
	sub hih
	spq
	jsp sce
	clo

vs1,	lac v1
	dap v2
	add one
	dap v4
	add one
	dap v1
	add one
	dap v3
	sas (lio low+1
	jmp vs2
vs3,	lac sym
	dac i v2
	lac t3
	dac i v4
vsx,	jmp xy

vs2,	lac i v1
	sub sym
	szo
	cma
	spq-i
	jmp vs3

v1,	lio xy		/low+2+I
v2,	dio xy		/low+I
v3,	lio xy		/low+3+I
v4,	dio xy		/low+1+I
	jmp vs1
          
                                                                 /pseudo-instruction repeat

rpt,	lac rqc
	spa
	jsp ilr
	init bt,ilf
	dap qt
	init ct, rq1
	dap tt
	jmp rsk

rq1,	jsp evl
	spi
	jsp usr
	lac wrd
	spq
	jmp rq4
	cma
	dac rqc
	init dtc,rq2
	move fwd,rqx
	move rc8,rqy
	move fwb,rqz
	jmp rst

rq2,	count rqc,rq3
	init dtc,tt
	jmp tt

rq3,	move rqx,fwd
	move rqy,rc8
	move rqz,fwb
	clf 3
	jmp tt

rq4,	add (0
	sza
	jmp ilr
	dzm rqc
	jsp rch
	sas (77
	jmp rch+1
	jmp rst

ilr,	error alm, rq4+3, flex ilr

rqc,	0
rqx,	0
rqy,	0
rqz,	0
          
                                                                 
/pseudo-instruction character

ch,	jsp rch
	lio (rar 6s
	sad (51
	jmp ch1		/r
	lio (opr
	sad (44
	jmp ch1		/m
	lio ch2
	sas (43
	jsp ilf		/l

ch1,	dio ch3
	jsp rch
ch2,	ral 6s
ch3,	xx
	dac num
	jmp fx1

/pseudo-instruction flexo

fx,	dzm num
	setup t1,3
	jsp rch
	lac num
	ral 6s
	ior t
	dac num
	count t1,rch+1
fx1,	stf 5
	jmp r
          
                                                                 
/pseudo-instruction text

txt,	lac rqc
	spa
	jsp ilf
	load txv,law txq
	init txx,rch+1
	jsp rch
	dac t2
	jmp .+2

txq,	dzm wrd
	setup t1,3

txw,	jsp rch
	sad t2
	jmp txk

txa,	lac wrd
	ral 6s
	dac wrd
	lac t
	jda ed
	isp t1
txx,	jmp xy

txv,	xx
	dap bs
	lio mii
	spi
	jmp mw
	jmp tb3

txk,	load txv,jmp fx1
	init txx,txa
	init bs,rnw
	lac t1
	sad (-3
	jmp rnw
	dzm t
	jmp txa
          
                                                                 
/syllable separation characters (plus, minus, space)

p,	jsp sch
	jmp r

m,	jsp evl
	stf 5		/syl
	lac t
	lio (opr
	sza i
	jmp m1
	szf i 3
	lio (cma
m1,	law r
	jmp sp

/relative address syllable (.)

rl,	lac chc
	szm
	jmp rla
	lac loc
	dac num
	dac dnm
	idx chc
	lac mii
	sma
	jmp r
	lio sgn
	rir 9s
	law 10
	rcr 3s
	jda pr
	jmp r

rla,	lac dnm
	dac num
	jmp r

dnm,	0
          
                                                                 
/storage word termination characters tab and carr ret)

tab,	jsp sch
	jmp rnw
	jsp evl
	spi+sma-skp
	jsp ust

tb3,	idx aml

tb4,	idx loc
tb2,	lac wrd
ts,	dac .
	idx ts
	lac loc
	dac wrd
	and (77
	szm
	jmp bs
	lac pss
	spq
	jmp bnp
	jmp pun

/location assignment termination character

b1,	lac def
	sma
	jmp bnp
	lac (400000
	jmp b3

b,	jsp sch
	jmp itc
	jsp evl
	lac nsm
	sad (-1
	jmp ba1
	dzm asi
	lio (-0
	sza i
	dio asi
	move asa, asm
	move amn, aml

ba1,	lac pss
	spq
	jmp b1
	lac def
	spq
	jmp usb

b5,	law 7777
	and wrd
	dac wrd
	sad loc
	jmp bs

start

          
                                          
