		NOLIST

*AUTO:		smake MCalc

		opt o+,ow-,o6+,DEBUG,NOLIST,ALINK

;* $Revision Header built automatically *************** (do not edit) ************
;*
;* © Copyright by GuntherSoft
;*
;* File             : SnakeSYS:CPrgs/MUICalc/MCalc.asm
;* Created on       : Sunday, 03.10.93 23:16:55
;* Created by       : Kai Iske
;* Current revision : V1.0
;*
;*
;* Purpose
;* -------
;*   - Small (very very small) support routines for MCalc ;)
;*
;* Revision V1.0
;* --------------
;* created on Sunday, 03.10.93 23:16:55  by  Kai Iske.   LogMessage :
;*     --- Initial release ---
;*
;*********************************************************************************


		XDEF	_MyASL
		XDEF	_MyASR
		XDEF	_MyLSL
		XDEF	_MyLSR
		XDEF	_MyROL
		XDEF	_MyROR
		XDEF	_MyXOR
		XDEF	_MyNAND
		XDEF	_MyNOR
		XDEF	_MyNXOR
		XDEF	_DoCreatePool
		XDEF	_DoDeletePool
		XDEF	_AllocVecPool
		XDEF	_FreeVecPool

		XREF	_IntBase
		XREF	_AsmCreatePool
		XREF	_AsmDeletePool
		XREF	_AsmAllocPooled
		XREF	_AsmFreePooled

_MyASL		tst.l	d1
		beq.s	.End
		subq.l	#1,d1
.Loop		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		asl.b	#1,d0
		bra.s	.LoopEnd
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		asl.w	#1,d0
		bra.s	.LoopEnd
.Try32		asl.l	#1,d0
.LoopEnd	dbf	d1,.Loop
.End		rts


_MyASR		tst.l	d1
		beq.s	.End
		subq.l	#1,d1
.Loop		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		asr.b	#1,d0
		bra.s	.LoopEnd
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		asr.w	#1,d0
		bra.s	.LoopEnd
.Try32		asr.l	#1,d0
.LoopEnd	dbf	d1,.Loop
.End		rts


_MyLSL		tst.l	d1
		beq.s	.End
		subq.l	#1,d1
.Loop		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		lsl.b	#1,d0
		bra.s	.LoopEnd
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		lsl.w	#1,d0
		bra.s	.LoopEnd
.Try32		lsl.l	#1,d0
.LoopEnd	dbf	d1,.Loop
.End		rts


_MyLSR		tst.l	d1
		beq.s	.End
		subq.l	#1,d1
.Loop		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		lsr.b	#1,d0
		bra.s	.LoopEnd
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		lsr.w	#1,d0
		bra.s	.LoopEnd
.Try32		lsr.l	#1,d0
.LoopEnd	dbf	d1,.Loop
.End		rts


_MyROL		tst.l	d1
		beq.s	.End
		subq.l	#1,d1
.Loop		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		rol.b	#1,d0
		bra.s	.LoopEnd
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		rol.w	#1,d0
		bra.s	.LoopEnd
.Try32		rol.l	#1,d0
.LoopEnd	dbf	d1,.Loop
.End		rts


_MyROR		tst.l	d1
		beq.s	.End
		subq.l	#1,d1
.Loop		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		ror.b	#1,d0
		bra.s	.LoopEnd
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		ror.w	#1,d0
		bra.s	.LoopEnd
.Try32		ror.l	#1,d0
.LoopEnd	dbf	d1,.Loop
.End		rts


_MyXOR		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		eor.b	d1,d0
		bra.s	.End
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		eor.w	d1,d0
		bra.s	.End
.Try32		eor.l	d1,d0
.End		rts


_MyNAND		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		not.b	d1
		and.b	d1,d0
		bra.s	.End
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		not.w	d1
		and.w	d1,d0
		bra.s	.End
.Try32		not.l	d1
		and.l	d1,d0
.End		rts


_MyNOR		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		not.b	d1
		or.b	d1,d0
		bra.s	.End
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		not.w	d1
		or.w	d1,d0
		bra.s	.End
.Try32		not.l	d1
		or.l	d1,d0
.End		rts


_MyNXOR		cmp.w	#7,_IntBase(a4)
		bne.s	.Try16
		not.b	d1
		eor.b	d1,d0
		bra.s	.End
.Try16		cmp.w	#8,_IntBase(a4)
		bne.s	.Try32
		not.w	d1
		eor.w	d1,d0
		bra.s	.End
.Try32		not.l	d1
		eor.l	d1,d0
.End		rts




_DoCreatePool	move.l	a6,-(sp)
		move.l	$4.w,a6
		jsr	_AsmCreatePool
		move.l	(sp)+,a6
		rts
_DoDeletePool	move.l	a6,-(sp)
		move.l	$4.w,a6
		jsr	_AsmDeletePool
		move.l	(sp)+,a6
		rts


_AllocVecPool	movem.l	d1/a0/a6,-(sp)
		addq.l	#4,d0
		move.l	d0,-(sp)
		move.l	$4.w,a6
		jsr	_AsmAllocPooled
		move.l	(sp)+,d1
		tst.l	d0
		beq.s	.Error
		move.l	d0,a0
		move.l	d1,(a0)+
		move.l	a0,d0
.Error		movem.l	(sp)+,d1/a0/a6
		rts
_FreeVecPool	move.l	a6,-(sp)
		move.l	-(a1),d0
		move.l	$4.w,a6
		jsr	_AsmFreePooled
		move.l	(sp)+,a6
		rts
