336 lines
		
	
	
	
		
			5.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			336 lines
		
	
	
	
		
			5.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| .sect .text
 | |
| .sect .rom
 | |
| .sect .data
 | |
| .sect .bss
 | |
| .sect .text
 | |
| !-----------------------------------------------------------------------------.
 | |
| !		ARRAY GROUP
 | |
| !-------------------------------------------------------------------------------
 | |
| !subroutine
 | |
| calcarr:	move.l	(sp)+,d3	!save return address
 | |
| 		move.l	(sp)+,a0	!address of array describtor
 | |
| 		mov	(sp)+,d0	!index
 | |
| 		subt	(a0)+,d0	!relative address
 | |
| 		blt	9f
 | |
| 		comp	(a0)+,d0	!check upper bound
 | |
| 		bgt	9f
 | |
| 		move.l	#0,d1
 | |
| 		mov	(a0),d1
 | |
| 		mulu	d1,d0		!objectsize in d1
 | |
| 		move.l	(sp)+,a0
 | |
| 		ad	d0,a0		!a0 address of array element
 | |
| 		move.l	d3,-(sp)
 | |
| 		rts
 | |
| 9:		bsr	e_array	;tst.l  (sp)+ ;	jmp	(a4)
 | |
| 
 | |
| aar_1W:		bsr	calcarr	;	move.l	a0,-(sp)
 | |
| 		jmp	(a4)
 | |
| aar_l:		adroff		;	cmp.w	wrd,(a5)
 | |
| 0:		bne	e_illins ;	bra	aar_1W
 | |
| aar_z:		comp	wrd,(sp)+  ;	bra	0b
 | |
| 
 | |
| lar_1W:		bsr	calcarr	;	add.l	d1,a0
 | |
| 		asr.w	#1,d1	;	bcc	5f
 | |
| 		clr.l	d1	;	move.b	-(a0),d1 
 | |
| 		mov	d1,-(sp);	jmp	(a4)
 | |
| 5:
 | |
| #ifdef lword
 | |
| 		asr.w	#1,d1	;	bcc	6f
 | |
| 		move.w	-(a0),d1;	move.l	d1,-(sp)
 | |
| 		jmp	(a4)
 | |
| #endif
 | |
| 6:		sub.l	#1,d1
 | |
| 7:		mov	-(a0),-(sp);	dbra	d1,7b
 | |
| 		jmp	(a4)
 | |
| 
 | |
| lar_l:		adroff		;	cmp.w	wrd,(a5)
 | |
| 8:		bne	e_illins;	bra	lar_1W
 | |
| lar_z:		comp	wrd,(sp)+ ;	bra	8b
 | |
| 
 | |
| sar_1W:		bsr	calcarr	;	asr.w	#1,d1
 | |
| 		bcc	5f	;	testen	(sp)+
 | |
| 		move.b	-1(sp),(a0);	jmp	(a4)
 | |
| 5:
 | |
| #ifdef lword
 | |
| 		asr.w	#1,d1	;	bcc	6f
 | |
| 		tst.w	(sp)+	;	move.w	(sp)+,(a0)
 | |
| 		jmp	(a4)
 | |
| #endif
 | |
| 6:		sub.l	#1,d1
 | |
| 7:		mov (sp)+,(a0)+	;	dbra	d1,7b
 | |
| 		jmp	(a4)
 | |
| sar_z:		comp	wrd,(sp)+ ;	bra	1f
 | |
| sar_l:		adroff		;	cmp.w	wrd,(a5)
 | |
| 1:		bne	e_illins ;	bra	sar_1W
 | |
| 
 | |
| !-------------------------------------------------------------------------
 | |
| !		 CONVERT GROUP
 | |
| !-------------------------------------------------------------------------w
 | |
| 
 | |
| cii_z:		mov	(sp)+,d0 ;	mov	(sp)+,d1 ;  !d0 destination size
 | |
| 							!d1 source size
 | |
| #if test
 | |
| 		cmp.w	wrd,d1	;	bne	0f
 | |
| 		comp	und,(sp) ;	bne	0f
 | |
| 		bsr	e_iund
 | |
| #endif
 | |
| 0:		cmp.w	d0,d1	;	bne	1f	;	jmp (a4)
 | |
| 1:		bge	6f	;	mov	(sp)+,d2
 | |
| 		cmp.w	#1,d1	;	bne	3f		!d1<d0
 | |
| 		ext.w	d2
 | |
| #ifndef lword
 | |
| 		cmp.w	#2,d0	;	bne	3f
 | |
| 		move.w	d2,-(sp);	jmp	(a4)
 | |
| #endif
 | |
| 3:		ext.l	d2	;	move.l	d2,-(sp);	jmp (a4)
 | |
| 6:
 | |
| #ifdef lword
 | |
| 		bsr	e_conv	;	add.l	#4,sp
 | |
| #else
 | |
| 		move.w	(sp)+,d2
 | |
