;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 2000 - 2002 TIMEX Corporation.
; 
; This document is the property of, and contains information proprietary to
; TIMEX Corporation.  It is to be returned upon request.  Reproduction by any
; means, disclosure, or use of its contents for other than the expressed
; purpose for which it is loaned, without the written consent of TIMEX
; Corporation, is strictly prohibited.
;
; File Name :   todvars.h
;
; Purpose   :   TOD Application Variable Offsets
;
; File Change History:
;
;               05/16/2000 NLS - Created todvars.h for m841
;
;   M851 Development:
;
;               11/12/2001 FSU - Modified for M851 development.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;==============================================================================
;
; TOD APPLICATION SYSTEM DATA
;
;==============================================================================

TODSYSTEMDATASTARTOFFSET        equ     0

;------------------------------------------------------------------------------
; TOD Resource Index Variables (BASE OFFSET MUST BE ZERO)
;------------------------------------------------------------------------------

;TOD Resource lists
TODRESOURCEINDEX0OFFSET         equ     0                   ; Index to TZ1 resource.
TODRESOURCEINDEX1OFFSET         equ     1                   ; Index to TZ2 resource.
TODRESOURCEINDEX2OFFSET         equ     2                   ; Index to TZ3 resource.

TODSYSTEMDATASIZE               equ     3


;==============================================================================
;
; TOD APPLICATION DATABASE
;
;  TOD Naming convention:
;
;  TODT1xxx - dealing with Time Zone 1 (T1) only
;  TODT2xxx - dealing with Time Zone 2 (T2) only
;  TODT3xxx - dealing with Time Zone 3 (T3) only
;  TODxxx   - dealing with Time Zone 1 (T1) and/or Time Zone 2 (T2) and/or 
;             Time Zone 3 (T3)
;
;==============================================================================

TODDATABASESTARTOFFSET          equ     TODSYSTEMDATASIZE

; 3 is added to the heap top coz the first three bytes was used to store the resource index
;   used by TOD app.
TODADDStartAddress              equ     (COREHeapTop + 3)

;------------------------------------------------------------------------------
; TZx TOD Data structure
;------------------------------------------------------------------------------

 TODFORMATOFFSET                equ     0

    bTODDateFormat0             equ     00000001B           ; b0 & b1: 00 - DMY
    bTODDateFormat1             equ     00000010B           ;        : 01 - YMD
                                                            ;        : 10 - MDY
                                                                                 
    bTOD24HourFormat            equ     00000100B           ; b2     : 0 - 12HR
                                                            ;        : 1 - 24HR

    bTODWeekNumber              equ     00001000B           ; b3     : 0 - DOW
                                                            ;        : 1 - Week Number

    bTODTZInDST                 equ     00010000B           ; b4     : 0 - TZ is not in DST.
                                                            ;        : 1 - TZ is in DST.
                                                            ; (For PC Use)

    bTODEuroFormat              equ     00100000B           ; b5     : 0 - US format.
                                                            ;        : 1 - European format.

    bTODObserveDST              equ     01000000B           ; b6     : 0 - TZ did not observe DST.
                                                            ;        : 1 - TZ observes DST. 
                                                            ; (For PC Use)

    bTODTZSetFlag               equ     10000000B           ; b7     : 1 - TZx has entered set state.

 TODCITYNAME0OFFSET             equ     1   
 TODCITYNAME1OFFSET             equ     2
 TODCITYNAME2OFFSET             equ     3
 TODTZIDOFFSET                  equ     4                   ; This will only be used by the PC for
                                                            ;   WorldTime Wristapp

;------------------------------------------------------------------------------
; TZ 1 TOD Data structure
;------------------------------------------------------------------------------

TODTZ1Format                    equ     (COREHeapTop + 3)
TODTZ1CityName0                 equ     (COREHeapTop + 4)
TODTZ1CityName1                 equ     (COREHeapTop + 5)
TODTZ1CityName2                 equ     (COREHeapTop + 6)
TODTZ1ID                        equ     (COREHeapTop + 7)

