.globl	erlso
.globl	macerr
.globl	lohalt
.globl	erlia
.globl	erlme
.globl	erlmd
.globl	erlovf
.globl	_stack
.globl	logobc
.globl	er2a
/illegal macro element
	.text
erlme:
	jsr	pc,prerr
	mov	$1.,idlen
	jsr	pc,loerpr
	mov	meval,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< is illegal macro element\0>; .even
	.text
er1a:	jsr	pc,prctxt
	jbr	mcabrt
/multiply-defined label
erlmd:	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<label \0>; .even
	.text
	mov	meval,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< is multiply-defined\0>; .even
	.text
er2a:	jsr	pc,prctxt
	jbr	bsnext
/illegal input character
				.globl	ersic
ersic:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	idpt,-(lfpt)
	cmp	ffpt,_last
	jhis	erlso
	mov	idlen,-(lfpt)
	cmp	ffpt,_last
	jhis	erlso
	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<illegal input character\0>; .even
	.text
	jsr	pc,prctxt
	mov	(lfpt)+,idlen
	mov	(lfpt)+,idpt
	jmp	*9b
/illegal name after warning
				.globl	ersnw
ersnw:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<illegal macro name after warning\0>; .even
	.text
	jsr	pc,prviz
	jmp	*9b
/test for mismatches
				.globl	ermtst
ermtst:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	tst	skiplv
	jne	gl52
	tst	skval
	jne	gl52
	jmp	*9b
gl52:	jsr	pc,prerr
	jsr	pc,prmiss
	jmp	*9b
/stack overflow
erlso:
	mov	_spsave,sp
	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<process aborted for lack of storage\0>; .even
	.text
	tst	dbugsw
	jne	er7a
	tst	skiplv
	jne	gl53
	tst	skval
	jeq	er7a
gl53:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< possibly due to\n\0>; .even
	.text
	jsr	pc,prmiss
	jsr	pc,mdquit
er7a:	jsr	pc,prctxt
	jsr	pc,mdquit
/arithmetic overflow
erlovf:
	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<arithmetic overflow\0>; .even
	.text
	jbr	er1a
/illegal argument
erlia:
	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<argument \0>; .even
	.text
	mov	argno,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< has illegal value\0>; .even
	.text
	mov	arglen,idlen
	mov	eriapt,idpt
	jsr	pc,prviz
	jbr	mcabrt
/system error
macerr:
	jsr	pc,prerr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<system error\n\n\0>; .even
	.text
	jbr	lohalt
/subroutines for error print-outs
				.globl	prctxt
prctxt:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$stakpt,srcpt
	mov	etempt,dstpt
	mov	$16.,r1
	jsr	pc,_fmove
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\ndetected in\n\0>; .even
	.text
	cmp	dbugsw,$5.
	jeq	erop
prct2:	mov	linect,r1
	jsr	pc,prlino
prct3:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< of \0>; .even
	.text
	mov	$0f,-(sp)
	mov	$dbugsw,-(sp)
	jmp	_goswitch
	.data
0:
	erpsrc
	ermac
	erarg
	macerr
	erarg
	macerr
	erdel
/in macro
	.text
ermac:	mov	dbugpt,r1
	jsr	pc,prname
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< with \0>; .even
	.text
	tst	*argpt
	jne	gl54
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<no \0>; .even
	.text
gl54:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<arguments\0>; .even
	.text
	clr	argno
	mov	$4.,insw
	mov	argpt,dbugpt
paloop:
	cmp	*argpt,argno
	jeq	prct1
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\0>; .even
	.text
	inc	argno
	mov	argno,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<)    \0>; .even
	.text
	jsr	pc,setpts
	jsr	pc,prid
	jbr	paloop
prct1:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\ncalled from\n\0>; .even
	.text
