.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
!------------------------------------------------------------------------------
!		UNSIGNED ARITHMETIC
!-----------------------------------------------------------------------------

adu_z:		mov	(sp)+,d0 ;	bra	0f
adu_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d1 ;	add.w	d1,(sp)
		jmp	(a4)
4:		move.l	(sp)+,d1;	add.l	d1,(sp)
		jmp	(a4)

sbu_z:		mov	(sp)+,d0 ;	bra	0f
sbu_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d1 ;	sub.w	d1,(sp)
		jmp	(a4)
4:		move.l	(sp)+,d1 ;	sub.l	d1,(sp)
		jmp	(a4)

!------------------------------------------------------------------------------

mlu_z:		mov	(sp)+,d0 ;	bra	0f
mlu_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d0 ;	mulu	(sp),d0
		move.w	d0,(sp)	;	jmp	(a4)
4:		move.l	(sp)+,d0 ;	move.l	(sp),d1
		bsr	mlu4	;	move.l	d0,(sp)
		jmp	(a4)

!----------------------------------------------------------------------------

dvu_z:		mov	(sp)+,d0 ;	bra	0f
dvu_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d1 ;	beq	3f
		move.w	(sp),d0 ;	divu	d1,d0
		move.w	d0,(sp) ;	jmp	(a4)
3:		bsr	e_idivz	;	move.w	#-1,(sp)
		jmp	(a4)
4:		move.l	(sp)+,d0 ;	move.l	(sp),d1
		bsr	dvu4	;	move.l	d1,(sp)
		jmp	(a4)

!----------------------------------------------------------------------------

rmu_z:		mov	(sp)+,d0 ;	bra	0f
rmu_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d1 ;	beq	3f
		move.w	(sp),d0 ;	divu	d1,d0
		swap	d0	;	move.w	d0,(sp)
		jmp	(a4)
3:		bsr	e_idivz	;	clr.w	(sp)
		jmp	(a4)
4:		move.l	(sp)+,d0 ;	move.l	(sp),d1
		bsr	dvu4	;	move.l	d3,(sp)
		jmp	(a4)

!------------------------------------------------------------------------.

slu_z:		mov	(sp)+,d0 ;	bra	0f
slu_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d0 
		bmi	7f
3:		move.w	(sp),d1
		lsl.w	d0,d1	;	move.w	d1,(sp)
		jmp	(a4)
4:		mov	(sp)+,d0 
		bmi	9f
5:		move.l	(sp),d1
		lsl.l	d0,d1	;	move.l	d1,(sp)
		jmp	(a4)

7:		neg.w	d0	;	bra	3f
9:		nega	d0	;	bra	5f
7:		neg.w	d0	;	bra	3b
9:		nega	d0	;	bra	5b

sru_z:		mov	(sp)+,d0 ;	bra	0f
sru_l:		adroff		;	move.w	(a5),d0
0:		checksize
2:		move.w	(sp)+,d0 
		bmi	7b
3:		move.w	(sp),d1
		lsr.w	d0,d1	;	move.w	d1,(sp)
		jmp	(a4)
4:		mov	(sp)+,d0 
		bmi	9b
5:		move.l	(sp),d1
		lsr.l	d0,d1	;	move.l	d1,(sp)
		jmp	(a4)

!------------------------------------------------------------------------------
!	DUMMY FLOATING POINT ROUTINES
!------------------------------------------------------------------------------
adf_l:
		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		jsr	.adf4
		add.l	#4,sp
		jmp	(a4)
8:
		jsr	.adf8
		add.l	#8,sp
		jmp	(a4)
#endif
adf_z:
		mov	(sp)+,d0 ;	bra	1b
adf_s0:
		move.l	#0,d0	;	move.b	(a3)+,d0
		bra	1b

sbf_l:
		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		jsr	.sbf4
		add.l	#4,sp
		jmp	(a4)
8:
		jsr	.sbf8
		add.l	#8,sp
		jmp	(a4)
#endif
sbf_z:
		mov	(sp)+,d0 ;	bra	1b
sbf_s0:
		move.l	#0,d0	;	move.b	(a3)+,d0
		bra	1b

mlf_l:
		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		jsr	.mlf4
		add.l	#4,sp
		jmp	(a4)
8:
		jsr	.mlf8
		add.l	#8,sp
		jmp	(a4)
#endif
mlf_z:
		mov	(sp)+,d0 ;	bra	1b
mlf_s0:
		move.l	#0,d0	;	move.b	(a3)+,d0
		bra	1b

dvf_l:
		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		jsr	.dvf4
		add.l	#4,sp
		jmp	(a4)
8:
		jsr	.dvf8
		add.l	#8,sp
		jmp	(a4)
#endif
dvf_z:
		mov	(sp)+,d0 ;	bra	1b
dvf_s0:
		move.l	#0,d0	;	move.b	(a3)+,d0
		bra	1b

ngf_l:		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		jsr	.ngf4
		jmp	(a4)
8:
		jsr	.ngf8
		jmp	(a4)
#endif
ngf_z:
		mov	(sp)+,d0 ;	bra	1b

fif_l:		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		move.l	sp,-(sp)
		jsr	.fif4
		add.l	#4,sp
		jmp	(a4)
8:
		move.l	sp,-(sp)
		jsr	.fif8
		add.l	#4,sp
		jmp	(a4)
#endif
fif_z:
		mov	(sp)+,d0 ;	bra	1b

fef_l:		adroff		;	move.w	(a5),d0
1:
#ifdef FLTRAP
		bra	flnim
#else
		checkfsize
4:
		move.l	sp,-(sp)
		sub.l	#4,(sp)
		jsr	.fef4
#ifndef lword
		add.l	#2,sp
#endif		
		jmp	(a4)
8:
		move.l	sp,-(sp)
		sub.l	#4,(sp)
		jsr	.fef8
#ifndef lword
		add.l	#2,sp
#endif		
		jmp	(a4)
#endif
fef_z:		mov	(sp)+,d0 ;	bra	1b
