.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
!-------------------------------------------------------------------------
!		TEST AND BRANCH GROUP
!-------------------------------------------------------------------------

tlt_z:	testen	(sp)+	; blt	true	; cl	-(sp)	; jmp	(a4)
tle_z:	testen	(sp)+	; ble	true	; cl	-(sp)	; jmp	(a4)
teq_z:	testen	(sp)+	; beq	true	; cl	-(sp)	; jmp	(a4)
tne_z:	testen	(sp)+	; bne	true	; cl	-(sp)	; jmp	(a4)
tge_z:	testen	(sp)+	; bge	true	; cl	-(sp)	; jmp	(a4)
tgt_z:	testen	(sp)+	; bgt	true	; cl	-(sp)	; jmp	(a4)

true:		mov	#1,-(sp) ;	jmp	(a4)

zlt_s0:		testen	(sp)+	;	blt	bra_s0	; bra nobr2
zlt_l:		testen	(sp)+	;	blt	bra_l	; bra nobr3
zlt_q:		move.l	(sp)+,d0
		testen	(sp)+	;	blt	1f	; jmp (a4)
zle_s0:		testen	(sp)+	;	ble	bra_s0	; bra nobr2
zle_l:		testen	(sp)+	;	ble	bra_l	; bra nobr3
zle_q:		move.l	(sp)+,d0
		testen	(sp)+	;	ble	1f	; jmp (a4)
zeq_s0:		testen	(sp)+	;	beq	bra_s0	; bra nobr2
zeq_s1:		testen	(sp)+	;	beq	bra_s1	; bra nobr2
zeq_l:		testen	(sp)+	;	beq	bra_l	; bra nobr3
zeq_q:		move.l	(sp)+,d0
		testen	(sp)+	;	beq	1f	; jmp (a4)
zne_s0:		testen	(sp)+	;	bne	bra_s0	; bra nobr2
zne_s_1:	testen	(sp)+	;	bne	bra_s_1	; bra nobr2
zne_l:		testen	(sp)+	;	bne	bra_l	; bra nobr3
zne_q:		move.l	(sp)+,d0
		testen	(sp)+	;	bne	1f	; jmp (a4)
zge_s0:		testen	(sp)+	;	bge	bra_s0	; bra nobr2
zge_l:		testen	(sp)+	;	bge	bra_l	; bra nobr3
zge_q:		move.l	(sp)+,d0
		testen	(sp)+	;	bge	1f	; jmp (a4)
zgt_s0:		testen	(sp)+	;	bgt	bra_s0	; bra nobr2
zgt_l:		testen	(sp)+	;	bgt	bra_l	; bra nobr3
zgt_q:		move.l	(sp)+,d0
		testen	(sp)+	;	bgt	1f	; jmp (a4)

blt_s0:		comp	(sp)+,(sp)+ ;	blt bra_s0 ;	bra nobr2
blt_l:		comp	(sp)+,(sp)+ ;	blt bra_l ;	bra nobr3
blt_q:		move.l	(sp)+,d0
		comp	(sp)+,(sp)+ ;	blt 1f ;	jmp (a4)
ble_s0:		comp	(sp)+,(sp)+ ;	ble bra_s0 ;	bra nobr2
ble_l:		comp	(sp)+,(sp)+ ;	ble bra_l ;	bra nobr3
ble_q:		move.l	(sp)+,d0
		comp	(sp)+,(sp)+ ;	ble 1f ;	jmp (a4)
beq_s0:		comp	(sp)+,(sp)+ ;	beq bra_s0 ;	bra nobr2
beq_l:		comp	(sp)+,(sp)+ ;	beq bra_l ;	bra nobr3
beq_q:		move.l	(sp)+,d0
		comp	(sp)+,(sp)+ ;	beq 1f ;	jmp (a4)
bne_s0:		comp	(sp)+,(sp)+ ;	bne bra_s0 ;	bra nobr2
bne_l:		comp	(sp)+,(sp)+ ;	bne bra_l ;	bra nobr3
bne_q:		move.l	(sp)+,d0
		comp	(sp)+,(sp)+ ;	bne 1f ;	jmp (a4)
bge_s0:		comp	(sp)+,(sp)+ ;	bge bra_s0 ;	bra nobr2
bge_l:		comp	(sp)+,(sp)+ ;	bge bra_l ;	bra nobr3
bge_q:		move.l	(sp)+,d0
		comp	(sp)+,(sp)+ ;	bge 1f ;	jmp (a4)