prnext:	mov	stakpt,r1
	add	$2.,r1
	mov	r1,tempt
	mov	r1,srcpt
	mov	$stakpt,dstpt
	mov	$16.,r1
	jsr	pc,_fmove
	cmp	mchlin,linect
	jeq	prct2
	cmpb	*spt,$nlrep
	jne	el19
	mov	linect,r1
	dec	r1
	mov	r1,linect
	cmp	r1,mchlin
	jeq	prct2
el19:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<lines \0>; .even
	.text
	mov	mchlin,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< to \0>; .even
	.text
	mov	linect,r1
	jsr	pc,prnum
	jbr	prct3
/in argument
erarg:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<argument \0>; .even
	.text
	jbr	erdl1
/in delimiter
erdel:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<delimiter \0>; .even
	.text
erdl1:	mov	argno,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< of \0>; .even
/in operation macro, argument or delimiter
	.text
erop:
	mov	dbugpt,argpt
	mov	dbugpt,r1
	mov	22.(r1),dbugpt
	cmp	dbugsw,$5.
	jeq	ermac
	mov	dbugpt,r1
	jsr	pc,prname
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< evaluated in\n\0>; .even
	.text
	cmp	dbugsw,$2.
	jeq	ermac
	jbr	prnext
/in source text
erpsrc:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<source text\n\n\n\0>; .even
	.text
	mov	etempt,srcpt
	mov	$stakpt,dstpt
	mov	$16.,r1
	jsr	pc,_fmove
	jmp	*9b
				.globl	prerr
prerr:	mov	(sp)+,9f
	clr	_error
	.bss;9:.=.+2;.text
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\n\nerror(s)\n\0>; .even
	.text
	jmp	*9b
				.globl	prid
prid:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	tst	idlen
	jne	el20
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<(null)\0>; .even
	.text
	jbr	pridex
el20:
	cmp	idlen,$1.
	jne	prid1
/test if layout character
	mov	$2.,exitsw
	jsr	pc,lulayk
	jmp	prid2
	jbr	prid1
/print keyword for layout character
prid2:	mov	chanpt,r1
	mov	4.(r1),idlen
	mov	chanpt,r1
	add	$6.,r1
	mov	r1,idpt
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<(\0>; .even
	.text
	jsr	pc,loerpr
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<)\0>; .even
	.text
pridex:	jmp	*9b
/print ordinary text
prid1:	clr	tempsw
	cmp	idlen,$60.
	jle	el21
	mov	$1.,tempsw
	mov	idpt,r1
	add	idlen,r1
	sub	$26.,r1
	mov	r1,tempt
	mov	$26.,idlen
el21:	jsr	pc,loerpr
	tst	tempsw
	jeq	pridex
	mov	tempt,idpt
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<  ---  \0>; .even
	.text
	jbr	prid1
				.globl	prlid
prlid:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	r1,temapt
prl1:	mov	temapt,r1
	mov	2.(r1),idlen
	mov	temapt,r1
	add	$4.,r1
	mov	r1,idpt
	add	idlen,r1
	inc	r1
	bic	$1,r1
	mov	r1,temapt
	jsr	pc,prid
	cmp	*temapt,withmk
	jeq	prl1
	cmp	*temapt,wthsmk
	jeq	gl55
	jmp	*9b
gl55:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< \0>; .even
	.text
	jbr	prl1
				.globl	prlino
prlino:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<line \0>; .even
	.text
	mov	parnm,r1
	jsr	pc,prnum
	jmp	*9b
				.globl	prmiss
prmiss:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	tst	nestlv
	jeq	pmlab
	mov	cllfpt,lfpt
pmdel:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<delimiter \0>; .even
	.text
pmor:	mov	delpt,r1
	jsr	pc,prlid
	mov	*delpt,r1
	mov	r1,chlink
	tst	r1
	jeq	el22
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< or \0>; .even
	.text
	add	chlink,delpt
	jbr	pmor
