;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 2001-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:    contvars.h
;
; Purpose:      Created file for the M851 contact Mode
;
; File Change History:
;
;               12/21/2001 HSB - Created contvars.h file for the M851
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; CONTACT APPLICATION SYSTEM DATA
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

CONTSYSTEMDATASTARTOFFSET               equ     0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Contact ASD Offsets 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Flags offset
CONTASDSYSTEMFLAGSOFFSET                equ     0

; Currently viewed record number offset (2 bytes)
CONTASDCURRVIEWRECORDNUMBEROFFSET       equ     1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Sizes in ASD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Size of the whole ASD area in RAM for the contact application
; used in the initialization of the application
CONTSIZEOFASD                           equ     3

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Contact ADD record Offsets 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Phone Type offset (2 bytes)
CONTADDPHONETYPEOFFSET                  equ     0

; Packed phone number offset (7 bytes)
CONTADDPHONENUMBEROFFSET                equ     2

; Message Record offset offset (1 byte)
; This a 1-byte data specifies the number of records from where it should retrieve its message field.
; This allows one record with the message to be shared bu succeeding records.
; Ex: A value of 0x00 indicates that the message is contained within the current record position.
;     A value of 0x01 indicates that the message is located from the previous record.
CONTADDMESSAGERECORDOFFSETOFFSET        equ     9

; Message size offset (indicates the message length)
CONTADDMESSAGESIZEOFFSET                equ     10

; Message Offset (the message offset in a record)
CONTADDMESSAGEOFFSET                    equ     11

; Record size without the message
CONTADDRECORDSIZEWITHOUTMESSAGE         equ     11

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Contact Flags bits definition
;
;   bCONTNotFirstEntryToMode              - 0=First entry to mode, 1= Not first Entry to mode
;   bCONTUseAccelerationWhenSearching     - indicates that we have more than 100 
;                                           phone records in the ADD and 
;                                           needs to use the acceleration tables 
;                                           when browsing through the database
;   bCONTEndOfListDisplayed               - indicates that the "End-Of-List" 
;                                           message is displayed
;   bCONTStoppedScrolling                 - indicates that the scrolling is paused.
;   bCONTFirstManualScrollingDone         - indicate that at least one manual scrolling
;                                           This bit is used for the usage counter USGMANUALSCROLLINGINCONTACTMODE
;
; These flags are located in CONTASDSYSTEMFLAGSOFFSET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

bCONTNotFirstEntryToMode                equ     00000001b
bCONTUseAccelerationWhenSearching       equ     00000010b
bCONTStoppedScrolling                   equ     00000100b
bCONTFirstManualScrollingDone           equ     00001000b
bCONTEndOfListDisplayed                 equ     00010000b


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TEMPORARY variables used when the contact application is in FOREGROUND
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The following variables are valid as long as the Contact mode is the forground application

; A contact record is read in this location
CONTReadRecordBuffer                    equ     COREForegroundCommonBuffer

; Phone type 1st byte address (1 byte)
CONTPhoneType1                          equ     CONTReadRecordBuffer

; Phone type 2nd byte address (1 byte)
CONTPhoneType2                          equ     (CONTReadRecordBuffer+1)

; Packed Phone number address (7 bytes)
CONTPhoneNumber                         equ     (CONTReadRecordBuffer+2)

; Message record offset byte from the current viewed record (1 byte)
CONTMessageOffset                       equ     (CONTReadRecordBuffer+9)

; Message size byte of the currently viewed record (1 byte)
CONTMessageSize                         equ     (CONTReadRecordBuffer+10)

; Total Number of records variable (2 bytes)
CONTTotalNumberOfRecords                equ     (CONTReadRecordBuffer+11)

; Stores the record number where the currently loaded message was retrieved
CONTCurrentRecordOfMessage              equ     (CONTReadRecordBuffer+13)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Message Scroll buffer in RAM to store strings up to 101 characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

CONTMessage                             equ     COREWorkBuffer


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TEMPORARY variables used when the contact application is in BACKEGROUND
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; The following variables are valid only during the code execution in the state handler
; The value of these variables will be destroyed on exiting any contact state handler. 
; In other words, on getting back to the CORE these variables maybe destroyed.

; Base address where the phone is expanded for display.
CONTExpandedPhone                       equ     COREBackgroundCommonBuffer

; Expanded section of the phone. The first 6 bytes are displayed in the segmented display region.
CONTExpandedPhoneSegment                equ     CONTExpandedPhone

; Expanded section of the phone. This will be displayed in the first line of the main dot matrix display.
; The arrows are already expanded in this section.
CONTExpandedPhoneDotMatrix              equ     (CONTExpandedPhone+6)

; Location where to set the Left Arrow if indicated in the MSB of CONTPhoneType1
CONTLeftArrowLocationOnDotMatrix        equ     CONTExpandedPhoneDotMatrix

; Location where to set the Right Arrow if indicated in the MSB of CONTPhoneType2
CONTRightArrowLocationOnDotMatrix       equ     (CONTExpandedPhoneDotMatrix+8)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Miscellaneous equates
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
bMaskLeftArrow                          equ     10000000b
bMaskRightArrow                         equ     10000000b


; Space character index in the local LCD table (contDMNumberTable). 
; contDMNumberTable is used for phone number encoding(0x0-0xF)
CONTDMSPACEOFFSET                       equ     DM5_SPACE

; Size of the phone Type is 2 bytes
CONTPHONETYPESIZE                       equ     2

; Size of the packed phone number is 7 bytes
CONTPACKEDPHONENUMBERSIZE               equ     7

; Size of the packed Segmented phone number is 3 bytes = 6 digits
CONTPACKEDSEGMENTEDPHONENUMBERSIZE      equ     3

; Number digits to be displayed on DM
CONTNUMBEROFDIGITSTOBEDISPLAYEDONDM     equ     9

; Maximum nuber of record after which acceleration should be used
CONTMAXNUMBEROFRECORDSTOUSEACCELERATION equ     100