| #if test
 | |
| 		bne	7f	;	tst.w	(sp)	;	bge 9f
 | |
| 8:		bsr	e_conv	;	jmp	(a4)
 | |
| 7:		comp	#-1,d2	;	bne	8b
 | |
| 		tst.w	(sp)	;	bge	8b
 | |
| #endif
 | |
| #endif
 | |
| 9:		jmp	(a4)
 | |
| 
 | |
| cui_z:		mov	(sp)+,d0 ;	mov	(sp)+,d1
 | |
| 		sub.w	d1,d0	;	bne	2f
 | |
| #if test
 | |
| 		testen	(sp)	;	bpl	1f
 | |
| 0:		bsr	e_conv
 | |
| #endif
 | |
| 1:		jmp	(a4)
 | |
| 2:
 | |
| #ifdef lword
 | |
| 		sub.l	d0,sp	;	bsr	e_conv
 | |
| #else
 | |
| 		bgt	3f	;	cmp.w	#-2,d0	;	beq 5f
 | |
| 		bsr	e_conv
 | |
| #if test
 | |
| 		tst.w	(sp)	;	bne	0b
 | |
| 		tst.w	2(sp)	;	bmi	0b
 | |
| #endif
 | |
| 5:		sub.l	#-2,sp	;	jmp	(a4)
 | |
| 3:		cmp.w	#2,d0	;	beq	4f
 | |
| 		bsr	e_conv
 | |
| 4:		clr.w	-(sp)
 | |
| #endif
 | |
| 		jmp	(a4)
 | |
| 
 | |
| ciu_z:		mov	(sp)+,d0 ;	mov	(sp)+,d1
 | |
| #if test
 | |
| 		cmp.w	wrd,d1	;	bne	0f
 | |
| 		comp	und,(sp) ;	bne	0f
 | |
| 		bsr	e_iund
 | |
| #endif
 | |
| 0:		sub.w	d1,d0	;	bne	1f
 | |
| 		jmp	(a4)
 | |
| #ifndef lword
 | |
| 1:		bgt	4f	;	cmp.w	#-2,d0
 | |
| 		beq	5f	;	bsr	e_conv
 | |
| 5:
 | |
| 6:		add.l	#2,sp	;	jmp	(a4)
 | |
| #endif
 | |
| 4:	1:	bclr	#0,d0	;	beq	2f
 | |
| #ifdef lword
 | |
| 		clr.b	2(sp)
 | |
| #else
 | |
| 		clr.b	(sp)
 | |
| #endif
 | |
| 2:		bclr	#1,d0	;	beq	3f
 | |
| #ifdef lword
 | |
| 		clr.w	(sp)
 | |
| #else
 | |
| 		clr.w	-(sp)
 | |
| #endif
 | |
| 3:		jmp	(a4)
 | |
| 
 | |
| cuu_z:		mov	(sp)+,d0 ;	mov	(sp)+,d1
 | |
| 		sub.w	d1,d0	;	bne	1f
 | |
| 		jmp	(a4)
 | |
| 1:
 | |
| #ifdef lword
 | |
| 		bsr	e_conv	;	sub.l	d0,sp
 | |
| #else
 | |
| 		blt	3f
 | |
| #if test
 | |
| 			cmp.w	#2,d0	;	beq	2f
 | |
| 		bsr	e_conv
 | |
| #endif
 | |
| 2:		clr.w	-(sp)	;	jmp	(a4)
 | |
| 3:
 | |
| #if test
 | |
| 		cmp.w	#-2,d0	;	beq	4f
 | |
| 		bsr	e_conv
 | |
| #endif
 | |
| 4:		tst.w	(sp)+
 | |
| #if test
 | |
| 		beq	5f	;	bsr	e_conv
 | |
| #endif
 | |
| #endif
 | |
| 5:		jmp	(a4)
 | |
| 
 | |
| !--------------------------------------------------------------------------
 | |
| #ifdef FLTRAP
 | |
| cuf_z:		cfu_z:		cff_z:		cfi_z:		cif_z:
 | |
| 		mov	(sp)+,d0 ;	subt	(sp)+,d0
 | |
| 		ext.l	d0
 | |
| 		sub.l	d0,sp	
 | |
| 		bra	flnim			!floating point not implemented
 | |
| #else
 | |
| cfu_z:
 | |
| 		clr.l	d0
 | |
| 		mov	(sp)+,d0
 | |
| 		clr.l	d1
 | |
| 		mov	(sp)+,d1
 | |
| 		move.l	d1,-(sp)
 | |
| 		move.l	d0,-(sp)
 | |
| 		checksize
 | |
| 2:
 | |
| 		move.l	#4,(sp)
 | |
| 		cmp	#4,d1
 | |
| 		bne	1f
 | |
| 		jsr	.cfu
 | |
| 		add	#8,sp
 | |
| 2:
 | |
| 		mov	#4,-(sp)
 | |
| 		mov	#2,-(sp)
 | |
