

S:	MOVE.L	#COP,$DFF080
	BSR	IRQ_SET

EVER:	BTST	#6,$BFE001
	BNE.S	EVER

	MOVE.L	#$22F8,$DFF080
	BSR	IRQ_CLR
	MOVEQ	#0,D0
	RTS

COP:
DC.W	$0180,$0000
DC.W	$FFFE,$FFFF

;팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎


OLDIRQ:	DC.L	$0
OLDENA:	DC.W	$0


MYINT:	MOVE.W	#$200,$DFF180
	CMP.B	#$E0,$DFF006
	BNE.S	MYINT

	MOVEM.L	A0-A6/D0-D7,-(A7)
	MOVE.W	#$36AB,D0	;$3752
	MOVE.B	#$00,$BFEE01	;CTRL A - STOP TIMER A
	MOVE.B	D0,$BFE401	;TIMER A LOW
	LSR.W	#$8,D0
	MOVE.B	D0,$BFE501	;TIMER A HIGH
	MOVE.B	#$81,$BFED01	;IRQ CTRLREG - SET IRQ FROM TIMER A
	MOVE.B	#$11,$BFEE01	;- START TIMER A

	MOVE.W	#$444,$DFF180

ENDINT:	MOVE.B	$BFED01,D0		;IRQCONTROL
	MOVE.W	#$0008,$DFF09C
	MOVEM.L	(A7)+,A0-A6/D0-D7
	RTE

RTE:	TST.B	$BFDD00
	TST.B	$BFED01
	MOVE.W	#$3FFF,$DFF09C
	RTE

IRQ_SET:MOVE.W	$DFF01C,D0
	OR.W	#$C000,D0
	MOVE.W	D0,OLDENA
	MOVE.W	#$7FFF,$DFF09A
	MOVE.W	#$000F,$DFF096
	MOVE.W	#$3781,D0	;$3E8
	MOVE.B	#$00,$BFEE01	;CTRL A - STOP TIMER A
	MOVE.B	D0,$BFE401	;TIMER A LOW
	LSR.W	#$8,D0
	MOVE.B	D0,$BFE501	;TIMER A HIGH
	MOVE.B	#$81,$BFED01	;IRQ CTRLREG - SET IRQ FROM TIMER A
	MOVE.B	#$11,$BFEE01	;- START TIMER A
	MOVE.L	$68.W,OLDIRQ
	MOVE.L	#MYINT,$68.W
	MOVE.W	#$83F0,$DFF096
	MOVE.W	#$C008,$DFF09A
	RTS

IRQ_CLR:MOVE.W	#$7FFF,$DFF09A
	MOVE.L	OLDIRQ,$68.W
	MOVE.W	OLDENA,$DFF09A
	RTS

