;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) 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:    notevars.h
;
; Purpose:      variable file for the M851 Note Mode
;
; File Change History:
;
;               01/02/2002 RMA - Created File for the M851 project
;
;               03/21/2002 FSU - Updated
;
;               06/27/2002 FSU - ECR# 851-20020626-385
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; NOTE APPLICATION SYSTEM DATA
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

NOTESYSTEMDATASTARTOFFSET                       equ     0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NOTE ASD Offsets 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Flags offset
NOTEASDFLAGSOFFSET                              equ     0

; Total number of records
NOTEASDTOTALNUMBEROFRECORDSOFFSET               equ     1

; Total number of unused records
NOTEASDNUMBEROFUNUSEDRECORDSOFFSET              equ     3

; display list head pointer 
NOTEDISPLAYLISTHEADPTROFFSET                    equ     5

; display list tail pointer
NOTEDISPLAYLISTTAILPTROFFSET                    equ     7

; unused list head pointer
NOTEUNUSEDLISTHEADPTROFFSET                     equ     9

; current record address pointer 
NOTECURRENTRECORDVIEWEDPTROFFSET                equ     11

; next record address pionter
NOTENEXTRECORDADDRESSPTROFFSET                  equ     13

; previous record address pointer
NOTEPREVIOUSRECORDVIEWEDPTROFFSET               equ     15

; size of message including the sentinel character.
NOTEMESSAGESIZEWITHSENTINELOFFSET               equ     17

; current record status flags
NOTECURRENTRECORDSTATUSOFFSET                   equ     18

NOTESIZEOFASD                                   equ     19

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; NOTE Flags bits definition
;
;   bNOTEUnusedEntriesDisplayed - indicates that the "UNUSED ENTRIES"
;                                message is displayed
;   bNOTEEndOfListDisplayed    - indicates that the "End-Of-List" 
;                               message is displayed
;   bNOTEIncrementUsageCounter - indicates that the usage counter for 
;                               number of manual scrolling in note 
;                               should be incremented
;
; These flags are located in NOTEASDFLAGSOFFSET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

bNOTEUnusedEntriesDisplayed             equ     00000001b
bNOTEEndOfListDisplayed                 equ     00000010b
bNOTEIncrementUsageCounter              equ     00000100b

;#-----------------------------------------------------------------------------
;# ECR# 851-20020626-385
;#   Added the bit to determine if note entry was edited or created.
;#-----------------------------------------------------------------------------
bNOTEEntryCreated                       equ     00001000b       ; 0 - No entries have been created.
                                                                ; 1 - There is an entry created.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Curret record status flags
;
;   bNOTEUsedRecord            - indicates that the current record is used
;                                this flag will be cleared when the record is deleted
;   bNOTERecordModified        - indicates that the current record has been modified
;
; These flags are located in NOTECURRENTRECORDSTATUSOFFSET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

bNOTEUsedRecord                         equ     00000001b
bNOTERecordModified                     equ     00000010b


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TEMPORARY variables used when the Note application is in Foreground
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Indicates the key being held.
NOTEKeyDepressed                    equ     (COREForegroundCommonBuffer + 0)

; Holds the address offset of the currently displayed record.
NOTECurrentRecordPtr                equ     (COREForegroundCommonBuffer + 1)

; Holds the address offset of the next record with respect to the currently displayed
;   record.
NOTENextRecordPtr                   equ     (COREForegroundCommonBuffer + 3)

; Holds the address offset of the previous record with respect to the currently displayed
;   record.
NOTEPrevRecordPtr                   equ     (COREForegroundCommonBuffer + 5)


;------------------------------------------------------------------------------
; Database related equates
;------------------------------------------------------------------------------

; Size of the generic database header.  2 bytes for allocation size, 2 bytes
;   for database size and 1 byte for app specific header size.
NOTEADDGENERICHEADERSIZE            equ     5

; Size of the application specific header.  
;   2 bytes - Number of records.
;   2 bytes - Number of unused note.
;   2 bytes - Used list head pointer.
;   2 bytes - Used list tail pointer.
;   2 bytes - Unused list head pointer.
NOTEAPPSPECIFICHEADERSIZE           equ     10

; Initial number of note records.
NOTEDEFAULTNUMBEROFRECORDS          equ     10

; Header size of each record.
;   2  bytes - Next Record Address
;   2  bytes - Previous record address
;   1  byte  - Message size including the sentinel.
;   1  byte  - Record Status
;   2  bytes - PC Record ID (Used by PC only)
NOTESIZEOFRECORDHDR                 equ     8

; Default number of characters in the message including the sentinel character.
NOTEDEFAULTMESSAGESIZEWITHSENTINEL  equ     31

; Default record size.
NOTEDEFAULTRECORDSIZE               equ     (NOTESIZEOFRECORDHDR + NOTEDEFAULTMESSAGESIZEWITHSENTINEL)

; Size of the entire database allocated for 10 note entries.
NOTEEEPROMDATABASEDATASIZE          equ     (NOTEADDGENERICHEADERSIZE + NOTEAPPSPECIFICHEADERSIZE + (NOTEDEFAULTNUMBEROFRECORDS * NOTEDEFAULTRECORDSIZE))

; Size allocated for the entire database with 64-byte per page in EEPROM.
NOTEEEPROMDBALLOCATIONSIZE          equ     (((NOTEEEPROMDATABASEDATASIZE/64) + 1) * 64)


; Default number of unused records.
NOTEDEFAULTNUMBEROFUNUSEDRECORD     equ     10

; Indicates that this is a null offset address.
NOTENULLADDRESS                     equ     DBNULLRECORDOFFSET

; Offset address of the first record during POR.
NOTEFIRSTRECORDOFFSETADDRESS        equ     (NOTEADDGENERICHEADERSIZE + NOTEAPPSPECIFICHEADERSIZE)      

; Offset to point to the first character of the message of each record.
NOTEMESSAGERECORDOFFSET             equ     NOTESIZEOFRECORDHDR



; Number of USED records before the acceleration values will be used to go to other
;   records.
NOTENUMRECORDSTOCONSIDERACCELDATA   equ     100