
*
*	(c) Copyright 1995-2001 Grzegorz Calkowski
*
*	This file is part of SysPic.
*
*	SysPic  is free software; you can redistribute it and/or modify
*	it under the terms of the GNU General Public License as published by
*	the Free Software Foundation; either version 2, or (at your option)
*	any later version.
*
*	Bison is distributed in the hope that it will be useful,
*	but WITHOUT ANY WARRANTY; without even the implied warranty of
*	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*	GNU General Public License for more details.
*
*	You should have received a copy of the GNU General Public License
*	along with Bison; see the file COPYING.  If not, write to
*	the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*

		opt alink

		INCDIR	"asminc:"

		INCLUDE "exec/types.i"
		INCLUDE "hardware/custom.i"
		INCLUDE "hardware/dmabits.i"
		INCLUDE "intuition/intuitionbase.i"
		INCLUDE	"dos/dos.i"

		INCLUDE	"lvo30/exec_lib.i"

		INCLUDE	"gcmacros_new.i"

		XREF	_keepptr,_fadein,_fadeout,_wbfadein,_testscrflag
		XREF	_IntuitionBase,_SysBase
		XREF	_scr,_syspictask
		XREF	_clocktask,_clockupd_sigmask,_clockenable

		XREF	_fadein_kludge,_fadeout_kludge,_wbfadein_kludge

	        XDEF    _SysPic_Server

* Entered with:       A0 == scratch (execpt for highest pri vertb server)
*  D0 == scratch      A1 == is_Data
*  D1 == scratch      A5 == vector to interrupt code (scratch)
*                     A6 == scratch
*

_SysPic_Server
		tst.b	_testscrflag
		beq.s	.sigclock

		move.l	_IntuitionBase,a0
		move.l	_scr,d0
		cmp.l	ib_FirstScreen(a0),d0
		beq.s	.sigclock

		move.l	_SysBase,a6
		move.l	_syspictask,a1
		move.l	#SIGBREAKF_CTRL_D,d0
		call	Signal

.sigclock	tst.b	_clockenable
		beq.s	.noclock

		move	.clockcnt(pc),d0
		addq	#1,d0
		and	#$7,d0
		move	d0,.clockcnt
		bne.s	.noclock

		move.l	_SysBase,a6
		move.l	_clocktask,a1
		move.l	_clockupd_sigmask,d0
		call	Signal

.noclock	lea	$dff000,a0

		tst.b	_keepptr
		bne.s	.keepptr
		
		move	#DMAF_SPRITE,$96(a0)
		lea	.spr(pc),a6
		move.l	a6,d0
		move	d0,$142(a0)
		swap	d0
		move	d0,$140(a0)
		move	#0,$146(a0)

.keepptr	tst.b	_fadein
		beq.s	.nofadein
		jsr	_fadein_kludge
		bra.s	.exit

.nofadein	tst.b	_fadeout
		beq.s	.nofadeout
		jsr	_fadeout_kludge
		bra.s	.exit

.nofadeout	tst.b	_wbfadein
		beq.s	.exit
		jsr	_wbfadein_kludge
		
.exit		moveq	#0,d0	; set Z flag to continue to process other vb-servers
	        rts

.clockcnt	dc.w	0
.spr		dc.l	0,0
        
;custom.spr[0].dataa = custom.spr[0].datab = 0;        
        end



