;----------------------------------------------------------------------
;
; 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		:"Tny11def.inc"
;* Title		:Register/Bit Definitions for the Tiny11
;* 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		:Tiny11
;*
;* 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 Tiny11

.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	WDTCR	=$21
.equ	PORTB	=$18
.equ	DDRB	=$17
.equ	ACSR	=$08

.BITDEF ;Embedded Pascal specific extention

;***** Bit Definitions

; bits in GIMSK
.equ	INT0	=6

; bits in TIMSK
.equ	TOIE0	=1

; bits in TIFR
.equ	TOV0	=1

; bits in MCUCR
.equ	SE	=5
.equ	SM	=4
.equ	ISC01	=1
.equ	ISC00	=0

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

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

; bits in EECR
.equ	EEWE	=1
.equ	EERE	=0

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

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

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

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

.VECTORS ;Embedded Pascal specific extention

.equ	INT0addr=$001	;External Interrupt0 Vector Address
.equ    PinXaddr=$002	;Pin change interrupt Vector Address
.equ	OVF0addr=$003	;Overflow 0 Interrupt Vector Address
.equ	ACIaddr =$004	;Analog Comparator Interrupt Vector Address
.equ	ConstSectionaddr = $5 ;Start of typed constant section unless overridden by "PlaceConst" 

.def	ZL	=r30