el22:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< of \0>; .even
	.text
	mov	mtchpt,r1
	jsr	pc,prname
	mov	mchlin,r1
	jsr	pc,prnfnd
	jsr	pc,decalv
	jmp	pmd1
	jbr	pmdel
pmd1:	clr	skiplv
	tst	skval
	jge	pmlab
	clr	r1
	sub	skval,r1
	dec	r1
	mov	r1,skval
pmlab:
	tst	skval
	jeq	pmthru
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<label \0>; .even
	.text
	mov	skval,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< referenced\0>; .even
	.text
	mov	sklin,r1
	jsr	pc,prnfnd
	clr	skval
pmthru:	jsr	pc,prctxt
	jmp	*9b
				.globl	prname
prname:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	r1,idpt
	jsr	pc,setype
	jsr	pc,prtype
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< \0>; .even
	.text
	mov	idpt,r1
	jsr	pc,prlid
	jmp	*9b
				.globl	prnfnd
prnfnd:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< in \0>; .even
	.text
	mov	parnm,r1
	jsr	pc,prlino
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< of current text not found\n\0>; .even
	.text
	jmp	*9b
				.globl	prnum
prnum:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	r1,meval
	jsr	pc,mdconv
	jsr	pc,loerpr
	jmp	*9b
				.globl	prtype
prtype:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$0f,-(sp)
	mov	$type,-(sp)
	jmp	_goswitch
	.data
0:
	prt0
	prt1
	prt2
	prt3
	prt4
	.text
prt0:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<stop\0>; .even
	.text
	jbr	prexit
prt1:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<macro\0>; .even
	.text
	jbr	prexit
prt2:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<warning\0>; .even
	.text
	jbr	prexit
prt3:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<insert\0>; .even
	.text
	jbr	prexit
prt4:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<skip\0>; .even
	.text
prexit:	jmp	*9b
				.globl	prviz
prviz:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<, viz \0>; .even
	.text
	movb	$qutrep,r1
	jsr	pc,mderch
	jsr	pc,prid
	movb	$qutrep,r1
	jsr	pc,mderch
	jsr	pc,prctxt
	jmp	*9b
				.globl	setype
setype:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	add	$2.,r1
	mov	r1,temapt
stp1:	mov	*temapt,r1
	add	temapt,r1
	add	$2.,r1
	inc	r1
	bic	$1,r1
	mov	r1,tempt
	add	$2.,r1
	mov	r1,temapt
	cmp	*tempt,withmk
	jeq	stp1
	cmp	*tempt,wthsmk
	jeq	stp1
	cmp	*tempt,spcsmk
	jne	gl56
	add	$2.,temapt
gl56:
	mov	*temapt,type
	jmp	*9b
				.globl	prenv
prenv:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\nversion aig\n\0>; .even
	.text
	clr	mtype
env1:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\0>; .even
	.text
	cmp	mtype,$5.
	jne	gl57
	jmp	*9b
gl57:
	mov	mtype,type
	jsr	pc,prtype
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<s are\n\n\0>; .even
	.text
	mov	hashpt,r1
	mov	r1,prstpt
	mov	r1,prtapt
tab3:
	mov	prtapt,prtbpt
tab1:	mov	*prtbpt,r1
	mov	r1,prtbpt
	tst	r1
	jeq	tab2
/eliminate built-in macros
	cmp	stffpt,prtbpt
	jhi	tab1
	cmp	prtbpt,endpt
	jhis	tab1
	mov	prtbpt,r1
	add	$2.,r1
	jsr	pc,setype
	cmp	type,mtype
	jne	tab1
	tst	type
	jeq	gl58
	mov	prtbpt,r1
	jsr	pc,ckvaly
	jmp	tab1
gl58:	mov	prtbpt,r1
	add	$2.,r1
	jsr	pc,prlid
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\0>; .even
	.text
	jbr	tab1