;------------------------------------------------------------------------------
; TZ 2 TOD Data structure
;------------------------------------------------------------------------------

TODTZ2Format                    equ     (COREHeapTop + 8 )
TODTZ2CityName0                 equ     (COREHeapTop + 9 )
TODTZ2CityName1                 equ     (COREHeapTop + 10)
TODTZ2CityName2                 equ     (COREHeapTop + 11)
TODTZ2ID                        equ     (COREHeapTop + 12) 

;------------------------------------------------------------------------------
; TZ 3 TOD Data structure
;------------------------------------------------------------------------------

TODTZ3Format                    equ     (COREHeapTop + 13)
TODTZ3CityName0                 equ     (COREHeapTop + 14)
TODTZ3CityName1                 equ     (COREHeapTop + 15)
TODTZ3CityName2                 equ     (COREHeapTop + 16)
TODTZ3ID                        equ     (COREHeapTop + 17)

TODADDEndAddress                equ     (COREHeapTop + 18)

TODDATABASEDATASIZE             equ     (TODADDEndAddress - TODADDStartAddress)


TODHEAPSIZEREQUIREMENTS         equ     (TODSYSTEMDATASIZE + TODDATABASEDATASIZE)




;==============================================================================
;
; VARIABLE REDEFINITIONS
;
;==============================================================================

;------------------------------------------------------------------------------
; TOD COMMON SYSTEM DATA (Used only during foreground execution)
;------------------------------------------------------------------------------

; Storage for the type of timeout being tracked.  Refer to tod.h for the timeout arguments.
TODTimeoutArgument              equ     (COREForegroundCommonBuffer + 0)

TODKeyDepressed                 equ     (COREForegroundCommonBuffer + 1)

; The field being set. Refer to tod.h for the setting items.
TODCurrentSetPosition           equ     (COREForegroundCommonBuffer + 2)

; Type of application to be peeked at.
TODPeekAppType                  equ     (COREForegroundCommonBuffer + 3)

; Index of the TZ being displayed.      
TODTZIndex                      equ     (COREForegroundCommonBuffer + 4)        

; Format flag of the TZ being displayed. 
TODTZFormatFlag                 equ     (COREForegroundCommonBuffer + 5)        
                                                                      
; Starting address of TZ database being displayed.  If the TZ being displayed is
;   TZ2 then this will hold the address of the variable 'TODTZ2Format'.
TODStartAddrOfTZDB              equ     (COREForegroundCommonBuffer + 6)        

; Starting Address of TZ resource being displayed.  If the TZ being displayed is
;   TZ2 then this will hold the address of the 2nd TOD resource.
TODStartAddrOfTZResource        equ     (COREForegroundCommonBuffer + 8)

TODFlags                        equ     (COREForegroundCommonBuffer + 10)

    bTODPeekOtherTZ             equ     00000001B           ; 0 - Peek at secondary TZ
                                                            ; 1 - Peek at tertiary TZ

;------------------------------------------------------------------------------
; TOD COMMON BACKGROUND DATA (Used only during background execution)
;------------------------------------------------------------------------------

; Used only during POR.
TODSecond                       equ     (COREBackgroundCommonBuffer + 1)
TODMinute                       equ     (COREBackgroundCommonBuffer + 2)
TODHour                         equ     (COREBackgroundCommonBuffer + 3)
TODDate                         equ     (COREBackgroundCommonBuffer + 4)
TODMonth                        equ     (COREBackgroundCommonBuffer + 5)
TODYearLo                       equ     (COREBackgroundCommonBuffer + 6)
TODYearHi                       equ     (COREBackgroundCommonBuffer + 7)


; Index of the resource currently being processed.
TODTZResourceIndex              equ     (COREBackgroundCommonBuffer + 0)

; Storage for TOD update bits.
TODUpdateBits                   equ     (COREBackgroundCommonBuffer + 1)