bgt_s0:		comp	(sp)+,(sp)+ ;	bgt bra_s0 ;	bra nobr2
bgt_l:		comp	(sp)+,(sp)+ ;	bgt bra_l ;	bra nobr3
bgt_q:		move.l	(sp)+,d0
		comp	(sp)+,(sp)+ ;	bgt 1f ;	jmp (a4)

bra_s0:
			move.l	d6,d0
0:			move.b	(a3)+,d0
1:			add.l	d0,a3	;	jmp	(a4)
bra_l:		move.b	(a3)+,-(sp) ;	move.b	(a3)+,1(sp)
		move.w	(sp)+,d0 ;	ext.l	d0
		bra	1b
bra_q:
		move.l	(sp)+,d0 ;	bra	1b
bra_s1:		move.w	#0x100,d0 ;	bra	0b
bra_s_1:	move.l	#-1,d0	;	bra	0b
bra_s_2:	move.l	#-0x200,d0 ;	bra	0b
nobr2:		add.l	#1,a3	;	jmp	(a4)
nobr3:		add.l	#2,a3	;	jmp	(a4)

!---------------------------------------------------------------------------
!		COMPARE GROUP
!-----------------------------------------------------------------------------

cmi_z:		mov	(sp)+,d0 ;	bra	0f
cmi_l:		adroff		;	move.w	(a5),d0
0:		sub.w	wrd,d0 ;	beq	cmi_1W
		sub.w	wrd,d0 ;	beq	cmi_2W
		bra	e_oddz
cmi_1W:		comp	(sp)+,(sp)+ ;	bgt	1f	;	beq 2f
3:		mov	#-1,-(sp) ;	jmp	(a4)
1:		mov	#1,-(sp) ;	jmp	(a4)
2:		cl	-(sp)	;	jmp	(a4)
cmi_2W:
#ifdef	lword
		bsr	no8bar	;	bra	e_oddz
#endif
		cmp.l	(sp)+,(sp)+ ;	blt	3b	;	beq 2b
		bra	1b

cmu_z:		mov	(sp)+,d0 ;	bra	4f
cmu_l:		adroff		;	move.w	(a5),d0
4:		sub.w	wrd,d0	;	bne	5f
		comp	(sp)+,(sp)+ ;	bcs	3b
		beq	2b	;	bra	1b
5:		sub.w	wrd,d0	;	bne	e_oddz
#ifdef lword
		bsr	no8bar	;	bra	e_oddz
#endif
cmp_z:		cmp.l	(sp)+,(sp)+ ;	bcs	3b
		beq	2b	;	bra	1b

cms_l:		adroff		;	move.w	(a5),d0
		bra	0f
cms_z:		mov	(sp)+,d0 ;	bra	0f
cms_s0:		move.l	d6,d0	;	move.b	(a3)+,d0
0:		move.l	d0,d1	;	move.l	sp,a0
		asri	wmu,d1	;	subt	#1,d1
		add.l	d0,sp	;	move.l	sp,d2
1:		comp	(a0)+,(sp)+ ;	bne	2f
		dbra	d1,1b
		mov	d6,-(sp) ;	jmp	(a4)
2:		add.l	d0,d2	;	move.l	d2,sp
		move.l	#1,d1	;	mov	d1,-(sp)
		jmp	(a4)


!		DUMMY FLOAT ROUTINES. POINTER ADJUSTMENT AND WARNING

cmf_s0:		move.l	d6,d0	;	move.b	(a3)+,d0
9:		add.w	d0,d0	;	add.l	d0,sp
		cl	-(sp)
#ifdef FLTRAP
		bra	flnim	
#else
		jmp	(a4)
#endif
cmf_l:		adroff		;	move.w	(a5),d0	;	bra 9b
cmf_z:		mov	(sp)+,d0 ;	bra	9b

!-------------------------------------------------------------------------
!		CALL AND RETURN GROUP
!----------------------------------------------------------------------------

cai_z:		move.l	(sp)+,d0 ;	bra	1f
cal_q:		move.l	(sp)+,d0 ;	bra	1f
cal_l:		adroff		;	move.w	(a5),d0	;	bra 1f
cal_s0:		move.w	d6,d0	;	move.b	(a3)+,d0 ;	bra 1f
cal_1:	cal_2:	cal_3:	cal_4:	cal_5:	cal_6:	cal_7:	cal_8:
cal_9:	cal_10:	cal_11:	cal_12:	cal_13:	cal_14:	cal_15:	cal_16:
cal_17:	cal_18:	cal_19:	cal_20:	cal_21:	cal_22:	cal_23:	cal_24:
cal_25:	cal_26:	cal_27:	cal_28:
		asr.w	#2,d0	;	sub.w	#0x3F,d0