tab2:	add	$2.,prtapt
	mov	prtapt,r1
	sub	prstpt,r1
	cmp	r1,$64.
	jne	gl59
	inc	mtype
	jbr	env1
gl59:	jbr	tab3
/end of mi-logic of ml/i
/special additional code for lowl ml/i
				.globl	loschn
loschn:	mov	r1,parnm
	mov	(sp)+,9f
	.bss;9:.=.+2;.text
/corresponds to chain from in l
	mov	r1,chanpt
	tst	r1
	jeq	los1
	mov	*chanpt,chlink
	add	$4*1.,9b
	jmp	*9b
los1:	jmp	*9b
				.globl	loechn
loechn:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
/corresponds to endch in l
	tst	chlink
	jeq	loe1
	mov	chlink,r1
	add	chanpt,r1
	mov	r1,chanpt
	mov	*chanpt,chlink
	jmp	*9b
loe1:	add	$4*1.,9b
	jmp	*9b
/finalisation code
lohalt:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<\n\nat end of process: \0>; .even
	.text
	mov	svarpt,r1
	sub	$4.,r1
	mov	(r1),r1
	dec	r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< lines, \0>; .even
	.text
	mov	invoct,r1
	jsr	pc,prnum
	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	< calls\n\0>; .even
	.text
	jsr	pc,prenv
	jsr	pc,mdquit
/code to process bc delimiter on go macro
logobc:
	mov	inffpt,tempt
	clr	temp
	cmpb	*idpt,$'i
	jeq	bci
	cmpb	*idpt,$'l
	jeq	bcl
	cmpb	*idpt,$'n
	jne	erlia
bcnlp:
	cmpb	*tempt,$'+
	jeq	bcn1
	cmpb	*tempt,$'-
	jne	bcn2
bcn1:	inc	tempt
	jbr	bcnlp
bcn2:	inc	temp
bcl:	inc	temp
bci:
	cmp	tempt,eriapt
	jeq	gofail
bcloop:	movb	*tempt,r1
	tstb	_tstchr(r1)
	jlt	gofail
	tst	temp
	jeq	bcok
	mov	$1.,idlen
	clr	meval
	movb	*tempt,r1
	movb	_tstchr(r1),r1
	jle	bctst
	dec	r1
	inc	idlen
bctst:
	cmp	idlen,temp
	jne	gofail
bcok:	inc	tempt
	cmp	tempt,eriapt
	jeq	gosuc
	jbr	bcloop
				.globl	loerpr
loerpr:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
/prints text in error messages
	mov	idpt,r1
	add	idlen,r1
	mov	r1,dstpt
loerlp:
	cmp	idpt,dstpt
	jhis	loeret
	cmpb	*idpt,$slrep
	jeq	loersl
	movb	*idpt,r1
	jsr	pc,mderch
loer1:	inc	idpt
	jbr	loerlp
loersl:	mov	$0f,-(sp)
	jsr	pc,_message
	.data;
0:	<(sl)\0>; .even
	.text
	jbr	loer1
loeret:	jmp	*9b
				.globl	lonum
lonum:	mov	(sp)+,9f
	.bss;9:.=.+2;.text
/performs character to numerical conversion
	movb	*idpt,r1
	movb	_tstchr(r1),r1
	jle	numex
	dec	r1
	mov	r1,meval
	mov	idpt,tempt
lnmlp:	inc	tempt
	cmp	spt,tempt
	jlo	nmfin
	movb	*tempt,r1
	movb	_tstchr(r1),r1
	jle	erlia
	dec	r1
	mov	r1,temp
	mov	meval,r1
	mul	$10.,r1
	add	temp,r1
	mov	r1,meval
	jbr	lnmlp
nmfin:	add	$4*1.,9b
	jmp	*9b
numex:	jmp	*9b
	.bss
	.globl	_stack
_stack:	.=.+_stcksze
	.globl	_endstack
_endstack=	.
/input 565,output 563, 12.9% optimalized
