States : An other way to use them
For a long time I use the state like there are described in the Timex documentation.
When I start working on MYWATCH I found this method not very easy to use when you want to use a lot of states.
I decided to use the declarations below:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; BASIC STATE INDEX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CORESTATE0 EQU 00H ; Mode Banner State index
CORESTATE1 EQU 01H ; Default State index
CORESTATE2 EQU 02H ; Set State
CORESTATE3 EQU 03H ; Set State n°2
CORESTATE4 EQU 04H ; Start State
CORESTATE5 EQU 05H ; Stop State
CORESTATE6 EQU 06H ; Minute rollover State
CORESTATE7 EQU 07H
CORESTATE8 EQU 08H
CORESTATE9 EQU 09H
CORESTATE10 EQU 0AH
CORESTATE11 EQU 0BH
CORESTATE12 EQU 0CH
CORESTATE13 EQU 0DH
CORESTATE14 EQU 0EH
CORESTATE15 EQU 0FH
CORESTATE16 EQU 10H
CORESTATE17 EQU 11H
CORESTATE18 EQU 12H
CORESTATE19 EQU 13H
CORESTATE20 EQU 14H
With this solution I have a direct link between the declaration of the builder and the program constant.
For example, to call the state 2 of MYWATCH (mwaset.asm) I use :
ld B, #CORESTATE2
CORE_REQ_STATE_CHANGE