;----------------------------------------------------------------------
;
; Note for Embedded Pascal users:
;
; The following file is an original copy of the include file found
; with Atmels AVR assembler.
; Embedded Pascal contains extentions to enable this file to be
; used as definition file for both Embedded Pascal assembler and
; compiler.
;
; The file is nearly unchanged but contains extentions to allow
; the Pascal compiler to qualify the purpose of every defined item.
;
; Should you want to use Embedded Pascal to develop code for a
; processor not defined in the available include files shipping
; with Embedded Pascal, you may have to define your own or modify
; the include file you may have obtained from Atmel.
;
; The required changes are very minor and are as follows:
;
; a) Before the section containing IO register definitions place
;    the item .IODEF on a single line starting on the leftmost column
;    Embedded Pascal will interpret these definitions as starting
;    at address $20 to $5F. These will be defined as absolute byte
;    variables.
;    The embedded Pascal assembler will use the addresses as presented
;    starting at $0 to $3F for use with IO instructions.
;
; b) Before the section containing Bit definitions place the item
;    .BITDEF on a single line starting on the leftmost column.
;    Embedded Pascal will interpret these definitions as pointers
;    to bit masks for use with standard Pascal OR, XOR and AND operators.
;    For example if a Bit definition is used as:
;    .EQU TheBit =4, Embedded Pascal will define TWO !! contants
;    "_TheBit" as constant with the value 4 and "__TheBit"
;    with the value $10. (i.e. the fourth bit is set).
;    The Embedded Pascal assembler will use the definition as presented.
;
; c) Before the section containing the interrupt vectors place the
;    item .VECTORS on a single line starting on the leftmost column.
;    Embedded Pascal will not currently use these definitions.
;    You can use these definitions with the Embedded Pascal assembler
;    but ensure that you are going to refer to these items by
;    multiplying the values by 2 as the Embedded Pascal assembler
;    is byte orientated.
;
; d) Before the section containing the item RAMEND place the item
;    .CPUDEF.
;    Embedded Pascal does not use items placed in this section.
;    You can use these items from the Embedded Pascal assembler.
; 
;----------------------------------------------------------------------

