;AutoVIDC module source - constants definitions
;----------------------------------------------
;
;VIDC Enhancer software control
;For software controlled VIDC Enhancers
;
;Author: Andreas Barth (1995)
;Author: Paul Vernon (Retro-Kit) (2012-2013)
;   www: http://www.retro-kit.co.uk

; ---------------------------------------------------------------------------
#set	ReadUnsignedFlags	= %00100000000000000000000000001010

; internal_flags
;                          76543210
#set	RISCOS3		= %00000001		; 0=RISC OS 3, 1=RISC OS 2
#set	EnhancerNeeded	= %00000010		; Set whether a VIDC Enhancer is required
#set	ROinControl	= %00000100		; 0=RISC OS is controlling the VIDC Enhancer
#set	ROcanControl	= %00001000		; 0=RISC OS is capable of changing the VIDC clock
#set	InvertSync	= %00010000		; 0=inverse Sync needs writing to P6/P7
#set	IIC25MHzFitted	= %00100000		; 1=WE Enhancer has a 25.175MHz clock
#set	RISCOS310orNewer= %01000000		; 0=RISC OS 3.01 or newer, 1=RISC OS 3.00 or earlier
#set	EnhancerDetected= %10000000

; ---------------------------------------------------------------------------

; Set up some default values for the Aux IO hardware
; and default the module to being enabled but with
; the over-clocking facility being disabled.

#set 	LatBShadow	= &105		; contains Value of LatchB - zero page SoftCopy
#set	LatchBase	= &03350000
#set	LatchB		= &03350018-LatchBase	; Hardware address of LatchB
#set	VIDCLatch	= &03350048-LatchBase	; Hardware address of the VIDC registers

#set	IOCbase		= &03200000		; IOC Base address
#set	VIDCbase	= &03400000		; VIDC Base address
#set	MEMCbase	= &03600000		; MEMC Base address

#set	PageZero	= 0
#set	PageZero1000	= &1000
#set	VIDCclockspeed	= &1228-PageZero1000	; Stores a copy of the VIDC clock speed in kHz
#set	VIDCControlCopy = &1584-PageZero1000	; Stores a copy of the VIDC control register

; ---------------------------------------------------------------------------
; Set the values to set lines Aux 1 and Aux2 so
; depending on which mode list matches the current
; mode, we can enable the correct VIDC Enhancer.

#set	Aux1Bitmask	= %00100000	; Define the bitmask for Aux 1
#set	Aux2Bitmask	= %01000000	; Define the bitmask for Aux 2
#set	Aux12Bitmask	= %01100000	; Define the bitmask for Aux 1 & 2

; ---------------------------------------------------------------------------
; Define the I2C base addresses for the WE 'Super' VIDC Enhancers

#set	IICAddress_Watford_VIDC_Extender1	= &40
#set	IICAddress_Watford_VIDC_Extender2	= &70

; ---------------------------------------------------------------------------
; Define the type of VIDC Enhancer
#set	WatfordType	= 2
#set	AuxIOType	= 1
#set	NativeType	= 0

; ---------------------------------------------------------------------------
; Define the minimum RISC OS clock speed in kHz
#set	VIDCclkMIN 	= 24000
; Define a maximum value for the overclocked oscillator...
#set	VIDCclkMAX	= 60000

; ---------------------------------------------------------------------------
; define constants for the clock speed detection code
#set	uS_vidc		= 5				;(1/200KHz)*1000000 = 5uS / sample
#set	DMAbufferSize	= 512
; work out the number of T1 (2MHz) ticks one DMA buffer should take
#set	bufferLengthT1	= DMAbufferSize*uS_vidc*2	;ie 5120 ticks
; ---------------------------------------------------------------------------
; Define AutoVIDC SWI's so we can compile without AutoVIDC being loaded.

#set AutoVIDC_SetClock               = &59380
#set AutoVIDC_DelegateControl        = &59381
#set AutoVIDC_IsDelegated            = &59382
#set AutoVIDC_IsOverClockingEnabled  = &59383
#set AutoVIDC_ModeSyncPolarity       = &59384
#set AutoVIDC_ReInit		     = &59385
#set AutoVIDC_ClockAvailable         = &59386
#set AutoVIDC_EnhancerPresent        = &59387
#set AutoVIDC_EnhancerType	     = &59388

#set XAutoVIDC_SetClock              = &59380 + &20000
#set XAutoVIDC_DelegateControl       = &59381 + &20000
#set XAutoVIDC_IsDelegated           = &59382 + &20000
#set XAutoVIDC_IsOverClockingEnabled = &59383 + &20000
#set XAutoVIDC_ModeSyncPolarity      = &59384 + &20000
#set XAutoVIDC_ReInit		     = &59385 + &20000
#set XAutoVIDC_ClockAvailable        = &59386 + &20000
#set XAutoVIDC_EnhancerPresent       = &59387 + &20000
#set XAutoVIDC_EnhancerType	     = &59388 + &20000

#end