lblcal:
1:		cmp.l	nproc,d0 ;	bhi	e_badpc
		asl.l	#3,d0
#if	flow + count + prof
		move.l	d0,d1	;	asl.l	#1,d1
		add.l	d1,d0				!PROC DES. 24 BYTES
#endif
		move.l	(a6),-(sp)
		move.l	4(a6),-(sp) ;	move.l	a3,-(sp)
		link	a2,#0	;	move.l	d0,a0
		add.l	pd,a0				!a0 points at proc. des.
#if	prof+count+flow
		tst.l	20(a0)		!A FILE NAME DEFINED IN THIS PROC
		bne	4f		!YES ? CONTINUE
		move.l	8(sp),20(a0)	!NO ? TAKE OLD FILE NAME
4:		move.l	curproc,8(sp)	!SAVE OLD PROCEDURE DESCRIPTOR
		move.l	a0,curproc	!CONTINUE WITH NEW ONE
		move.l	8(a0),d0	!COUNT POINTER MINUS LINE NUMBER
		sub.l	12(a0),d0	!OF FIRST LINE IN countfld
		move.l	d0,countfld
#endif
		move.l	(a0)+,d1 ;	sub.l	d1,sp
		claimstack	;	add.l	d1,sp
		tst.l	d1	;	beq	3f
		sub.l	#1,d1 	;	asr.l	wmu,d1
2:		mov	und,-(sp) ;	dbra	d1,2b
3:		move.l	(a0),a3 ;	jmp	(a4)

ret_l:		adroff		;	move.w	(a5),d0
		bra	1f
ret_s0:		move.l	#0,d0	;	move.b	(a3)+,d0
1:		blt	e_oddz	;	beq	ret_0
		comp	#32,d0	;	ble	2f
		bsr	e_badlfr
2:		sub.w	#1,d0	;	asr.w	wmu,d0
		bra	5f
ret_1W:		move.l	#0,d0
5:		move.w	d0,retsize			!RETSIZE CONTAINS 
3:		mov	(sp)+,(a5)+ ;	dbra	d0,3b	! #WORDS-1
		lea	retarea,a5 ;	bra	4f
ret_0:		move.w	#-1,retsize
4:		unlk	a2	;	cmp.l	a2,d6
		beq	hlt_z ;	move.l	(sp)+,a3
		move.l	(sp)+,a0		!FILE OR PROC DES BASE IN a0
#if	count+flow+prof
		move.l	a0,curproc		!SAVE PROC DES BASE CUR PROC
		move.l	8(a0),d0		!d0 IS COUNT
		sub.l	12(a0),d0		!d0 IS COUNT-FIRST LINE
		move.l	d0,countfld		!RESTORE POINTER
		beq	1f			!NO LINES IN CALLER
		add.l	(sp),d0			!ADD LINE NUMBER
		move.l	d0,countptr
1:
#if	prof
		beq	5f
		asl.l	#2,d0
		add.l	ltime,d0
		move.l	d0,profile		!profile POINTS AT COUNT 
5:
#endif
		move.l	20(a0),a0		!POINTER TO FILE NAME IN a0
#endif
		move.l	a0,4(a6)			!OLD FILE ADDRESS
		move.l	(sp)+,(a6)			!OLD LINE NUMBER
		jmp	(a4)

lfr_1W:		move.w	d6,d0	;	move.l	wrd,d1
0:		cmp.w	retsize,d0 ;	beq	1f
		bsr	e_badlfr
1:		add.l	d1,a5
2:		mov	-(a5),-(sp) ;	dbra	d0,2b
5:		jmp	(a4)
lfr_l:		move.b	(a3)+,-(sp) ;	move.b	(a3)+,1(sp)
		move.w	(sp)+,d0 ;	bra	3f
lfr_s0:		move.l	d6,d0	;	move.b	(a3)+,d0
3:		move.l	d7,d2	;	move.l	d0,d1
4:		asr.w	#1,d0	;	bcs	e_illins
		dbra	d2,4b	;	beq	5b
		sub.w	#1,d0	;	bra	0b
lfr_2W:		move.l	wrd,d1	;	add.l	d1,d1
		move.l	#1,d0	;	bra	0b

e_badlfr:	mov	#0x1C,-(sp) ;	bra	error