;***************************************************************************
;* A P P L I C A T I O N   N O T E   F O R   T H E   A V R   F A M I L Y
;* 
;* Number		:AVR000
;* File Name		:"Tny15def.inc"
;* Title		:Register/Bit Definitions for the Tiny15
;* Date	 		:99.10.30
;* Version		:1.20
;* Support telephone	:+47 72 88 87 20 (ATMEL Norway)
;* Support fax		:+47 72 88 87 18 (ATMEL Norway)
;* Support E-Mail	:avr@atmel.com
;* Target MCU		:Tiny15
;* Modified		: A.J. Vogelaar for PasAvr and T15 on 08-09-01
;*
;* DESCRIPTION
;* When including this file in the assembly program file, all I/O register
;* names and I/O register bit names appearing in the data book can be used.
;* 
;* The Register names are represented by their hexadecimal addresses.
;* 
;* The Register Bit names are represented by their bit number (0-7).
;* 
;* Please observe the difference in using the bit names with instructions
;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc" 
;* (skip if bit in register set/cleared). The following example illustrates
;* this:
;* 
;* in	r16,PORTB		;read PORTB latch
;* sbr	r16,(1<<PB6)+(1<<PB5)	;set PB6 and PB5 (use masks, not bit#)
;* out  PORTB,r16		;output to PORTB
;*
;* in	r16,TIFR		;read the Timer Interrupt Flag Register
;* sbrc	r16,TOV0		;test the overflow flag (use bit#)
;* rjmp	TOV0_is_set		;jump if set
;* ...				;otherwise do something else
;***************************************************************************

;***** Specify Device
.device Tiny15

.IODEF ;Embedded Pascal specific extention

;***** I/O Register Definitions
.equ	SREG	=$3f
.equ	GIMSK	=$3b
.equ    GIFR    =$3a
.equ	TIMSK	=$39
.equ	TIFR	=$38
.equ	MCUCR	=$35
.equ    MCUSR   =$34
.equ	TCCR0	=$33
.equ	TCNT0	=$32
.equ	OSCCAL	=$31
.equ	TCCR1	=$30
.equ	TCNT1	=$2F
.equ	OCR10	=$2E
.equ	OCR11	=$2D
.equ	SFIOR	=$2C
.equ	WDTCR	=$21
.equ	EEAR	=$1E
.equ	EEDR	=$1D
.equ	EECR	=$1C
.equ	PORTB	=$18
.equ	DDRB	=$17
.equ	PINB	=$16
.equ	ACSR	=$08
.equ	ADMUX	=$07
.equ	ADCSR	=$06
.equ	ADC_H	=$05
.equ	ADC_L	=$04

.BITDEF ;Embedded Pascal specific extention

;***** Bit Definitions

; bits in GIMSK
.equ	PCIE	=5
.equ	INT0	=6

; bits in GIFR
.equ	PCIF	=5
.equ	INTF0	=6

; bits in TIMSK
.equ	TOIE0	=1
.equ	TOIE1	=2
.equ	OCIE1	=6

; bits in TIFR
.equ	TOV0	=1
.equ	TOV1	=2
.equ	OCF1	=6

; bits in MCUCR
.equ	ISC00	=0
.equ	ISC01	=1
.equ	SM0	=3
.equ	SM1	=4
.equ	SE	=5
.equ	PUD	=6

; bits in MCUSR
.equ	PORF	=0
.equ	EXTRF	=1
.equ	BORF	=2
.equ	WDRF	=3

; bits in TCCR0
.equ	CS00	=0
.equ	CS01	=1
.equ	CS02	=2

; bits in TCCR1
.equ	CS10	=0
.equ	CS11	=1
.equ	CS12	=2
.equ	CS13	=3
.equ	COM10	=4
.equ	COM11	=5
.equ	PWM1	=6
.equ	CTC1	=7

; bits in SFIOR
.equ	PSR0	=0
.equ	PSR1	=1
.equ	FOC10	=2

; bits in WDTCR
.equ	WDP0	=0
.equ	WDP1	=1
.equ	WDP2	=2
.equ	WDE	=3
.equ	WDTOE	=4

; bits in EECR
.equ	EERE	=0
.equ	EEWE	=1
.equ	EEMWE	=2
.equ	EEIE	=3

; bits in PORTB
.equ	PB0	=0
.equ	PB1	=1
.equ	PB2	=2
.equ	PB3	=3
.equ	PB4	=4

; bits in DDRB
.equ	DDB0	=0
.equ	DDB1	=1
.equ	DDB2	=2
.equ	DDB3	=3
.equ	DDB4	=4

; bits in PINB
.equ	PINB0	=0
.equ	PINB1	=1
.equ	PINB2	=2
.equ	PINB3	=3
.equ	PINB4	=4
.equ	PINB5	=5

; bits in ACSR
.equ	ACIS0	=0
.equ	ACIS1	=1
.equ	ACIE	=3
.equ	ACI	=4
.equ	ACO	=5
.equ	GREF	=6
.equ	ACD	=7

; bits in ADMUX
.equ	MUX0	=0
.equ	MUX1	=1
.equ	MUX2	=2
.equ	REFS0	=6
.equ	REFS1	=7

; bits in ADCSR
.equ	ADPS0	=0
.equ	ADPS1	=1
.equ	ADPS2	=2
.equ	ADIE	=3
.equ	ADIF	=4
.equ	ADFR	=5
.equ	ADSC	=6
.equ	ADEN	=7


.VECTORS ;Embedded Pascal specific extention - Interrupt vector addresses

.equ	INT0addr  =$001	; External Interrupt0
.equ    PinXaddr  =$002	; Pin change interrupt
.equ	Cmp1addr  =$003	; Timer/Counter 1 compare match
.equ	OVF1addr  =$004	; Overflow 1 Interrupt
.equ	OVF0addr  =$005	; Overflow 0 Interrupt
.equ	EeRdyaddr =$006	; EeProm ready
.equ	ACIaddr   =$007	; Analog Comparator
.equ	ADCaddr   =$008	; ADC concersion complete
.equ	ConstSectionaddr = $9 ;Start of typed constant section unless overridden by "PlaceConst" 

.def	ZL	=r30