| 		bra	cuu_z
 | |
| 1:
 | |
| 		cmp	#8,d1
 | |
| 		beq	1f
 | |
| 		bra	e_oddz
 | |
| 1:
 | |
| 		jsr	.cfu
 | |
| 		add	#12,sp
 | |
| 		bra	2b
 | |
| 4:
 | |
| 		mov	d1,d0
 | |
| 		checkfsize
 | |
| 4:
 | |
| 		jsr	.cfu
 | |
| 		add	#8,sp
 | |
| 		jmp	(a4)
 | |
| 8:
 | |
| 		jsr	.cfu
 | |
| 		add	#12,sp
 | |
| 		jmp	(a4)
 | |
| cfi_z:
 | |
| 		clr.l	d0
 | |
| 		mov	(sp)+,d0
 | |
| 		clr.l	d1
 | |
| 		mov	(sp)+,d1
 | |
| 		move.l	d1,-(sp)
 | |
| 		move.l	d0,-(sp)
 | |
| 		checksize
 | |
| 2:
 | |
| 		move.l	#4,(sp)
 | |
| 		cmp	#4,d1
 | |
| 		bne	1f
 | |
| 		jsr	.cfi
 | |
| 		add	#8,sp
 | |
| 2:
 | |
| 		mov	#4,-(sp)
 | |
| 		mov	#2,-(sp)
 | |
| 		bra	cii_z
 | |
| 1:
 | |
| 		cmp	#8,d1
 | |
| 		beq	1f
 | |
| 		bra	e_oddz
 | |
| 1:
 | |
| 		jsr	.cfi
 | |
| 		add	#12,sp
 | |
| 		bra	2b
 | |
| 4:
 | |
| 		mov	d1,d0
 | |
| 		checkfsize
 | |
| 4:
 | |
| 		jsr	.cfi
 | |
| 		add	#8,sp
 | |
| 		jmp	(a4)
 | |
| 8:
 | |
| 		jsr	.cfi
 | |
| 		add	#12,sp
 | |
| 		jmp	(a4)
 | |
| cuf_z:
 | |
| 		mov	(sp)+,d0
 | |
| 		checkfsize
 | |
| 4:
 | |
| 		mov	(sp)+,d0
 | |
| 		checksize
 | |
| 2:
 | |
| 		clr.l	d0
 | |
| 		move.w	(sp)+,d0
 | |
| 		move.l	d0,-(sp)
 | |
| 4:
 | |
| 		move.l	#4,-(sp)
 | |
| 		jsr	.cuf4
 | |
| 		add	#4,sp
 | |
| 		jmp	(a4)
 | |
| 8:
 | |
| 		mov	(sp)+,d0
 | |
| 		checksize
 | |
| 2:
 | |
| 		clr.l	d0
 | |
| 		move.w	(sp)+,d0
 | |
| 		move.l	d0,-(sp)
 | |
| 4:
 | |
| 		move.l	#4,-(sp)
 | |
| 		jsr	.cuf8
 | |
| 		jmp	(a4)
 | |
| 
 | |
| cif_z:
 | |
| 		mov	(sp)+,d0
 | |
| 		checkfsize
 | |
| 4:
 | |
| 		mov	(sp)+,d0
 | |
| 		checksize
 | |
| 2:
 | |
| 		move.w	(sp)+,d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,-(sp)
 | |
| 4:
 | |
| 		move.l	#4,-(sp)
 | |
| 		jsr	.cif4
 | |
| 		add	#4,sp
 | |
| 		jmp	(a4)
 | |
| 8:
 | |
| 		mov	(sp)+,d0
 | |
| 		checksize
 | |
| 2:
 | |
| 		move.w	(sp)+,d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,-(sp)
 | |
| 4:
 | |
| 		move.l	#4,-(sp)
 | |
| 		jsr	.cif8
 | |
| 		jmp	(a4)
 | |
| 
 | |
| cff_z:
 | |
| 		mov	(sp)+,d0 ;
 | |
| 		checkfsize
 | |
| 4:
 | |
| 		mov	(sp)+,d0 ;	cmp	#4,d0 ;	beq	1f
 | |
| 		cmp	#8,d0	;	beq	2f
 | |
| 		bra	e_oddz
 | |
| 2:
 | |
| 		jsr	.cff4
 | |
| 		add	#4,sp
 | |
| 1:
 | |
| 		jmp	(a4)
 | |
| 8:
 | |
| 		mov	(sp)+,d0 ;	cmp	#8,d0 ;	beq	1f
 | |
| 		cmp	#4,d0 ;		beq	2f
 | |
| 		bra	e_oddz
 | |
| 2:
 | |
| 		move.l	(sp)+,d0
 | |
| 		clr.l	-(sp)
 | |
| 		move.l	d0,-(sp)
 | |
| 		jsr	.cff8
 | |
| 1:
 | |
| 		jmp	(a4)
 | |
| #endif
 |