שתשת  h  h  h  h  h  h  h  h  h  h***********************************************************
*************        Startup Base 2.7        **************
***********************************************************
*************     Coded by Manta/Elven11     **************
*************      - since xx/II/1993 -      **************
***********************************************************

FINAL		set	0
Recurse		set	0
Supervisor	set	0
LM		set	0
RC		set	~FINAL&1

	SECTION	Base,CODE
;==============================================================================

	jmp	_Start
*******************************************************************************
	incdir	"Startup:"
	include	"Startup.i"
	cnop	0,4
_NewAutoVecs:
	dc.l	0
	dc.l	0
	dc.l	Lv3Handler
	dc.l	0
	dc.l	0
	dc.l	0
	dc.l	0
;--------------------------------------
;	include	"FPUStartup.i"
;	cnop	0,4
;_FPU_NewFPUExceptions:
;	dc.l	_Base_Restore
;	dc.l	_Base_Restore
;	dc.l	_Base_Restore
;	dc.l	_Base_Restore
;	dc.l	_Base_Restore
;	dc.l	_Base_Restore
;	dc.l	_Base_Restore
***************************************
	incdir	"Startup:Handlers/"
;	include	"Level1Handler.i"
;	include	"Level2Handler.i"
	include	"Level3Handler.i"
;	include	"Level4Handler.i"
;	include	"Level5Handler.i"
;	include	"Level6Handler.i"

***************************************
********  Macros & Includes  **********
***************************************

	incdir	"Startup:"
	include	"Tools.i"

*******************************************************************************

_Start:
;	bsr.w	_FPU_Startup
	bsr.w	_Precalc
_Base_Init:
	bsr.w	_Startup
	bsr.w	_MainCode
_Base_Restore:
	bsr.w	_Quit
;	bsr.w	_FPU_Quit
	IFEQ	FINAL
	OUTPUTRASTERS
	ELSE
	moveq	#0,d0
	ENDC
	rts


*******************************************************************************
*******************************  Main Code  ***********************************
*******************************************************************************

_MainCode:
;--------------------------------------
DMACon	equ	%1000001110000000	;Bpls-Copper
;----------------*----**++-------------	;[BlitNasty]
IntEna	equ	%1100000000100000	;VblIRQ
;----------------**--------+-----------
ADkCon	equ	%0111111111111111	;(NONE - OFF)
	;	 ----------------------
	;	 FEDCBA9876543210
;--------------------------------------
Win0W	equ	320
Win0H	equ	256
XStart0	equ	$80+320/2-Win0W/2
YStart0	equ	$2c+256/2-Win0H/2
XStop0	equ	XStart0+Win0W
YStop0	equ	YStart0+Win0H
Bpl0W	equ	320/8
Bpl0H	equ	256
Bpl0D	equ	1
;--------------------------------------
Base106_0	equ	$0c20
Base10c_0	equ	$0011
;--------------------------------------

	INITR
	move.l	#CList,$80(a6)
	move.w	d0,$88(a6)
	bsr.w	WaitVBl
	move.w	#ADkCon,$9e(a6)
	move.w	#DMACon,$96(a6)
	move.w	#$7fff,$9c(a6)
	move.w	#IntEna,$9a(a6)
	move.l	#CList0,$dff080
	WLMB
	rts

*******************************************************************************

_Precalc:
	CLRRAM	Scr0,Bpl0W*Bpl0H*Bpl0D
	COPPTS	Cop0Scr0Pts,Scr0,Bpl0W*Bpl0H,Bpl0D
	rts


*******************************************************************************
***************************  Custom SubRoutines  ******************************
*******************************************************************************


*******************************************************************************
*****************************  Interrupt Code  ********************************
*******************************************************************************

***************************************
*******  Level1 Interrupt Code  *******
***************************************

	cnop	0,8
_TBEIRq:
	move.w	#$0001,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_DskBlkIRq:
	move.w	#$0002,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_SoftIRq:
	move.w	#$0004,$dff09c
;--------------------------------------
	rts


***************************************
*******  Level2 Interrupt Code  *******
***************************************

	cnop	0,8
_PortsIRq:
	move.w	#$0008,$dff09c
;--------------------------------------
	rts


***************************************
*******  Level3 Interrupt Code  *******
***************************************

	cnop	0,8
_CoperIRq:
	move.w	#$0010,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_VertBIRq:
	move.w	#$0020,$dff09c
;--------------------------------------
	IFEQ	FINAL
	INCRASTERS
	JLRMB	_Base_Restore
	ENDC
	rts
***************************************
	cnop	0,8
_BlitIRq:
	move.w	#$0040,$dff09c
;--------------------------------------
	rts


***************************************
*******  Level4 Interrupt Code  *******
***************************************

	cnop	0,8
_Aud0IRq:
	move.w	#$0080,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_Aud1IRq:
	move.w	#$0100,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_Aud2IRq:
	move.w	#$0200,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_Aud3IRq:
	move.w	#$0400,$dff09c
;--------------------------------------
	rts


***************************************
*******  Level5 Interrupt Code  *******
***************************************

	cnop	0,8
_RBFIRq:
	move.w	#$0800,$dff09c
;--------------------------------------
	rts
***************************************
	cnop	0,8
_DskSyncIRq:
	move.w	#$1000,$dff09c
;--------------------------------------
	rts


***************************************
*******  Level6 Interrupt Code  *******
***************************************

	cnop	0,8
_ExterIRq:
	move.w	#$2000,$dff09c
;--------------------------------------
	rts


***************************************
*******  Level7 Interrupt Code  *******
***************************************

	cnop	0,8
_NMIIRq:
	rte


*******************************************************************************
********************************  Custom Data  ********************************
*******************************************************************************

;==============================================================================

*******************************************************************************

	SECTION	CopperLists,DATA_C
;==============================================================================

	cnop	0,8
CList:
	dc.w	$0100,$0000
	dc.l	$fffffffe

***************************************

	cnop	0,8
CList0:
	DIWSTRT	DIWStrt0,XStart0*4,YStart0
	DIWSTOP	DIWStop0,XStop0*4,YStop0
	DIWHIGH	DIWHigh0,XStart0*4,YStart0,XStop0*4,YStop0
DDFStrt0	equ	XStart0/2-8
DDFStop0	equ	DDFStrt0+Win0W/2-8

	dc.w	$008e,DIWStrt0,$0090,DIWStop0,$01e4,DIWHigh0
	dc.w	$0092,DDFStrt0,$0094,DDFStop0-32
	dc.w	$0100,(Bpl0D&%111)<<12!((Bpl0D>>3)<<4)!$201
	COP102	XStart0*4
	dc.w	$0104,$0000
	dc.w	$0106,Base106_0
	dc.w	$010c,Base10c_0
	dc.w	$0108,$0000,$010a,$0000
	dc.w	$01dc,$0020
	dc.w	$01fc,$0003
Cop0Scr0Pal:
	COPPAL	2^bpl0d,base106_0

	COPWAIT	ystart0-1,$01
Cop0Scr0Pts:
	COPREGS	$e0,bpl0d

	dc.l	$fffffffe

;==============================================================================

	SECTION	Screens,BSS_C
;==============================================================================

	cnop	0,8
Scr0:	ds.b	Bpl0W*Bpl0H*Bpl0D
