summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2019-05-27 03:25:05 +0100
committerfishsoupisgood <github@madingley.org>2019-05-27 03:25:05 +0100
commite070d1885626a365099fac3caf0b537d04f4900e (patch)
treed64cb21715b8c8aa7d5082f739d62748aa757ad1
downloadwristapps-e070d1885626a365099fac3caf0b537d04f4900e.tar.gz
wristapps-e070d1885626a365099fac3caf0b537d04f4900e.tar.bz2
wristapps-e070d1885626a365099fac3caf0b537d04f4900e.zip
first batch of wristapps working with new assembler
-rw-r--r--.gitignore3
-rw-r--r--3ball/3ball.asm148
-rw-r--r--Makefile26
-rw-r--r--dayfind/dayfind.asm375
-rw-r--r--flash/flash.asm135
-rw-r--r--hello/hello.asm84
-rw-r--r--include/wristapp.i1374
-rw-r--r--number/number.asm117
-rw-r--r--password/password.asm232
-rw-r--r--update/update.asm133
10 files changed, 2627 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..57e6bbc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.app
+*.lst
+*.p
diff --git a/3ball/3ball.asm b/3ball/3ball.asm
new file mode 100644
index 0000000..ad92603
--- /dev/null
+++ b/3ball/3ball.asm
@@ -0,0 +1,148 @@
+;Name: 3BALL
+;Version: 3BALL
+;Description: An executive decision maker that will give a yes/no/maybe answer. Pressing Next will generate another answer and beep (since it will be the same answer sometimes).
+;
+;(c) 1997 Wayne Buttles (timex@fdisk.com). Compiled using tools and knowledge published by John A. Toebes, VIII and Michael Polymenakos (mpoly@panix.com).
+; Some enhancements by John Toebes...
+;
+;HelpFile: watchapp.hlp
+;HelpTopic: 100
+;
+; <A NAME="3ball_1">(1) Program specific constants</A>
+;
+ INCLUDE "wristapp.i"
+;
+; Program specific constants
+;
+CURRENT_TIC EQU $27 ; Current system clock tic (Timer)
+LAST_ANS EQU $61
+RAND_SEED EQU $60
+MARQ_POS EQU $62
+START EQU *
+;
+; <A NAME="3ball_2">(2) System entry point vectors</A>
+;
+L0110: jmp MAIN ; The main entry point - <A HREF="wristappformat.html#WRIST_MAIN">WRIST_MAIN</A>
+L0113: bclr 1,BTNFLAGS ; Called when we are suspended for any reason - <A HREF="wristappformat.html#WRIST_SUSPEND">WRIST_SUSPEND</A>
+ rts
+L0116: jmp FLASH ; Called to handle any timers or time events - <A HREF="wristappformat.html#WRIST_DOTIC">WRIST_DOTIC</A>
+L0119: bclr 1,BTNFLAGS ; Called when the COMM app starts and we have timers pending - <A HREF="wristappformat.html#WRIST_INCOMM">WRIST_INCOMM</A>
+ rts
+L011c: rts ; Called when the COMM app loads new data - <A HREF="wristappformat.html#WRIST_NEWDATA">WRIST_NEWDATA</A>
+ nop
+ nop
+
+L011f: lda STATETAB,X ; The state table get routine - <A HREF="wristappformat.html#WRIST_GETSTATE">WRIST_GETSTATE</A>
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB-STATETAB
+;
+; <A NAME="3ball_3">(3) Program strings</A>
+;
+S6_MSG timex6 "3 BALL"
+S6_MAYBE timex6 "MAYBE"
+S6_YES timex6 " YES"
+S6_NO timex6 " NO"
+S6_MARQ timex6 " +O+ "
+
+MARQ_SEL
+ DB S6_MARQ+2-START
+ DB S6_MARQ+3-START
+ DB S6_MARQ+2-START
+ DB S6_MARQ+1-START
+ DB S6_MARQ-START
+ DB S6_MARQ+1-START
+
+MSG_SEL DB S6_YES-START
+ DB S6_NO-START
+ DB S6_MAYBE-START
+ DB S6_YES-START
+;
+; <A NAME="3ball_4">(4) State Table</A>
+;
+STATETAB:
+ db 0
+ db EVT_ENTER,TIM_2_16TIC,0 ; Initial state
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_DNNEXT,TIM_2_16TIC,0 ; Next button
+ db EVT_TIMER2,TIM_ONCE,0 ; Timer
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_END
+;
+; <A NAME="3ball_5">(5) State Table 0 Handler</A>
+; This is called to process the state events.
+; We see ENTER, RESUME, TIMER2 and NEXT events
+;
+HANDLE_STATE0:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ bclr 1,BTNFLAGS
+ lda BTNSTATE
+ cmp #EVT_DNNEXT ; Did they press the next button?
+ beq DOITAGAIN
+ cmp #EVT_ENTER ; Or did we start out
+ beq DOITAGAIN
+ cmp #EVT_RESUME
+ beq REFRESH
+;
+; <A NAME="3ball_6">(6) Select a random answer</A>
+;
+SHOWIT
+ bsr RAND
+ and #3 ; go to a 1 in 4 chance
+ sta LAST_ANS
+;
+; <A NAME="3ball_7">(7) Display the currently selected random number</A>
+;
+REFRESH
+ ldx LAST_ANS ; Get the last answer we had, and use it as an index
+ lda MSG_SEL,X ; And get the message to display
+ jsr PUT6TOP ; Put that on the top
+BANNER
+ lda #S6_MSG-START
+ jsr PUT6MID
+ lda #SYS8_MODE ; And show the mode on the bottom
+ jmp PUTMSGBOT
+;
+; <A NAME="3ball_8">(8) This flashes the text on the screen</A>
+;
+FLASH
+ lda CURRENT_APP ; See which app is currently running
+ cmp #APP_WRIST ; Is it us?
+ bne L0113 ; No, so just turn off the tic timer since we don't need it
+ ldx #5
+ lda MARQ_POS
+ jsr INCA_WRAPX
+ sta MARQ_POS
+ tax
+ lda MARQ_SEL,X
+ jmp PUT6TOP
+;
+; <A NAME="3ball_9">(9) They want us to do it again</A>
+;
+DOITAGAIN ; Tell them we are going to do it again
+ clr MARQ_POS
+ bset 1,BTNFLAGS
+ bra BANNER
+;
+; <A NAME="3ball_10">(10) Here is a simple random number generator</A>
+;
+RAND
+ lda RAND_SEED
+ ldx #85
+ mul
+ add #25
+ sta RAND_SEED
+ rola
+ rola
+ rola
+ rts
+;
+; <A NAME="3ball_11">(11) This is the main initialization routine which is called when we first get the app into memory</A>
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta WRISTAPP_FLAGS
+ lda CURRENT_TIC
+ sta RAND_SEED
+ rts
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e06b22c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+
+
+APPDIRS=hello number update flash password dayfind 3ball
+
+APPS=${foreach appdir,${APPDIRS},${appdir}/${appdir}.app}
+PS=${APPS:%.app=%.p}
+LSTS=${APPS:%.app=%.lst}
+
+CROSS=../asl/
+
+AFLAGS=-i include -cpu datalink
+AS=${CROSS}asl ${AFLAGS}
+
+P2BIN=${CROSS}p2bin
+
+
+default:${APPS}
+
+%.app:%.p
+ ${P2BIN} $< $@ -r 0x110-\$$
+
+%.p:%.asm
+ ${AS} -L ${@:%.p=%.lst} -o $@ $<
+
+clean:
+ /bin/rm -f ${APPS} ${PS} ${LSTS}
diff --git a/dayfind/dayfind.asm b/dayfind/dayfind.asm
new file mode 100644
index 0000000..974e438
--- /dev/null
+++ b/dayfind/dayfind.asm
@@ -0,0 +1,375 @@
+;Name: Day Finder
+;Version: DAYFIND
+;Description: This will allow you to determine the date for a given day of the week and vice-versa.
+;by John A. Toebes, VIII
+;
+;Press the prev/next buttons to advance by a single day. Press SET to access the ability to advance/backup by
+;weeks, months, days, and years. The MODE button advances through those different states
+;
+;TIP: Download your watch faster: Download a WristApp once, then do not send it again. It stays in the watch!
+;HelpFile: watchapp.hlp
+;HelpTopic: 106
+ INCLUDE "wristapp.i"
+;
+; (1) Program specific constants
+;
+FLAGBYTE EQU $61
+B_CLEAR EQU 0 ; Bit 0 indicates that we need to clear the display first
+B_SCANUP EQU 1 ; Bit 1 indicates that we are scanning up
+B_SCANNING EQU 2 ; Bit 2 indicates that we are in a fake scanning mode
+DIGSEL EQU $62 ; Indicates which digit we are working on
+ ; 0 = DAY OF WEEK
+ ; 1 = Month
+ ; 2 = Day
+ ; 3 = Year
+YEAR_DIG1 EQU $63 ; This is the first digit of the year to blink (the tens digit)
+YEAR_DIG2 EQU $64 ; This is the second digit of the year to blink (the ones digit)
+COUNTER EQU $65 ; A convenient counter for us to advance a week at a time
+;
+;
+; (2) System entry point vectors
+;
+START EQU *
+L0110: jmp MAIN ; The main entry point - WRIST_MAIN
+L0113: rts ; Called when we are suspended for any reason - WRIST_SUSPEND
+ nop
+ nop
+L0116: rts ; Called to handle any timers or time events - WRIST_DOTIC
+ nop
+ nop
+L0119: rts ; Called when the COMM app starts and we have timers pending - WRIST_INCOMM
+ nop
+ nop
+L011c: rts ; Called when the COMM app loads new data - WRIST_NEWDATA
+ nop
+ nop
+
+L011f: lda STATETAB0,X ; The state table get routine - WRIST_GETSTATE
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB0-STATETAB0
+L0127: jmp HANDLE_STATE1
+ db STATETAB1-STATETAB0
+;
+; (3) Program strings
+S6_DAY timex6 "DAY "
+S6_FIND timex6 " FIND"
+S8_TOEBES timex "J.TOEBES"
+S8_DAYFIND timex "DAY FIND"
+S8_WEEK db C_LEFTARR
+ timex " WEEK "
+ db C_RIGHTARR
+S8_MONTH db C_LEFTARR
+ timex "MONTH "
+ db C_RIGHTARR
+S8_DAY db C_LEFTARR
+ timex " DAY "
+ db C_RIGHTARR
+S8_YEAR db C_LEFTARR
+ timex " YEAR "
+ db C_RIGHTARR
+;
+; (4) State Table
+;
+STATETAB0:
+ db 0
+ db EVT_ENTER,TIM_1_4TIC,0 ; Initial state
+ db EVT_TIMER1,TIM_ONCE,0 ; The timer from the enter event
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_SET,TIM_ONCE,1 ; SET button pressed
+ db EVT_DNNEXT,TIM_2_8TIC,0 ; NEXT button pressed
+ db EVT_DNPREV,TIM_2_8TIC,0 ; PREV button pressed
+ db EVT_UPANY4,TIM_ONCE,0 ; The
+ db EVT_TIMER2,TIM_2_TIC,0 ; The timer for the next/prev button pressed
+ db EVT_END
+
+STATETAB1:
+ db 1
+ db EVT_RESUME,TIM_ONCE,1 ; Resume from a nested app
+ db EVT_DNANY4,TIM_ONCE,1 ; NEXT, PREV, SET, MODE button pressed
+ db EVT_UPANY4,TIM_ONCE,1 ; NEXT, PREV, SET, MODE button released
+ db EVT_USER2,TIM_ONCE,0
+ db EVT_USER3,TIM_2_8TIC,1 ;
+ db EVT_TIMER2,TIM_2_TIC,1 ;
+ db EVT_END
+;
+; (5) State Table 0 Handler
+; This is called to process the state events.
+; We see ENTER, TIMER2, and RESUME events
+;
+HANDLE_STATE0:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_DNNEXT
+ beq DO_NEXT0
+ cmp #EVT_DNPREV
+ beq DO_PREV0
+ cmp #EVT_TIMER2
+ beq DO_SCAN
+ cmp #EVT_ENTER ; Is this our initial entry?
+ bne REFRESH0
+;
+; This is the initial event for starting us up
+;
+DO_ENTER
+;
+; (6) This code gets the current date from the system
+
+ jsr ACQUIRE ; Lock so that it doesn't change under us
+ ldx #TZ1_MONTH ; Assume that we are using the first timezone
+ jsr CHECK_TZ ; See which one we are really using
+ bcc COPY_TZ1 ; If we were right, just skip on to do the work
+ ldx #TZ2_MONTH ; Wrong guess, just load up the second time zone
+COPY_TZ1
+ lda 0,x ; Copy out the month
+ sta SCAN_MONTH
+ lda 1,x ; Day
+ sta SCAN_DAY
+ lda 2,x ; and year
+ sta SCAN_YEAR
+ jsr RELEASE ; Unlock so the rest of the system is happy
+
+ bclr B_CLEAR,FLAGBYTE ; Indicate that we need to clear the display
+ clr DIGSEL ; Start us off on the week advance
+ jsr CLEARSYM ; Clear the display
+ lda #S6_DAY-START
+ jsr PUT6TOP
+ lda #S6_FIND-START
+ jsr PUT6MID
+ lda #S8_TOEBES-START
+ jmp BANNER8
+
+DO_SCAN
+ brclr B_SCANUP,FLAGBYTE,DO_PREV0 ; Were we scanning up or down?
+DO_NEXT0
+ bset B_SCANUP,FLAGBYTE ; We are now scanning up
+ jsr INCREMENT_SCAN_DATE ; Advance to the next date
+ bra SHOW_DATE ; Comment this out and use the next one if you want
+ ; jmp APPT_SHOW_SCAN ; to put the text 'SCAN' on the bottom when we are in scan mode
+
+DO_PREV0
+ bclr B_SCANUP,FLAGBYTE ; We are now scanning down
+ jsr DECREMENT_SCAN_DATE ; Back up to the previous date
+ bra SHOW_DATE ; Show the date on the screen.
+ ; jmp APPT_SHOW_SCAN ; Use this if you want 'SCAN' on the bottom of the display
+;
+; We come here for a RESUME or TIMER2 event. For this we want to reset the display
+;
+REFRESH0
+ brset B_CLEAR,FLAGBYTE,NOCLEAR0 ; Do we need to clear the display first?
+ bset B_CLEAR,FLAGBYTE ; Mark that the display has been cleared
+ jsr CLEARALL ; and do the work of clearing
+NOCLEAR0
+ lda #S8_DAYFIND-START ; Put up the name of the app on the display
+ jsr BANNER8
+SHOW_DATE
+ jsr APPT_SHOW_DATE ; Show the date on the screen
+ ldx SCAN_YEAR ; as well as the year
+ jmp PUTYEARMID
+;--------------------------------------------------------------------------------
+; (7) State Table 1 Handler
+; This is called to process the state events.
+; We see SET, RESUME, USER3, TIMER2, DNANY4, and UPANY4 events
+; We use the USER3 to trigger a delay which fires off a TIMER2 sequence of events.
+; This allows us to have the PREV/NEXT buttons repeat for advancing the WEEK and YEAR
+; since we can't use the UPDATE routines for them.
+;
+HANDLE_STATE1:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_TIMER2 ; Was it a timer for a repeat operation?
+ beq DO_UPD ; Yes, go handle it
+ cmp #EVT_USER3 ; Was it the USER3 event fired from the PREV/NEXT buttons?
+ bne TRY_UP ; No, try again
+ rts ; Yes, just ignore it, it will cause a timer to go off later
+TRY_UP
+ bclr B_SCANNING,FLAGBYTE ; We can't be scanning any more, so turn it off
+ cmp #EVT_UPANY4 ; Was it any button being released?
+ bne TRY_DN ; No, try again
+ jmp REFRESH ; Yes, go refresh the screen (note that the branch is out of range)
+TRY_DN
+ cmp #EVT_DNANY4 ; Is this our initial entry?
+ beq GET_DN ; No, try again
+ jmp FORCEFRESH ; Yes, go setup the screen (note that the branch is out of range)
+GET_DN
+ lda BTN_PRESSED ; Let's see what the button they pressed was
+ cmp #EVT_PREV ; How about the PREV button
+ beq DO_PREV ; handle it
+ cmp #EVT_NEXT ; Maybe the NEXT button?
+ beq DO_NEXT ; Deal with it!
+ cmp #EVT_MODE ; Perhaps the MODE button
+ beq DO_MODE ; If so, handle it
+ ; It must be the set button, so take us out of this state
+ lda #EVT_USER2
+ jmp POSTEVENT
+;
+; (8) Our real working code...
+; We come here when they press the next/prev buttons. if we are in a timer repeat
+; situation (triggered when they press prev/next for the WEEK/YEAR) then we skip right
+; to processing based on the button that was previously pressed
+;
+DO_NEXT
+ bset 0,SYSFLAGS ; Mark our update direction as up
+ bra DO_UPD
+DO_PREV
+ bclr 0,SYSFLAGS ; Mark our update direction as down
+DO_UPD
+ lda DIGSEL ; Which digit mode are we in?
+ beq DO_UPD_DOW ; 0 - Handle the WEEK
+ cmp #2
+ blo DO_UPD_MONTH ; <2 = 1 - Handle the MONTH
+ beq DO_UPD_DAY ; 2 - Handle the Day
+DO_UPD_YEAR ; >2 = 3 - Handle the YEAR
+ brclr 0,SYSFLAGS,LASTYEAR ; Were we in the down direction?
+ ldx #99 ; Going up, let the WRAPX routine handle it for us
+ lda SCAN_YEAR
+ jsr INCA_WRAPX
+ bra SAVEYEAR
+LASTYEAR
+ lda SCAN_YEAR ; Going down, get the year
+ deca ; Decrement it
+ bpl SAVEYEAR ; and see if we hit the lower end
+ lda #99 ; Yes, 2000 wraps down to 1999
+SAVEYEAR
+ sta SCAN_YEAR ; Save away the new year
+ bra SETUP_LAG ; And fire off an event to allow for repeating
+
+DO_UPD_DOW ; 0 - Day of week
+ lda #7 ; We want to iterate 7 times advancing by one day.
+ sta COUNTER ; (this makes it much easier to handle all the fringe cases)
+WEEKLOOP
+ brclr 0,SYSFLAGS,LASTWEEK ; Are we going backwards?
+ jsr INCREMENT_SCAN_DATE ; Going forwards, advance by one day
+ bra WEEKLOOPCHK ; And continue the loop
+LASTWEEK
+ jsr DECREMENT_SCAN_DATE ; Going backwards, retreat by one day
+WEEKLOOPCHK
+ dec COUNTER ; Count down
+ tst COUNTER ; See if we hit the limit
+ bne WEEKLOOP ; and go back for more
+; (9) Fake repeater
+; This code is used for the Day of week and year modes where we want to have a
+; repeating button, but the system routines won't handle it for us
+; It works by posting a USER3 event which has a timer of about 1/2 second.
+; After that timer expires, we get a timer2 event which then repeats every tic.
+; The only thing that we have to worry about here is to not go through this
+; every time so that it takes 1/2 second for every repeat.
+SETUP_LAG
+ brset B_SCANNING,FLAGBYTE,INLAG ; If we were already scanning, skip out
+ bset B_SCANNING,FLAGBYTE ; Indicate that we are scanning
+ lda #EVT_USER3 ; and post the event to start it off
+ jsr POSTEVENT
+INLAG
+ jmp SHOW_DATE ; Put the date up on the display
+; (10) Update routine usage
+DO_UPD_MONTH ; 1 - Handle the month
+ lda #MONTH_JAN ; The bottom end is January
+ sta UPDATE_MIN
+ lda #MONTH_DEC ; and the top end is December (INCLUSIVE)
+ sta UPDATE_MAX
+ lda #UPD_HMONTH ; We want the HALF-MONTH udpate function
+ ldx #SCAN_MONTH ; To update the SCAN_MONTH variable
+ bra SEL_UPD ; Go do it
+DO_UPD_DAY ; 2 - Handle the day
+ lda #1 ; 1 is the first day of the month
+ sta UPDATE_MIN
+ jsr GET_SCAN_MONTHLEN ; Figure out how long the month is
+ sta UPDATE_MAX ; and make that the limit
+ lda #UPD_HDAY ; We want the HALF-DAY update function
+ ldx #SCAN_DAY ; to update the SCAN_DAY variable
+SEL_UPD
+ jsr START_UPDATEP ; And prepare the update routine
+ bset 4,BTNFLAGS ; Mark that the update is now pending
+ rts
+; (11) Making the mode button work
+; when they press the mode button, we want to cycle through the various choices
+; on the display.
+DO_MODE
+ lda DIGSEL ; Figure out where we are in the cycle
+ inca ; advance to the next one
+ and #3 ; and wrap at 4 to zero
+ sta DIGSEL
+REFRESH
+ brset B_CLEAR,FLAGBYTE,NOCLEAR ; Do we need to clear the display first?
+FORCEFRESH
+ jsr CLEARALL ; Yes, clear everything before we start
+ bset B_CLEAR,FLAGBYTE ; And remember that we have already done that
+NOCLEAR
+ clr BTNFLAGS ; Turn off any scrolling banners
+ lda #ROW_TD23 ; Turn off the dash from the week blink
+ sta DISP_ROW
+ bclr COL_TD23,DISP_COL
+ jsr SHOW_DATE ; Display the date
+; (12) Establishing a blink routine
+; This makes the appropriate section of the display blink based on what we are changing
+ lda DIGSEL ; Get the digit we are on
+ beq DO_BLINK_DOW ; 0 -> Update Day of week
+ cmp #2
+ blo DO_BLINK_MONTH ; <2 = 1 -> Update month
+ beq DO_BLINK_DAY ; 2 - Update day of month
+
+DO_BLINK_YEAR ; 3: Year
+; (13) Calling BLINK_SECOND
+; For BLINK_SECONDS, the UPDATE_PARM points to the 2 character format for the year.
+ ldx SCAN_YEAR ; Get our year
+ jsr GETBCDHI ; And extract out the high digit of it
+ sta YEAR_DIG1 ; Save that away
+ ldx SCAN_YEAR ; Do it again
+ jsr GETBCDLOW ; to get the low digit
+ sta YEAR_DIG2 ; and save that away
+ ldx #YEAR_DIG1 ; the parm points to the first digit
+ lda #BLINK_SECONDS ; and we want a BLINK_SECONDS function
+ bra SETUP_BLINK ; so do it already
+
+DO_BLINK_DOW ; 0: Day of week:
+; (14) Calling BLINK_SEGMENT
+; Unfortunately, there is no blink routine to blink the upper two letters on the display.
+; To get around this, I have chosen to blink a single segment on the display (the dash
+; after the day of the week). This routine was designed to blink the AM/PM or other
+; symbols, but it works quite fine for our purposed. You need to set UPDATE_POS to have
+; the row to be updated and UPDATE_VAL holds the mask for the COLUMS to be XORed.
+; In this way, you might have more than one segment blinking, but there are few segments
+; on the same row which would achieve a reasonable effect.
+; UPDATE_POS ROW_TD23
+; UPDATE_VAL (1<<COL_TD23)
+ lda #ROW_TD23
+; We want to blink the DASH after the day of week sta UPDATE_POS
+; Store the ROW for it in UPDATE_POS lda #(1<<COL_TD23)
+; Get the mask for the column sta UPDATE_VAL
+; And store that in UPDATE_VAL lda #BLINK_SEGMENT
+; We want a BLINK_SEGMENT function bra SETUP_BLINK
+; and get to it.
+DO_BLINK_MONTH ; 1: Month
+; (15) Calling BLINK_HMONTH, BLINK_HDAY
+; These are the normal boring cases of calling the blink routine. They simply need the
+; address of the byte holding the value to blink and the function to blink them with.
+; UPDATE_PARM - Points to the month
+ lda #BLINK_HMONTH ; We want a BLINK HALF-MONTH function
+ ldx #SCAN_MONTH ; to blink our month
+ bra SETUP_BLINK ; and do it
+
+DO_BLINK_DAY ; 2: Day
+; UPDATE_PARM - Points to the day
+ lda #BLINK_HDAY ; We want a BLINK HALF-DAY function
+ ldx #SCAN_DAY ; to blink our day
+
+SETUP_BLINK
+ jsr START_BLINKP ; Request the blink function
+ lda digsel ; Figure out which one we are blinking
+ lsla ; *2
+ lsla ; *4
+ lsla ; *8
+ add #S8_WEEK-START ; And use that to index the banner to put on the bottom
+ jsr BANNER8
+ bset 2,BTNFLAGS ; Mark a blink routine as pending
+ rts
+;
+; (16) This is the main initialization routine which is called when we first get the app into memory
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta WRISTAPP_FLAGS
+ clr FLAGBYTE ; start with a clean slate
+ rts
diff --git a/flash/flash.asm b/flash/flash.asm
new file mode 100644
index 0000000..15281dc
--- /dev/null
+++ b/flash/flash.asm
@@ -0,0 +1,135 @@
+;Name: Flash
+;Version: FLASH
+;Description: by John A. Toebes, VIII
+;This is a simple number update/flash program
+;
+;TIP: Download your watch faster: Download a WristApp once, then do not send it again. It stays in the watch!
+;HelpFile: watchapp.hlp
+;HelpTopic: 106
+ INCLUDE "wristapp.i"
+;
+; (1) Program specific constants
+;
+FLAGBYTE EQU $61
+; Bit 1 indicates that we need to clear the display first
+;
+CURVAL EQU $62 ; The current value we are displaying
+;
+; (2) System entry point vectors
+;
+START EQU *
+L0110: jmp MAIN ; The main entry point - WRIST_MAIN
+L0113: rts ; Called when we are suspended for any reason - WRIST_SUSPEND
+ nop
+ nop
+L0116: rts ; Called to handle any timers or time events - WRIST_DOTIC
+ nop
+ nop
+L0119: rts ; Called when the COMM app starts and we have timers pending - WRIST_INCOMM
+ nop
+ nop
+L011c: rts ; Called when the COMM app loads new data - WRIST_NEWDATA
+ nop
+ nop
+
+L011f: lda STATETAB,X ; The state table get routine - WRIST_GETSTATE
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB-STATETAB
+;
+; (3) Program strings
+S6_FLASH: timex6 "FLASH "
+S6_SAMPLE: timex6 "SAMPLE"
+;
+; (4) State Table
+;
+STATETAB:
+ db 0
+ db EVT_ENTER,TIM_2_8TIC,0 ; Initial state
+ db EVT_TIMER2,TIM_ONCE,0 ; The timer from the enter event
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_DNANY4,TIM_ONCE,0 ; NEXT, PREV, SET, MODE button pressed
+ db EVT_UPANY4,TIM_ONCE,0 ; NEXT, PREV, SET, MODE button released
+ db EVT_END
+;
+; (5) State Table 0 Handler
+; This is called to process the state events.
+; We see ENTER, TIMER2, RESUME, DNANY4 and UPANY4 events
+;
+HANDLE_STATE0:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_DNANY4 ; Did they press a button?
+ bne CHKENTER ; No, pass on to see what else there might be
+ lda BTN_PRESSED ; Let's see what the button they pressed was
+ cmp #EVT_PREV ; How about the PREV button
+ beq DO_PREV ; handle it
+ cmp #EVT_NEXT ; Maybe the NEXT button?
+ beq DO_NEXT ; Deal with it!
+ cmp #EVT_SET ; Perhaps the SET button
+ beq DO_SET ; If so, handle it
+ ; In reality, we can't reach here since we handled all three buttons
+ ; in the above code (the MODE button is handled before we get here and the
+ ; GLOW button doesn't send in an event for this). We can just fall through
+ ; and take whatever we get from it.
+CHKENTER
+ cmp #EVT_ENTER ; Is this our initial entry?
+ bne REFRESH
+;
+; This is the initial event for starting us
+;
+DO_ENTER
+ bclr 1,FLAGBYTE ; Indicate that we need to clear the display
+ jsr CLEARSYM ; Clear the display
+ lda #S6_FLASH-START
+ jsr PUT6TOP
+ lda #S6_SAMPLE-START
+ jsr PUT6MID
+ lda #SYS8_MODE
+ jmp PUTMSGBOT
+;
+; (6) Our real working code...
+
+DO_NEXT
+ bset 0,SYSFLAGS ; Mark our update direction as up
+ bra DO_UPD
+DO_PREV
+ bclr 0,SYSFLAGS ; Mark our update direction as down
+DO_UPD
+ clra
+ sta UPDATE_MIN ; Our low end is 0
+ lda #99
+ sta UPDATE_MAX ; and the high end is 99 (the max since this is a 2 digit value)
+ ldx #CURVAL ; Point to our value to be updated
+ lda #UPD_MID34 ; Request updating in the middle of the display
+ jsr START_UPDATEP ; And prepare the update routine
+ bset 4,BTNFLAGS ; Mark that the update is now pending
+ bclr 1,FLAGBYTE
+ lda #SYS8_SET_MODE
+ jmp PUTMSGBOT
+
+DO_SET
+ clr CURVAL ; When they hit the set button, we just clear to zero
+SHOWVAL
+ brset 1,FLAGBYTE,NOCLEAR ; Do we need to clear the display first?
+REFRESH
+ jsr CLEARALL ; Yes, clear everything before we start
+ bset 1,FLAGBYTE ; And remember that we have already done that
+NOCLEAR
+ bclr 7,BTNFLAGS ; Turn off any update routine that might be pending
+ ldx #CURVAL
+ lda #BLINK_MID34
+ jsr START_BLINKP
+ bset 2,BTNFLAGS ; Mark a blink routine as pending
+ rts
+;
+; (7) This is the main initialization routine which is called when we first get the app into memory
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta WRISTAPP_FLAGS
+ clr FLAGBYTE ; start with a clean slate
+ clr CURVAL
+ rts
diff --git a/hello/hello.asm b/hello/hello.asm
new file mode 100644
index 0000000..50042bd
--- /dev/null
+++ b/hello/hello.asm
@@ -0,0 +1,84 @@
+;Name: Hello World
+;Version: HELLO
+;Description: This is a simple Hello Program
+;by John A. Toebes, VIII
+;
+;TIP: Download your watch faster: Download a WristApp once, then do not send it again. It stays in the watch!
+;HelpFile: watchapp.hlp
+;HelpTopic: 106
+ INCLUDE "wristapp.i"
+
+;
+; (1) Program specific constants
+;
+FLAGBYTE EQU $61
+; Bit 0 indicates that we want to show the segments instead of the message
+;
+START EQU *
+;
+; (2) System entry point vectors
+L0110: jmp MAIN ; The main entry point - WRIST_MAIN
+L0113: rts ; Called when we are suspended for any reason - WRIST_SUSPEND
+ nop
+ nop
+L0116: rts ; Called to handle any timers or time events - WRIST_DOTIC
+ nop
+ nop
+L0119: rts ; Called when the COMM app starts and we have timers pending - WRIST_INCOMM
+ nop
+ nop
+L011c: rts ; Called when the COMM app loads new data - WRIST_NEWDATA
+ nop
+ nop
+
+L011f: lda STATETAB,X ; The state table get routine - WRIST_GETSTATE
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB-STATETAB
+;
+; (3) Program strings
+S6_HELLO: timex6 "HELLO "
+S6_WORLD: timex6 "WORLD "
+;
+; (4) State Table
+; (4) State Table
+STATETAB:
+ db 0
+ db EVT_ENTER,TIM_ONCE,0 ; Initial state
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_DNNEXT,TIM_ONCE,0 ; Next button
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_END
+;
+; (5) State Table 0 Handler
+; This is called to process the state events. We only see ENTER, RESUME, and DNNEXT events
+;
+HANDLE_STATE0:
+ bset 1,$8f ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_DNNEXT ; Did they press the next button?
+ beq DOTOGGLE ; Yes, toggle what we are displaying
+CLEARIT bclr 0,FLAGBYTE ; Start us in the show display state
+REFRESH brclr 0,FLAGBYTE,SHOWDISP ; Do we want to see the main display?
+ jmp SETALL ; No, just turn on all segments
+SHOWDISP jsr CLEARALL ; Clear the display
+ lda #S6_HELLO-START ; Get the offset for the first string
+ jsr PUT6TOP ; And send it to the top line
+ lda #S6_WORLD-START ; Get the offset for the second string
+ jsr PUT6MID ; and put it on the middle line
+ lda #SYS8_MODE ; Get the system offset for the 'MODE' string
+ jmp PUTMSGBOT ; and put it on the bottom line
+;
+; (6) Our only real piece of working code...
+DOTOGGLE brset 0,FLAGBYTE,CLEARIT ; If it is set, just jump to clear it like normal
+ bset 0,FLAGBYTE ; Already clear, so set it
+ bra REFRESH ; and let the refresh code handle it
+;
+; (7) This is the main initialization routine which is called when we first get the app into memory
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta $96
+ clr FLAGBYTE ; start with a clean slate
+ rts
diff --git a/include/wristapp.i b/include/wristapp.i
new file mode 100644
index 0000000..699d2af
--- /dev/null
+++ b/include/wristapp.i
@@ -0,0 +1,1374 @@
+;
+; Wristapp.i - For the Datalink 150
+; Copyright (c) 1997 by John A. Toebes, VIII. All Rights Reserved.
+;
+DISP_ROW EQU $1d ; Hardware register to select which row of the display is to be written to. You need to
+ ; Combine this with setting DISP_COL to cause the segment to change
+DISP_COL EQU $1e ; Hardware register to select which col of the display is to be written to. You must set
+ ; DISP_ROW first to cause the segment to change
+; It turns out that the segments on the display are readily accessible. You can turn on/off any segment
+; pretty easily.
+;
+; The top and middle lines are a series of segments which can be individually turned on to
+; achieve the different letters. I assign the segments as follows:
+; A
+; _____
+; | |
+; F | |H | B
+; | | |
+; ---G-
+; | | |
+; E | |I | C
+; |_____|
+; D
+;
+; Numbering the digits on the line from left to right we would get
+;
+;
+; 1A 2A 3A 4A 5A 6A
+; _____ _____ _____ _____ _____ _____
+; 1| |1 2| |2 3| |3 4| |4 5| |5 6| |6
+; F| |1 |B F| |2 |B F| |3 |B F| |4 |B F| |5 |B F| |6 |B
+; | |H | | |H | D23 | |H | D34| |H | D45 | |H | | |H |
+; --1G- --2G- --- --3G- -- --4G- --- --5G- --6G-
+; 1| |1 |1 2| |2 |2 3| |3 |3 4| |4 |4 5| |5 |5 6| |6 |6
+; E| |I |C E| |I |C E| |I |C E| |I |C E| |I |C E| |I |C
+; |_____| |_____| . |_____| |_____| . |_____| |_____|
+; 1D 2D P23 3D 4D P45 5D 6D
+;
+; AM PM Remind Night Alarm Note
+;
+;
+; 1A 2A 3A 4A 5A 6A
+; _____ _____ C23 _____ _____ _____ _____
+; 1| |1 2| |2 o 3| |3 4| |4 5| |5 6| |6
+; F| |1 |B F| |2 |B F| |3 |B F| |4 |B F| |5 |B F| |6 |B
+; | |H | | |H | D23 | |H | | |H | D45 | |H | | |H |
+; --1G- --2G- --- --3G- --4G- --- --5G- --6G-
+; 1| |1 |1 2| |2 |2 3| |3 |3 4| |4 |4 5| |5 |5 6| |6 |6
+; E| |I |C E| |I |C o E| |I |C E| |I |C E| |I |C E| |I |C
+; |_____| |_____| . |_____| |_____| . |_____| |_____|
+; 1D 2D P23 3D 4D P45 5D 6D
+;
+; Note the two dashes between segments 2&3 and 4&5. For convenience, I refer to these
+; as D23 and D45 or DASH23 and DASH45 respectively.
+; I prefix all of the items on the first row with a T and those on the middle row with a M.
+;
+; Pixels on the bottom line are addressed a little differently. For these, we have 8 5x5 sets of
+; segments. We can reference them as follows:
+;
+; S1 S2 S3 S4 S5 S6 S7 S8
+; 12345 12345 12345 12345 12345 12345 12345 12345
+; *****A *****A *****A *****A *****A *****A *****A *****A
+; *****B *****B *****B *****B *****B *****B *****B *****B
+; *****C *****C *****C *****C *****C *****C *****C *****C
+; *****D *****D *****D *****D *****D *****D *****D *****D
+; *****E *****E *****E *****E *****E *****E *****E *****E
+;
+; Hence, the lower right pixel is referenced as S8E5
+;
+
+; Value Bit0 Bit1 Bit2 Bit3 Bit4
+; ------ ------ ------ ------ ------ ------
+; 00 <none> <none> <none> <none> <none>
+; 02 S8E1 S8D1 S8A1 S8B1 S8C1
+; 04 S8E2 S8D2 S8A2 S8B2 S8C2
+; 06 S8E3 S8D3 S8A3 S8B3 S8C3
+; 08 S8E4 S8D4 S8A4 S8B4 S8C4
+; 0A S8E5 S8D5 S8A5 S8B5 S8C5
+; 0C <none> <none> <none> <none> <none>
+; 0E T6C T6B M6C M6B Note
+; 10 T6D T6G T6A <none> M6A
+; 12 T6I T6H M6I M6G M6H
+; 14 T6E T6F M6D M6E M6F
+; 16 <none> <none> <none> <none> <none>
+; 18 <none> <none> <none> <none> <none>
+; 1A <none> <none> <none> <none> <none>
+; 1C T5C T5B M5C M5B Alarm
+; 1E T5D T5G T5A <none> M5A
+; 20 T5I T5H M5I M5G M5H
+; 22 T5E T5F M5D M5E M5F
+; 24 TP45 TD45 MP45 MD45 <none>
+; 26 T4C T4B M4C M4B Night
+; 28 T4D T4G T4A <none> M4A
+; 2A T4I T4H M4I M4G M4H
+; 2C T4E T4F M4D M4E M4F
+; 2E T3C T3B M3C M3B TD34
+; 30 T3D T3G T3A <none> M3A
+; 32 T3I T3H M3I M3G M3H
+; 34 T3E T3F M3D M3E M3F
+; 36 TP23 TD23 MP23 MC23 <none>
+; 38 T2C T2B M2C M2B Remind
+; 3A T2D T2G T2A <none> M2A
+; 3C T2I T2H M2I M2G M2H
+; 3E T2E T2F M2D M2E M2F
+; 40 T1C T1B M1C M1B PM
+; 42 T1D T1G T1A <none> M1A
+; 44 T1I T1H M1I M1G M1H
+; 46 T1E T1F M1D M1E M1F
+; 48 <none> <none> <none> <none> AM
+;
+; For the ODD Bits, we have:
+;
+; Value Bit0 Bit1 Bit2 Bit3 Bit4
+; ------ ------ ------ ------ ------ ------
+; 01 S7D5 S7E5 S7A5 S7B5 S7C5
+; 03 S7D4 S7E4 S7A4 S7B4 S7C4
+; 05 S7D3 S7E3 S7A3 S7B3 S7C3
+; 07 S7D2 S7E2 S7A2 S7B2 S7C2
+; 09 S7D1 S7E1 S7A1 S7B1 S7C1
+; 0B S6D5 S6E5 S6A5 S6B5 S6C5
+; 0D S6D4 S6E4 S6A4 S6B4 S6C4
+; 0F S6D3 S6E3 S6A3 S6B3 S6C3
+; 11 S6D2 S6E2 S6A2 S6B2 S6C2
+; 13 S6D1 S6E1 S6A1 S6B1 S6C1
+; 15 S5D5 S5E5 S5A5 S5B5 S5C5
+; 17 S5D4 S5E4 S5A4 S5B4 S5C4
+; 19 S5D3 S5E3 S5A3 S5B3 S5C3
+; 1B S5D2 S5E2 S5A2 S5B2 S5C2
+; 1D S5D1 S5E1 S5A1 S5B1 S5C1
+; 1F S4D5 S4E5 S4A5 S4B5 S4C5
+; 21 S4D4 S4E4 S4A4 S4B4 S4C4
+; 23 S4D3 S4E3 S4A3 S4B3 S4C3
+; 25 S4D2 S4E2 S4A2 S4B2 S4C2
+; 27 S4D1 S4E1 S4A1 S4B1 S4C1
+; 29 <none> <none> <none> <none> <none>
+; 2B S3D5 S3E5 S3A5 S3B5 S3C5
+; 2D S3D4 S3E4 S3A4 S3B4 S3C4
+; 2F S3D3 S3E3 S3A3 S3B3 S3C3
+; 31 S3D2 S3E2 S3A2 S3B2 S3C2
+; 33 S3D1 S3E1 S3A1 S3B1 S3C1
+; 35 S2D5 S2E5 S2A5 S2B5 S2C5
+; 37 S2D4 S2E4 S2A4 S2B4 S2C4
+; 39 S2D3 S2E3 S2A3 S2B3 S2C3
+; 3B S2D2 S2E2 S2A2 S2B2 S2C2
+; 3D S2D1 S2E1 S2A1 S2B1 S2C1
+; 3F S1D5 S1E5 S1A5 S1B5 S1C5
+; 41 S1D4 S1E4 S1A4 S1B4 S1C4
+; 43 S1D3 S1E3 S1A3 S1B3 S1C3
+; 45 S1D2 S1E2 S1A2 S1B2 S1C2
+; 47 S1D1 S1E1 S1A1 S1B1 S1C1
+;
+;
+; Of course if you want to look it from the orientation of the segments on the display,
+; you can use this information. To make it more compact, I used the notation
+; bit:Value
+; where value is what you store in $1D and Bit is which bit to set/clear in $1E to get the effect
+;
+; T1A=2:42 T2A=2:3A T3A=2:30 T4A=2:28 T5A=2:1E T6A=2:10
+; T1B=1:40 T2B=1:38 T3B=1:2E T4B=1:26 T5B=1:1c T6B=1:0e
+; T1C=0:40 T2C=0:38 T3C=0:2E T4C=0:26 T5C=0:1c T6C=0:0e
+; T1D=0:42 T2D=0:3A T3D=0:30 T4D=0:28 T5D=0:1e T6D=0:10
+; T1E=0:46 T2E=0:3E T3E=0:34 T4E=0:2C T5E=0:22 T6E=0:14
+; T1F=1:46 T2F=1:3E T3F=1:34 T4F=1:2C T5F=1:22 T6F=1:14
+; T1G=1:42 T2G=1:3A T3G=1:30 T4G=1:28 T5G=1:1E T6G=1:10
+; T1H=1:44 T2H=1:3C T3H=1:32 T4H=1:2A T5H=1:20 T6H=1:12
+; T1I=0:44 T2I=0:3C T3I=0:32 T4I=0:2A T5I=0:20 T6I=0:12
+;
+; TP23=0:36
+; TD23=1:36
+; TD34=4:2E
+; TD45=1:24
+; TP45=0:24
+;
+; M1A=4:42 M2A=4:3A M3A=4:30 M4A=4:28 M5A=4:1E M6A=4:10
+; M1B=3:40 M2B=3:38 M3B=3:2E M4B=3:26 M5B=3:1C M6B=3:0E
+; M1C=2:40 M2C=2:38 M3C=2:2E M4C=2:26 M5C=2:1C M6C=2:0E
+; M1D=2:46 M2D=2:3E M3D=2:34 M4D=2:2C M5D=2:22 M6D=2:14
+; M1E=3:46 M2E=3:3E M3E=3:34 M4E=3:2C M5E=3:22 M6E=3:14
+; M1F=4:46 M2F=4:3E M3F=4:34 M4F=4:2C M5F=4:22 M6F=4:14
+; M1G=3:44 M2G=3:3C M3G=3:32 M4G=3:2A M5G=3:20 M6G=3:12
+; M1H=4:44 M2H=4:3C M3H=4:32 M4H=4:2A M5H=4:20 M6H=4:12
+; M1I=2:44 M2I=2:3C M3I=2:32 M4I=2:2A M5I=2:20 M6I=2:12
+;
+; MC23=3:36
+; MP23=2:36
+; MD45=3:24
+; MP45=2:24
+;
+; AM=4:48
+; PM=4:40
+; Remind=4:38
+; Night=4:26
+; Alarm=4:1C
+; Note=4:0e
+
+COL_T1A EQU 2
+ROW_T1A EQU $42
+COL_T2A EQU 2
+ROW_T2A EQU $3A
+COL_T3A EQU 2
+ROW_T3A EQU $30
+COL_T4A EQU 2
+ROW_T4A EQU $28
+COL_T5A EQU 2
+ROW_T5A EQU $1E
+COL_T6A EQU 2
+ROW_T6A EQU $10
+;
+COL_T1B EQU 1
+ROW_T1B EQU $40
+COL_T2B EQU 1
+ROW_T2B EQU $38
+COL_T3B EQU 1
+ROW_T3B EQU $2E
+COL_T4B EQU 1
+ROW_T4B EQU $26
+COL_T5B EQU 1
+ROW_T5B EQU $1c
+COL_T6B EQU 1
+ROW_T6B EQU $0e
+;
+COL_T1C EQU 0
+ROW_T1C EQU $40
+COL_T2C EQU 0
+ROW_T2C EQU $38
+COL_T3C EQU 0
+ROW_T3C EQU $2E
+COL_T4C EQU 0
+ROW_T4C EQU $26
+COL_T5C EQU 0
+ROW_T5C EQU $1c
+COL_T6C EQU 0
+ROW_T6C EQU $0e
+;
+COL_T1D EQU 0
+ROW_T1D EQU $42
+COL_T2D EQU 0
+ROW_T2D EQU $3A
+COL_T3D EQU 0
+ROW_T3D EQU $30
+COL_T4D EQU 0
+ROW_T4D EQU $28
+COL_T5D EQU 0
+ROW_T5D EQU $1e
+COL_T6D EQU 0
+ROW_T6D EQU $10
+;
+COL_T1E EQU 0
+ROW_T1E EQU $46
+COL_T2E EQU 0
+ROW_T2E EQU $3E
+COL_T3E EQU 0
+ROW_T3E EQU $34
+COL_T4E EQU 0
+ROW_T4E EQU $2C
+COL_T5E EQU 0
+ROW_T5E EQU $22
+COL_T6E EQU 0
+ROW_T6E EQU $14
+;
+COL_T1F EQU 1
+ROW_T1F EQU $46
+COL_T2F EQU 1
+ROW_T2F EQU $3E
+COL_T3F EQU 1
+ROW_T3F EQU $34
+COL_T4F EQU 1
+ROW_T4F EQU $2C
+COL_T5F EQU 1
+ROW_T5F EQU $22
+COL_T6F EQU 1
+ROW_T6F EQU $14
+;
+COL_T1G EQU 1
+ROW_T1G EQU $42
+COL_T2G EQU 1
+ROW_T2G EQU $3A
+COL_T3G EQU 1
+ROW_T3G EQU $30
+COL_T4G EQU 1
+ROW_T4G EQU $28
+COL_T5G EQU 1
+ROW_T5G EQU $1E
+COL_T6G EQU 1
+ROW_T6G EQU $10
+;
+COL_T1H EQU 1
+ROW_T1H EQU $44
+COL_T2H EQU 1
+ROW_T2H EQU $3C
+COL_T3H EQU 1
+ROW_T3H EQU $32
+COL_T4H EQU 1
+ROW_T4H EQU $2A
+COL_T5H EQU 1
+ROW_T5H EQU $20
+COL_T6H EQU 1
+ROW_T6H EQU $12
+;
+COL_T1I EQU 0
+ROW_T1I EQU $44
+COL_T2I EQU 0
+ROW_T2I EQU $3C
+COL_T3I EQU 0
+ROW_T3I EQU $32
+COL_T4I EQU 0
+ROW_T4I EQU $2A
+COL_T5I EQU 0
+ROW_T5I EQU $20
+COL_T6I EQU 0
+ROW_T6I EQU $12
+;
+;
+COL_TP23 EQU 0
+ROW_TP23 EQU $36
+;
+COL_TD23 EQU 1
+ROW_TD23 EQU $36
+;
+COL_TD34 EQU 4
+ROW_TD34 EQU $2E
+;
+COL_TD45 EQU 1
+ROW_TD45 EQU $24
+;
+COL_TP45 EQU 0
+ROW_TP45 EQU $24
+;
+;
+COL_M1A EQU 4
+ROW_M1A EQU $42
+COL_M2A EQU 4
+ROW_M2A EQU $3A
+COL_M3A EQU 4
+ROW_M3A EQU $30
+COL_M4A EQU 4
+ROW_M4A EQU $28
+COL_M5A EQU 4
+ROW_M5A EQU $1E
+COL_M6A EQU 4
+ROW_M6A EQU $10
+;
+COL_M1B EQU 3
+ROW_M1B EQU $40
+COL_M2B EQU 3
+ROW_M2B EQU $38
+COL_M3B EQU 3
+ROW_M3B EQU $2E
+COL_M4B EQU 3
+ROW_M4B EQU $26
+COL_M5B EQU 3
+ROW_M5B EQU $1C
+COL_M6B EQU 3
+ROW_M6B EQU $0E
+;
+COL_M1C EQU 2
+ROW_M1C EQU $40
+COL_M2C EQU 2
+ROW_M2C EQU $38
+COL_M3C EQU 2
+ROW_M3C EQU $2E
+COL_M4C EQU 2
+ROW_M4C EQU $26
+COL_M5C EQU 2
+ROW_M5C EQU $1C
+COL_M6C EQU 2
+ROW_M6C EQU $0E
+;
+COL_M1D EQU 2
+ROW_M1D EQU $46
+COL_M2D EQU 2
+ROW_M2D EQU $3E
+COL_M3D EQU 2
+ROW_M3D EQU $34
+COL_M4D EQU 2
+ROW_M4D EQU $2C
+COL_M5D EQU 2
+ROW_M5D EQU $22
+COL_M6D EQU 2
+ROW_M6D EQU $14
+;
+COL_M1E EQU 3
+ROW_M1E EQU $46
+COL_M2E EQU 3
+ROW_M2E EQU $3E
+COL_M3E EQU 3
+ROW_M3E EQU $34
+COL_M4E EQU 3
+ROW_M4E EQU $2C
+COL_M5E EQU 3
+ROW_M5E EQU $22
+COL_M6E EQU 3
+ROW_M6E EQU $14
+;
+COL_M1F EQU 4
+ROW_M1F EQU $46
+COL_M2F EQU 4
+ROW_M2F EQU $3E
+COL_M3F EQU 4
+ROW_M3F EQU $34
+COL_M4F EQU 4
+ROW_M4F EQU $2C
+COL_M5F EQU 4
+ROW_M5F EQU $22
+COL_M6F EQU 4
+ROW_M6F EQU $14
+;
+COL_M1G EQU 3
+ROW_M1G EQU $44
+COL_M2G EQU 3
+ROW_M2G EQU $3C
+COL_M3G EQU 3
+ROW_M3G EQU $32
+COL_M4G EQU 3
+ROW_M4G EQU $2A
+COL_M5G EQU 3
+ROW_M5G EQU $20
+COL_M6G EQU 3
+ROW_M6G EQU $12
+;
+COL_M1H EQU 4
+ROW_M1H EQU $44
+COL_M2H EQU 4
+ROW_M2H EQU $3C
+COL_M3H EQU 4
+ROW_M3H EQU $32
+COL_M4H EQU 4
+ROW_M4H EQU $2A
+COL_M5H EQU 4
+ROW_M5H EQU $20
+COL_M6H EQU 4
+ROW_M6H EQU $12
+;
+COL_M1I EQU 2
+ROW_M1I EQU $44
+COL_M2I EQU 2
+ROW_M2I EQU $3C
+COL_M3I EQU 2
+ROW_M3I EQU $32
+COL_M4I EQU 2
+ROW_M4I EQU $2A
+COL_M5I EQU 2
+ROW_M5I EQU $20
+COL_M6I EQU 2
+ROW_M6I EQU $12
+;
+;
+COL_MC23 EQU 3
+ROW_MC23 EQU $36
+;
+COL_MP23 EQU 2
+ROW_MP23 EQU $36
+;
+COL_MD45 EQU 3
+ROW_MD45 EQU $24
+;
+COL_MP45 EQU 2
+ROW_MP45 EQU $24
+;
+;
+COL_AM EQU 4
+ROW_AM EQU $48
+;
+COL_PM EQU 4
+ROW_PM EQU $40
+;
+COL_REMIND EQU 4
+ROW_REMIND EQU $38
+;
+COL_NIGHT EQU 4
+ROW_NIGHT EQU $26
+;
+COL_ALARM EQU 4
+ROW_ALARM EQU $1C
+;
+COL_NOTE EQU 4
+ROW_NOTE EQU $0E
+;
+; S1A1=2:47 S1B1=3:47 S1C1=4:47 S1D1=0:47 S1E1=1:47
+; S1A2=2:45 S1B2=3:45 S1C2=4:45 S1D2=0:45 S1E2=1:45
+; S1A3=2:43 S1B3=3:43 S1C3=4:43 S1D3=0:43 S1E3=1:43
+; S1A4=2:41 S1B4=3:41 S1C4=4:41 S1D4=0:41 S1E4=1:41
+; S1A5=2:3F S1B5=3:3F S1C5=4:3F S1D5=0:3F S1E5=1:3F
+;
+; S2A1=2:3D S2B1=3:3D S2C1=4:3D S2D1=0:3D S2E1=1:3D
+; S2A2=2:3B S2B2=3:3B S2C2=4:3B S2D2=0:3B S2E2=1:3B
+; S2A3=2:39 S2B3=3:39 S2C3=4:39 S2D3=0:39 S2E3=1:39
+; S2A4=2:37 S2B4=3:37 S2C4=4:37 S2D4=0:37 S2E4=1:37
+; S2A5=2:35 S2B5=3:35 S2C5=4:35 S2D5=0:35 S2E5=1:35
+;
+; S3A1=2:33 S3B1=3:33 S3C1=4:33 S3D1=0:33 S3E1=1:33
+; S3A2=2:31 S3B2=3:31 S3C2=4:31 S3D2=0:31 S3E2=1:31
+; S3A3=2:2F S3B3=3:2F S3C3=4:2F S3D3=0:2F S3E3=1:2F
+; S3A4=2:2D S3B4=3:2D S3C4=4:2D S3D4=0:2D S3E4=1:2D
+; S3A5=2:2B S3B5=3:2B S3C5=4:2B S3D5=0:2B S3E5=1:2B
+;
+; S4A1=2:27 S4B1=3:27 S4C1=4:27 S4D1=0:27 S4E1=1:27
+; S4A2=2:25 S4B2=3:25 S4C2=4:25 S4D2=0:25 S4E2=1:25
+; S4A3=2:23 S4B3=3:23 S4C3=4:23 S4D3=0:23 S4E3=1:23
+; S4A4=2:21 S4B4=3:21 S4C4=4:21 S4D4=0:21 S4E4=1:21
+; S4A5=2:1F S4B5=3:1F S4C5=4:1F S4D5=0:1F S4E5=1:1F
+;
+; S5A1=2:1D S5B1=3:1D S5C1=4:1D S5D1=0:1D S5E1=1:1D
+; S5A2=2:1B S5B2=3:1B S5C2=4:1B S5D2=0:1B S5E2=1:1B
+; S5A3=2:19 S5B3=3:19 S5C3=4:19 S5D3=0:19 S5E3=1:19
+; S5A4=2:17 S5B4=3:17 S5C4=4:17 S5D4=0:17 S5E4=1:17
+; S5A5=2:15 S5B5=3:15 S5C5=4:15 S5D5=0:15 S5E5=1:15
+;
+; S6A1=2:13 S6B1=3:13 S6C1=4:13 S6D1=0:13 S6E1=1:13
+; S6A2=2:11 S6B2=3:11 S6C2=4:11 S6D2=0:11 S6E2=1:11
+; S6A3=2:0F S6B3=3:0F S6C3=4:0F S6D3=0:0F S6E3=1:0F
+; S6A4=2:0D S6B4=3:0D S6C4=4:0D S6D4=0:0D S6E4=1:0D
+; S6A5=2:0B S6B5=3:0B S6C5=4:0B S6D5=0:0B S6E5=1:0B
+;
+; S7A1=2:09 S7B1=3:09 S7C1=4:09 S7D1=0:09 S7E1=1:09
+; S7A2=2:07 S7B2=3:07 S7C2=4:07 S7D2=0:07 S7E2=1:07
+; S7A3=2:05 S7B3=3:05 S7C3=4:05 S7D3=0:05 S7E3=1:05
+; S7A4=2:03 S7B4=3:03 S7C4=4:03 S7D4=0:03 S7E4=1:03
+; S7A5=2:01 S7B5=3:01 S7C5=4:01 S7D5=0:01 S7E5=1:01
+;
+; S8A1=2:02 S8B1=3:02 S8C1=4:02 S8D1=1:02 S8E1=0:02
+; S8A2=2:04 S8B2=3:04 S8C2=4:04 S8D2=1:04 S8E2=0:04
+; S8A3=2:06 S8B3=3:06 S8C3=4:06 S8D3=1:06 S8E3=0:06
+; S8A4=2:08 S8B4=3:08 S8C4=4:08 S8D4=1:08 S8E4=0:08
+; S8A5=2:0a S8B5=3:0a S8C5=4:0a S8D5=1:0a S8E5=0:0a
+;
+;
+; Character set
+;
+C_0 EQU 0
+C_A EQU $0A
+C_SPACE EQU $24
+C_LEFTARR EQU $33 ; Symbol for the previous key
+C_RIGHTARR EQU $3D ; Symbol for the next key
+C6_SPACE EQU $1d
+; The basic timex character set is:
+; 0 1 2 3 4 5 6 7 8 9 A B C D E F
+; G H I J K L M N O P Q R S T U V
+; W X Y Z ! " # $ % & ' ( ) * +
+; , - . / : ; < = > ? @ A B C D E
+;
+; We also have the timex6 character set as:
+; 0 1 2 3 4 5 6 7 8 9 A B C D E F
+; G H : L M N P R T U W Y r - +
+;
+
+EVT_NEXT EQU $00 ; Next button pressed (not interested in the up transition)
+EVT_MODE EQU $01 ; Mode button pressed (not interested in the up transition)
+EVT_SET EQU $02 ; Set/Delete button pressed (not interested in the up transition)
+EVT_PREV EQU $03 ; Prev button pressed (not interested in the up transition)
+EVT_GLOW EQU $04 ; Indiglo button pressed (not interested in the up transition)
+EVT_ANY EQU $05 ; Any button pressed (not interested in the up transition)
+EVT_ANY4 EQU $06 ; Any button pressed except indiglo (not interested in the up transition)
+EVT_RESUME EQU $1a ; Called when resuming from a nested app
+EVT_ENTER EQU $1b ; Initial state. The Time value is generally $01 or $84 for a well behaved app
+EVT_NEST EQU $1c ; The state table 1 entry called when a nested application is called. It is the equivalent of
+ ; EVT_ENTER for an interrupt. This only occurs for Wristapps, Timer, and appt apps.
+EVT_END EQU $1d ; End of event table indicator
+EVT_TIMER1 EQU $1e ; Timer event - This is fired for a $83 time request
+EVT_TIMER2 EQU $1f ; Timer event - This is fired for a $82,$84,$01 timer request
+; $20-$36 - UNUSED
+; (I bet that you can have user specified events for these too)
+EVT_USER0 EQU $37
+EVT_USER1 EQU $38
+EVT_USER2 EQU $39
+EVT_USER3 EQU $3a ; User specified events. Queued by calling POSTEVENT ($4E89)
+; $3b-$7f - UNUSED
+EVT_DNNEXT EQU $80 ; Next button pressed
+EVT_DNMODE EQU $81 ; Mode button pressed
+EVT_DNSET EQU $82 ; Set/Delete button pressed
+EVT_DNPREV EQU $83 ; Prev button pressed
+EVT_DNGLOW EQU $84 ; Indiglo button pressed
+EVT_DNANY EQU $85 ; Any of the four buttons Pressed
+EVT_DNANY4 EQU $86 ; Any button pressed except indiglo
+
+; $87-$9F - UNUSED
+EVT_UPNEXT EQU $A0 ; Next button released
+EVT_UPMODE EQU $A1 ; Mode button released
+EVT_UPSET EQU $A2 ; Set/Delete button released
+EVT_UPPREV EQU $A3 ; Prev button released
+EVT_UPGLOW EQU $A4 ; Indiglo button released
+EVT_UPANY EQU $A5 ; Any of the four buttons Released
+EVT_UPANY4 EQU $A6 ; Any button Released except indiglo
+
+TIM_ONCE EQU $ff ; No time interval. Operation is executed just once
+
+TIM_1_TIC EQU $00
+TIM_1_2TIC EQU $01
+TIM_1_3TIC EQU $02
+TIM_1_4TIC EQU $03
+TIM_1_HALFSEC EQU $04
+TIM_1_SECOND EQU $05
+TIM_1_SECHALF EQU $06
+TIM_1_TWOSEC EQU $07
+TIM_1_TWOSEC1 EQU $08
+TIM_1_12SEC EQU $09
+TIM_1_18SEC EQU $0a
+;
+; Note that the second part of this table is happen-stance since it is really a rollover
+; of the second table on top of the first one. But it might be useful to someone...
+;
+TIM_1_TICA EQU $0b ; This is the typical scroll interval
+TIM_1_2TICA EQU $0c
+TIM_1_4TICA EQU $0d
+TIM_1_8TIC EQU $0e ; This is the normal blink interval
+TIM_1_12TIC EQU $0f ; Just over a second
+TIM_1_16TIC EQU $10 ; A second and a half
+TIM_1_24TIC EQU $11 ; Two and a half seconds
+TIM_1_32TIC EQU $12 ; Just over three seconds
+TIM_1_40TIC EQU $13 ; Four seconds
+TIM_1_48TIC EQU $14 ; Almost five seconds
+TIM_1_96TIC EQU $15 ; Almost ten seconds
+
+TIM_2_TIC EQU $80 ; This is the typical scroll interval
+TIM_2_2TIC EQU $81
+TIM_2_4TIC EQU $82
+TIM_2_8TIC EQU $83 ; This is the normal blink interval
+TIM_2_12TIC EQU $84 ; Just over a second
+TIM_2_16TIC EQU $85 ; A second and a half
+TIM_2_24TIC EQU $86 ; Two and a half seconds
+TIM_2_32TIC EQU $87 ; Just over three seconds
+TIM_2_40TIC EQU $88 ; Four seconds
+TIM_2_48TIC EQU $89 ; Almost five seconds
+TIM_2_96TIC EQU $8a ; Almost ten seconds
+
+TIM_LONG1 EQU $01 ; Long shot time interval - Fires a $1F when the the timer expires
+TIM_03 EQU $03 ; Unknown
+TIM_08 EQU $08 ; Unknown
+
+TIM_SHORT EQU $82 ; Short timer - Fires a $1F event when the timer expires
+TIM_MED EQU $83 ; Medium timer - Fires a $1E event when the timer expires
+TIM_LONG EQU $84 ; Long timer - Fires a $1F event when the timer expires
+TIM_86 EQU $86 ; ?Timer
+;--------------------------------------------------------------------------------
+SNDSTART EQU $4e4a ; Start playing the current sound in SYSSOUND
+;--------------------------------------------------------------------------------
+PLAYCONF EQU $4e7a ; Play a confirmation sound
+PLAYBUTTON EQU $4e80 ; Play the button beep sound if no other sound is currently playing
+;--------------------------------------------------------------------------------
+POSTEVENT EQU $4e89 ; Post a event to the internal processing queue
+; Parameters:
+; A - Event to be posted.
+; This posts an event to run through the processing loop for the current applet.
+; Typical user events are in the $30-$3F range.
+;
+;--------------------------------------------------------------------------------
+INDIGLO_OFF EQU $4e8e ; This routine turns off the indiglo light
+;--------------------------------------------------------------------------------
+SNDSTOP EQU $4f3a ; This stops whatever sound is currently playing
+;--------------------------------------------------------------------------------
+CALL_NESTEDAPP EQU $4f4d
+; Purpose:
+; This sets up to call a nested application while the current one is running.
+; Up to 5 apps may be nested (although there are only 3 potential ones defined).
+; If more than 5 have been called the oldest one will be forgotten.
+; When the nested app is called, NESTED_APP will be set to the application number
+; passed in and NESTED_PARM will contain the X parameter passed in
+;
+; Parameters:
+; A - Nested application number. This is one of the three defined apps:
+; 9 = APP2_ALARM - Alarm (while another app is running)
+; 10 = APP2_APPT - Appointment (while another app is running)
+; 11 = APP2_WRIST - Wristapp (while another app is running)
+; X - Parameter to pass to the nested application
+;--------------------------------------------------------------------------------
+SET_INDIGLO EQU $5504 ; This routine turns on/off the indiglo light
+; Parameters:
+; 0,Sys_9e - Bit indicates request for on or off
+;--------------------------------------------------------------------------------
+PUTSCROLLMSG EQU $5522 ; Make the buffer at MSGBUF visible
+;--------------------------------------------------------------------------------
+SCROLLMSG EQU $5545 ; Start the scrolling cycle for the current message
+; Parameters:
+; MSGBUF - Message to be scroll terminated by a SEPARATOR character
+;--------------------------------------------------------------------------------
+SCROLLMSG_CONT EQU $5549 ; Start the scrolling cycle for the current message, but don't reset the
+ ; scrolling cycle wait count.
+; Parameters:
+; MSGBUF - Message to be scroll terminated by a SEPARATOR character
+; SCROLL_TICS - The current tic count in the cycle
+;--------------------------------------------------------------------------------
+START_BLINKX EQU $55bb ; Establish and call the specified blinking rountine
+; Parameters:
+; X - single byte parameter to the particular blinking function
+; A - Blinking function to be selected
+;--------------------------------------------------------------------------------
+START_BLINKP EQU $55BF ; Establish and call the specified blinking rountine
+; Parameters:
+; X - Address of parameter to the particular blinking function
+; A - Blinking function to be selected
+BLINK_YEAR EQU 0 ; Blink the year in the right place according to the current time format
+BLINK_SECONDS EQU 1 ; Blink two characters point to by UPDATE_PARM on the right two digits of the middle line - Used for the seconds
+BLINK_AMPM EQU 2 ; Blink AM/PM on the right most digits of the middle line (A or P pointed to by UPDATE_PARM)
+BLINK_MONTH EQU 3 ; Blink the month in the right place according to the current time format
+BLINK_HMONTH EQU 4 ; Blink the month in the right place according to the current time format for a half date (no year)
+BLINK_DAY EQU 5 ; Blink the day in the right place according to the current time format
+BLINK_HDAY EQU 6 ; Blink the day in the right place according to the current time format for half dates
+BLINK_MID12 EQU 7 ; Blink the left two blank padded digits on the middle line (value pointed to by UPDATE_PARM)
+BLINK_HOUR EQU 8 ; Blink the Hour (left two segments on the middle line) and AM/PM indicator (hour point to by UPDATE_PARM)
+BLINK_MID34 EQU 9 ; Blink the middle two zero padded digits on the middle line (value pointed to by UPDATE_PARM)
+BLINK_SEGMENT EQU 10 ; Blink a single segment indicated by UPDATE_POS and mask in UPDATE_VAL
+BLINK_DIGIT EQU 11 ; Blink solid black cursor for the digit (UPDATE_POS is the location on the bottom line)
+BLINK_TZONE EQU 12 ; Blink the timezone information (Pointed to by UPDATE_PARM)
+BLINK_TOP34 EQU 13 ; Blink the middle zero padded two digits on the top line (value pointed to by UPDATE_PARM)
+;--------------------------------------------------------------------------------
+PUTLINE3 EQU $56d5 ; Put a single character on the bottom line of the display
+POSL3_1 EQU $47
+POSL3_2 EQU $3d
+POSL3_3 EQU $33
+POSL3_4 EQU $27
+POSL3_5 EQU $1d
+POSL3_6 EQU $13
+POSL3_7 EQU $09
+POSL3_8 EQU $0a
+; Parameters:
+; A = Position S1 S2 S3 S4 S5 S6 S7 S8
+; [$47] [$3D] [$33] [$27] [$1D] [$13] [$09] [$0A]
+; [ 71] [ 61] [ 51] [ 39] [ 29] [ 19] [ 9] [ 10]
+; X = Character in Timex Ascii to display
+; Notes:
+; This appears to be an XOR operation. Calling the same function twice in a row would
+; erase the character. Writing on top of an existing character seems to let you generate
+; a non Ascii character.
+
+PUTLINE1 EQU $570D ; Put a single character on the top line of the display
+POSL1_1 EQU $46
+POSL1_2 EQU $3e
+POSL1_3 EQU $34
+POSL1_4 EQU $2c
+POSL1_5 EQU $22
+POSL1_6 EQU $14
+; Parameters:
+; A = Position [$46] [$3E] - [$34] [$2C] - [$22] [$14]
+; [ 70] [ 62] [ 52] [ 44] [ 34] [20]
+; X = Character in Timex Ascii to display
+
+PUTLINE2 EQU $5745 ; Put a single character on the second line of the display
+POSL2_1 EQU $46
+POSL2_2 EQU $3e
+POSL2_3 EQU $34
+POSL2_4 EQU $2c
+POSL2_5 EQU $22
+POSL2_6 EQU $14
+; Parameters:
+; A = Position [$46] [$3E] - [$34] [$2C] - [$22] [$14]
+; [ 70] [ 62] [ 52] [ 44] [ 34] [20]
+; X = Character in Timex Ascii to display
+
+CLEARALL EQU $577A ; Clear the display
+CLEARBOT EQU $5787 ; Clear the bottom line of the display
+CLEARSYM EQU $579f ; Turns off all the non digit symbols segments (including dots, dashes and colons)
+;-------------------------------------------------------------------------
+START_UPDATEX equ $57c3 ; Establish and call the specified update function (See START_UPDATEP)
+; Parameters:
+; X - single byte parameter to the particular update function
+; A - Update function to be selected
+;-------------------------------------------------------------------------
+START_UPDATEP EQU $57C7 ; This establishes an update function. Update functions are called every 8/10th
+ ; of a second. This function will update a number in an upward or downward
+ ; direction based on the setting of 0,SYSFLAGS
+; Parameters:
+; A - Update function to be selected
+; X - Pointer to parameters for the update function
+UPD_YEAR EQU 0 ; Update the year
+UPD_MONTH EQU 1 ; Update the Month
+UPD_HMONTH EQU 2 ; Update the Month in Half date format
+UPD_DAY EQU 3 ; Update the day
+UPD_HDAY EQU 4 ; Update the day in half date format
+UPD_MID12 EQU 5 ; Update MID12
+UPD_HOUR EQU 6 ; Update the hour
+UPD_MID34 EQU 7 ; Update MID34
+UPD_DIGIT EQU 8 ; Update the digit at UPDATE_POS
+;-------------------------------------------------------------------------
+BANNER8 EQU $5845 ; Display an 8 character string
+; Parameters
+; A = Offset from 0110 for the start of an 8 character timex string
+;
+;-------------------------------------------------------------------------
+PUTMSGXBOT EQU $5849 ; Puts a message on the bottom of the screen.
+; Parameters
+; A = Message selector number. Valid values from 0 to 27. They correspond to
+; the same strings passed into PUTMSGBOT scaled down by 8
+;-------------------------------------------------------------------------
+PUTMSGBOT EQU $584c ; Puts a message on the bottom of the screen.
+; Parameters
+; A = Offset into message selector string. Valid values from from $00 to $d8 at
+; 8 Byte offsets. $E0 is the start of the 6 byte top/mid message strings.
+SYS8_MON EQU $00 ; $00 = "MON "
+SYS8_TUE EQU $08 ; $08 = "TUE "
+SYS8_WED EQU $10 ; $10 = "WED "
+SYS8_THU EQU $18 ; $18 = "THU "
+SYS8_FRI EQU $20 ; $20 = "FRI "
+SYS8_SAT EQU $28 ; $28 = "SAT "
+SYS8_SUN EQU $30 ; $30 = "SUN "
+SYS8_VERDATE EQU $38 ; $38 = " 802003 "
+SYS8_VERSION EQU $40 ; $40 = " V2.0 "
+SYS8_MODE EQU $48 ; $48 = " MODE "
+SYS8_SET_MODE EQU $50 ; $50 = "SET MODE"
+SYS8_SET EQU $58 ; $58 = "SET "
+SYS8_TO EQU $60 ; $60 = "TO "
+SYS8_FOR EQU $68 ; $68 = "FOR "
+SYS8_ENTRIES EQU $70 ; $70 = "ENTRIES "
+SYS8_UPCOMING EQU $78 ; $78 = "UPCOMING"
+SYS8_ENTRY EQU $80 ; $80 = " ENTRY "
+SYS8_SCAN EQU $88 ; $88 = " SCAN "
+SYS8_SCAN_RIGHT EQU $90 ; $90 = " SCAN"
+SYS8_SYNCING EQU $98 ; $98 = " SYNCING"
+SYS8_PROGRESS EQU $a0 ; $a0 = "PROGRESS"
+SYS8_DATA_OK EQU $a8 ; $a8 = " DATA OK"
+SYS8_RESEND EQU $b0 ; $b0 = "-RESEND-"
+SYS8_ABORTED EQU $b8 ; $b8 = " ABORTED"
+SYS8_MISMATCH EQU $c0 ; $c0 = "MISMATCH"
+SYS8_SPLIT EQU $c8 ; $c8 = " SPLIT "
+SYS8_START EQU $d0 ; $d0 = ">=START "
+SYS8_STOP EQU $d8 ; $d8 = ">=STOP "
+; $e0 is the start of the message table SYS6_SET
+;
+PUT6TOP EQU $587e
+; Parameters:
+; A = Offset from 0110 for the start of a 6 byte data item to be put on the top
+; line of the screen. This uses a different encoding for characters where:
+; we have 32 different values which correspond to:
+; "0123456789ABCDEFGH:LMNPRTUWYr -+"
+; 0123456789abcdef0123456789abcdef
+; e.g. $12=':', $13='L'.
+; It appears that things wrap when you get to $20
+;
+PUTMSG1 EQU $5882 ; Put up a message on the top line
+; Parameters - Offset into message selector string.
+; Typically you want a multiple of 6 to choose from these below
+;
+SYS6_SET EQU $00 ; 00 = " SET " (This is stored at $5F5F in the roms)
+SYS6_HOLDTO EQU $06 ; 06 = "HOLDTO"
+SYS6_ALARM EQU $0C ; 0C = "ALARM "
+SYS6_ENTER EQU $12 ; 12 = "ENTER "
+SYS6_HR EQU $18 ; 18 = " HR"
+SYS6_SWITCH EQU $1E ; 1E = "SWITCH"
+SYS6_TIME EQU $24 ; 24 = " TIME "
+SYS6_FORMAT EQU $2A ; 2A = "FORMAT"
+SYS6_DAILY EQU $30 ; 30 = "DAILY "
+SYS6_APPT EQU $36 ; 36 = " APPT "
+SYS6_NO EQU $3c ; 3c = " NO "
+SYS6_APPTS EQU $42 ; 42 = "APPTS "
+SYS6_END_OF EQU $48 ; 48 = "END OF"
+SYS6_LIST EQU $4e ; 4e = " LIST "
+SYS6_DELETE EQU $54 ; 54 = "DELETE"
+SYS6_ANN EQU $5a ; 5a = " ANN "
+SYS6_PHONE EQU $60 ; 60 = "PHONE "
+SYS6_DONE EQU $66 ; 66 = " DONE "
+SYS6_PRI EQU $6c ; 6c = "PRI "
+SYS6_COMM EQU $72 ; 72 = " COMM "
+SYS6_READY EQU $78 ; 78 = "READY "
+SYS6_IN EQU $7e ; 7e = " IN "
+SYS6_ERROR EQU $84 ; 84 = "ERROR "
+SYS6_CEASED EQU $8a ; 8a = "CEASED"
+SYS6_PC EQU $90 ; 90 = "PC- "
+SYS6_WATCH EQU $96 ; 96 = "WATCH "
+SYS6_CHRONO EQU $9c ; 9c = "CHRONO"
+SYS6_TIMER EQU $A2 ; A2 = "TIMER "
+SYS6_000000 EQU $a8 ; a8 = "000000"
+; ae = "MTWTFS"
+; B4 = "SOUEHR"
+; BA = "AUG+74"
+; C0 = "P16174"
+; C6 = "P1OY40"
+; CC = "W+0++0"
+; D2 = "251332"
+; D8 = "0321++"
+; DE = "R++ 0+"
+; E4 = "+12+1T"
+; EA = "+0 0+1"
+; F0 = "26+2U+"
+; F6 = "0 C100"
+; FC = "C0GW"
+;
+PUT6MID EQU $58a8
+; Parameters:
+; A = Offset from 0110 for the start of a 6 byte data item to be put on the top
+; line of the screen. This uses a different encoding for characters where:
+; we have 32 different values which correspond to:
+; "0123456789ABCDEFGH:LMNPRTUWYr -+"
+; e.g. $12=':', $13='L'.
+; It appears that things wrap when you get to $20
+;
+; PUT6MIDA was identified wrong...
+PUTMSG2 EQU $58AC ; This functions just the same as PUTMSG1 except it puts things on the middle line
+CLEARTOP EQU $58d2 ; Puts blanks into all 6 top digits (Blanks out the top line)
+; Parameters:
+; None
+CLEARMID EQU $58d8 ; Puts blanks into all 6 Middle digits (Blanks out the middle line)
+; Parameters:
+; None
+;-------------------------------------------------------------------------
+; These next 6 routines take the two bytes in DATDIGIT1 ($A2) and DATDIGIT2($A3) and put them
+; on the display in the appropriate locations. The digits are represented using the TIMEX6
+; character set.
+;
+PUTTOP12 EQU $58e0 ; Puts DATDIGIT1/2 into TOP Digits 1 and 2
+PUTTOP34 EQU $58f0 ; Puts DATDIGIT1/2 into TOP Digits 3 and 4
+PUTTOP56 EQU $5900 ; Puts DATDIGIT1/2 into TOP Digits 5 and 6
+PUTMID12 EQU $5910 ; Puts DATDIGIT1/2 into Middle Digits 1 and 2
+PUTMID34 EQU $5920 ; Puts DATDIGIT1/2 into Middle Digits 3 and 4
+PUTMID56 EQU $5930 ; Puts DATDIGIT1/2 into Middle Digits 5 and 6
+; These 6 routines blank out parts of the display
+CLRTOP12 EQU $58de ; Puts Blanks into TOP Digits 1 and 2
+CLRTOP34 EQU $58ee ; Puts Blanks into TOP Digits 3 and 4
+CLRTOP56 EQU $59fe ; Puts Blanks into TOP Digits 5 and 6
+CLRMID12 EQU $590e ; Puts Blanks into Middle Digits 1 and 2
+CLRMID34 EQU $591e ; Puts Blanks into Middle Digits 3 and 4
+CLRMID56 EQU $592e ; Puts Blanks into Middle Digits 5 and 6
+;
+FMTXLEAD0 EQU $593E ; Formats into DATDIGIT1/2 with leading zeros
+; Parameters:
+; X - value to be formatted. 0-9 results in 0 followed by the digit
+; 10-99 results in number for both digits
+FMTBLANK0 EQU $594d ; Format into DATDIGIT1/2
+; Parameters:
+; X - value to be formatted. 0 results in all blanks.
+; 1-9 results in blank followed by the digit
+; 10-99 results in number for both digits
+FMTX EQU $5951 ; Format into DATDIGIT1/2
+; Parameters:
+; X - value to be formatted. 0-9 results in blank followed by the digit
+; 10-99 results in number for both digits
+
+FMTSPACE EQU $595C ; Format blankes into DATDIGIT1/2
+; Parameters: NONE
+; This routine simply puts spaces into DATDIGIT1 DATDIGIT2
+;
+SAYEOLMSG EQU $5979 ; Puts 'END OF LIST' on the display
+PUTBOT678 EQU $5a86 ; Puts three digits into the lower corner of the display.
+; Typically this is the time zone information.
+; Parameters:
+; X - Pointer to 3 byte location containing bytes to put on the display
+; (pointed to by x) 3 bytes in TIMEX ascii. Because the X register iss
+; used to index to them, they must be located in the first 256 bytes of
+; memory.
+PUTDATESEP EQU $5aab ; Put either Dashes or periods on the top line
+
+DIGLOCTOP EQU $5e26 ; Locations of digits on the top line
+DIGLOCMID EQU $5e2c ; Locations of digits on the middle line
+DIGLOCBOT EQU $5e32 ; Locations of digits on the bottom line
+
+;-------------------------------------------------------------------------
+PUT_YEARX EQU $67cc ; Put the leading zero 2 digit year in the appropriate spot on the display based
+ ; on the current time zone date format
+; Parameters:
+; X - Year to be displayed
+;-------------------------------------------------------------------------
+PUT_MONTHX EQU $67d0 ; Put the leading space 2 digit month in the appropriate spot on the display based
+ ; on the current time zone date format
+; Parameters:
+; X - Month to be displayed
+;-------------------------------------------------------------------------
+PUT_DAYX EQU $67d4 ; Put the leading zero 2 digit day in the appropriate spot on the display based
+ ; on the current time zone date format
+; Parameters:
+; X - Day to be displayed
+;-------------------------------------------------------------------------
+SAY_HOURX EQU $67d8 ; Puts up the hour on the display along with an AM/PM indicator and a Colon.
+ ; This code respects the current 12/24 hour format.
+; Parameters:
+; X - Hour to be displayed
+;-------------------------------------------------------------------------
+PUT_MINUTEX EQU $6823 ; This puts the minute in the middle two digits on the middle line followed by a period
+; Parameters:
+; X - minute (0-59) to be displayed
+;-------------------------------------------------------------------------
+SHOWSEC_TENS EQU $6830 ; Puts the character at SECOND_TENS onto the next to the last digit on the middle line
+; Parameters:
+; SECOND_TENS - Value to be put on the display
+;-------------------------------------------------------------------------
+SHOWSEC_ONES EQU $6838 ; Puts the character at SECOND_ONES onto the last digit on the middle line
+; Parameters:
+; SECOND_ONES - Value to be put on the display
+;-------------------------------------------------------------------------
+CALC_DOW_X EQU $68d5 ; Computes the Day of the Week from the Month, Day, Year information
+; Parameters:
+; X - Pointer to Month, Day, Year block
+;-------------------------------------------------------------------------
+ACQUIRE EQU $68e8 ; Disable interrupts for a short piece of code
+RELEASE EQU $68f2 ; Reenable interrupts
+;-------------------------------------------------------------------------
+GET_MONTHLEN EQU $68f9 ; Computes the number of days in a given month
+; Parameters:
+; PARM_MONTH, PARM_YEAR contain the month and year to look for
+; Returns:
+; A - Number of days in the month
+;-------------------------------------------------------------------------
+SETALL EQU $5776 ; Turn on all segments on the display
+INCA_WRAPX EQU $6b0d ; Advance to the next value wrapped within a range
+; Parameters:
+; A - Number to be incremented
+; X - Range to hold number within
+;-------------------------------------------------------------------------
+GETBCDHI EQU $6B52
+; Parameters:
+; X - Hex value to be converted (Range 0-99)
+; Returns:
+; A - High byte of number in timex ascii
+;-------------------------------------------------------------------------
+GETBCDLOW EQU $6B5A
+; Parameters:
+; X - Hex value to be converted (Range 0-99)
+; Returns:
+; A - Low byte of number in timex ascii
+;-------------------------------------------------------------------------
+TABHEX2BCD EQU $6b60 ; 100 bytes from 6b60-6bc3
+; This is a 100 byte table of HEX to BCD conversion values. You can take the value you want
+; to convert, load it into the X register and then load TABHEX2BCX,X. To get the high order byte,
+; just shift it right by 4. The low order is just an and with $0f.
+
+SYS_26 EQU $26
+MODE_FLAGS EQU $68 ; FLAGS
+ ; Bit0 = Indicates that we are in alarm set mode (SET=IN SET MODE)
+ ; Bit1 = Indicates that we have a backup mode pending alarm (SET=PENDING)
+ ; Bit2 = Indicates that hourly chimes are to be played (SET=ENABLED)
+ ; Bit3 = Indicates that hourly chimes are temporarily disabled (SET=DISABLED)
+ ; Bit4 = Enables beep for any button pressed (SET=BEEP)
+ ; Bit5 = Indicates that we are in COMM Mode (SET=IN COMM Mode)
+ ; Bit6 = Indicates that ALARM SET MODE is on the display (SET=On Display)
+ ; Bit7 = <UNUSED>
+APP_FLAGS EQU $8f ; System Flags
+ ; Bit0 = Event has been posted (SET=TRUE)
+ ; Bit1 = We want to allow the app to be suspended (SET=ALLOW)
+ ; Bit2 = Run a nested application (SET=TRUE) - only for ALARM,APPT, WRISTAPP
+ ; Bit3 = A button beep has already been played (SET=PLAYED)
+ ; Bit4 = <UNUSED>
+ ; Bit5 = <UNUSED>
+ ; Bit6 = <UNUSED>
+ ; Bit7 = <UNUSED>
+BTNFLAGS EQU $90 ; Flags for the timer. Note that bits 5 and 7 are exclusive because they happen to
+ ; use the same variables to hold their information.
+ ; Bit0 = <UNUSED>
+ ; Bit1 = wristapp wants a 1/10 second timer function called (WRIST_DOTIC) (SET=CALL)
+ ; Bit2 = Indicates a blink routine is pending (SET=PENDING)
+ ; Bit3 = Indicates a scrolling message is pending (SET=PENDING)
+ ; Bit4 = Indicates an update routine is pending (SET=PENDING)
+ ; Bit5 = Indicates a blink routine has been established (SET=ACTIVE)
+ ; Bit6 = Indicates a scrolling message is in progress (SET=ACTIVE)
+ ; Bit7 = Indicates an update routine has been established (SET=ACTIVE)
+BTNSTATE EQU $91 ; Current event/button press
+TIMER_FLAGS EQU $94 ; System Flags
+ ; Bit0 = Indicates that the timer2 timer has been enabled (SET=ENABLED)
+ ; Bit1 = Indicates that the TIC timer has been enabled (SET=ENABLED)
+ ; Bit2 = Indicates that we want to turn off the indiglo automatically (SET=TURN OFF)
+ ; Bit3 = Indicates that they have done something in this applet (SET=done something)
+ ; Bit4 = Request to reset the watch (SET=Reset Watch)
+ ; Bit5 = Request to turn off the INDIGLO at some future time
+ ; Bit6 = <UNUSED>
+ ; Bit7 = ????Related to indicating that sound is currently playing
+MAIN_FLAGS EQU $95 ; Flags to set queue requests to do something in the main loop
+ ; Bit0 = Indicates that a button has changed state (SET=CHANGED)
+ ; Bit1 = Indicates that the current app should be suspended and TIME activated (SET=Suspend)
+ ; Bit2 = Indicates that the TIMER_TICS has been updated (SET=Updated)
+ ; Bit3 = Indicates that the hourly chimes need to be played (SET=Please Play)
+ ; Bit4 = Indicates that the appointments should be checked (SET=Please Check)
+ ; Bit5 = Indicates that the anniversaries need to be checked (SET=Please Check)
+ ; Bit6 = <UNUSED>
+ ; Bit7 = <UNUSED>
+WRISTAPP_FLAGS EQU $96 ; System Flags
+ ; Bit0 = wristapp wants a second timer function called at start of interrupt (WRIST_DOTIC) (SET=CALL)
+ ; Bit1 = wristapp wants a call once a minute when it changes (WRIST_DOTIC) (SET=CALL)
+ ; Bit2 = wristapp wants a call once an hour when it changes (WRIST_DOTIC) (SET=CALL)
+ ; Bit3 = wristapp wants a call once a day when it changes (WRIST_DOTIC) (SET=CALL)
+ ; Bit4 = Play button beep sound on wristapp for any button (SET=ENABLE)
+ ; Bit5 = Play button beep sound on wristapp for mode button (SET=ENABLE)
+ ; Bit6 = Uses system rules for button beep decisions (SET=SYSTEM RULES)
+ ; Bit7 = Wristapp has been loaded (SET=LOADED)
+NEST_PARM EQU $99 ; Holds the parameter passed to the current nested app
+SYSSOUND EQU $9B ; Current sound to be played
+SYSFLAGS EQU $9F ; System flags
+ ; Bit0 = Indicates the update direction. (SET=UP)
+ ; Bit1 = Indicates that the screen needs to be cleared (SET=no need to clear)
+ ; Also used as part of a the digit blinking code (SET=Show digits)
+ ; Bit2 = Indicates that the end of a scrolling message has been reached (SET=END)
+ ; Bit3 = User vs system string (SET=User String)
+ ; Bit4 = <UNUSED>
+ ; Bit5 = <UNUSED>
+ ; Bit6 = <UNUSED>
+ ; Bit7 = <UNUSED>
+DATDIGIT1 EQU $A2 ; First digit parameter for PUTMIDnn/PUTTOPnn routines
+DATDIGIT2 EQU $A3 ; Second digit parameter for PUTMIDnn/PUTTOPnn routines
+;
+; The sound in SYSSOUND can be set to one of the following values:
+;
+SND_HOURLY EQU $83 ; HOURLY CHIME
+SND_APPT EQU $85 ; APPOINTMENT BEEP
+SND_ALARM EQU $86 ; ALARM BEEP
+SND_DLOAD EQU $87 ; PROGRAM DOWNLOAD
+SND_EXTRA EQU $88 ; EXTRA
+SND_COMERR EQU $89 ; COMM ERROR
+SND_DONE EQU $8A ; COMM DONE
+SND_BUTTON EQU $c1 ; BUTTON BEEP
+SND_RETURN EQU $c2 ; RETURN TO TIME
+SND_CONF EQU $c4 ; CONFIRMATION
+
+APPT_PROMBASE EQU $0100 ; Address of the first entry for Appointments in the EEPROM
+LIST_PROMBASE EQU $0102 ; Address of the first entry for LISTs in the EEPROM
+PHONE_PROMBASE EQU $0104 ; Address of the first entry for PHONE numbers in the EEPROM
+ANNIV_PROMBASE EQU $0106 ; Address of the first entry for Anniversaries in the EEPROM
+APPT_ENTRIES EQU $0108 ; Number of currently loaded Appointment entries
+LIST_ENTRIES EQU $0109 ; Number of currently loaded LIST entries
+PHONE_ENTRIES EQU $010a ; Number of currently loaded Phone number entries
+ANNIV_ENTRIES EQU $010b ; Number of currently loaded Anniversary entries
+APPT_BASEYEAR EQU $010c ; The year for the first loaded appointment
+APPT_PRETIME EQU $010d ; How many minutes ahead of time to announce an appointment
+COMM_010e EQU $010e ; ????
+; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+SND_BASEOFF EQU $010f ; Sound base pointer - All sounds are this base relative to SND_BASE (0336)
+WRIST_MAIN EQU $0110 ; This is the primary initialization entry point for a Wristapp
+WRIST_SUSPEND EQU $0113 ; This is the entry point called immediately before suspending the wristapp
+WRIST_DOTIC EQU $0116 ; This is the entry point called for a timer tic in a wristapp
+WRIST_INCOMM EQU $0119 ; This is called when the COMM app is suspending the wristapp which has requests to process timer events
+WRIST_NEWDATA EQU $011c ; This is the wristapp entry point called when new data has been downloaded to the watch
+WRIST_GETSTATE EQU $011f ; Entry to get a wristapp state table entry
+WRIST_JMP_STATE0 EQU $0123 ; Wristapp entry point to call state 0
+
+USER04a1 EQU $04a1
+NESTED_APP EQU $04a2 ; Nested application (Only to run an application while a different one is running)
+ ; This is used to handle alarms and appointments that go off while you are running something else
+APP2_ALARM EQU 9 ; 9 = Alarm (while another app is running)
+APP2_APPT EQU 10 ; 10 = Appointment (while another app is running)
+APP2_WRIST EQU 11 ; 11 = Wristapp (while another app is running)
+NESTED_PARM EQU $04a4 ; Parameter passed to the nested app call
+USER04c3 EQU $04c3
+BUF_PHONENUM EQU $043a ; 12 byte buffer to hold a decompressed phone number
+EXTRACTBUF EQU $0446 ; 32 byte buffer to hold extracted data from the EEPROM
+UPDATE_POS EQU $04f3 ; Position to update a segment or digit in the blink/refresh routines
+;
+; These two constants appear to be associated with the PUTSCROLLMSG and SCROLLMSG routines
+;
+SEPARATOR EQU $3F ; Indicates the end of a scrolling string
+MSGBUF EQU $04d2 ; Location of the system buffer for a scrolling string
+CURRENT_APP EQU $04c1 ; The current application number (1-8)
+APP_TIME EQU 1 ; 1 = Time of Day
+APP_ALARM EQU 2 ; 2 = Alarm
+APP_APPT EQU 3 ; 3 = Appointment
+APP_ANNIV EQU 4 ; 4 = Anniversary
+APP_PHONE EQU 5 ; 5 = Phone number
+APP_LIST EQU 6 ; 6 = List
+APP_COMM EQU 7 ; 7 = Communication
+APP_WRIST EQU 8 ; 8 = Wristapp (if downloaded)
+BTN_PRESSED EQU $04c3 ; The button currently pressed (For EVT_ANY or EVT_ANY4 events) 0=NEXT 1=MODE 2=SET 3=PREV 4=GLOW
+EFFECTIVE_APP EQU $04c4 ; The efective application
+APP_13 EQU 13 ; Some submode of the TIME application
+APP_TIME_SET EQU 14 ; Submode of the TIME application
+UPDATE_MIN EQU $04f4 ; Minimum value for the update function to generate. At this, it wraps to UPDATE_MAX
+UPDATE_MAX EQU $04f5 ; Maximum value for the update function to generate. At this, it wraps to UPDATE_MIN
+PARM_MONTH EQU $04f9 ; Month parameter
+PARM_YEAR EQU $04fa ; Current year also...
+
+WATCHTIMER EQU $7ff0
+;
+; Other random routines which you might call....
+;
+ALARM_BLINKSEL EQU $4095
+ALARM_UPDATESEL EQU $4099
+ALARM_SELMIN EQU $409D
+ALARM_SELMAX EQU $40A1
+FIND_ANNIV_TODAY EQU $40CD
+FIND_ANNIV_SCAN EQU $40D3
+ANNIV_NEXT_ENTRY EQU $40E1
+ANNIV_PREV_ENTRY EQU $4117
+FIND_ANNIV_ENTRY EQU $415F
+CHECK_ANNIVERSARIES EQU $41FC
+SET_ANNIVTEST_TODAY EQU $423A
+ANNIV_GETMONTHLEN EQU $426A
+TEST_ANNIVERSARY EQU $4288
+ANNIV_COPY_INFO EQU $4308
+READ_ANNIV_CURRENT EQU $4317
+READ_ANNIV_FIRST EQU $4326
+READ_ANNIV_NEXT EQU $4335
+TEST_SCAN_START EQU $4346
+FIX_SCAN_YEAR EQU $4371
+TEST_SCAN_END EQU $437E
+RESTORE_SCAN_YEAR EQU $43AE
+INCREMENT_SCAN_DATE EQU $43B9
+GET_SCAN_MONTHLEN EQU $43E0
+DECREMENT_SCAN_DATE EQU $43F4
+FIND_APPT_NOW EQU $4415
+FIND_APPT_SCAN EQU $441B
+SET_APPTFIND_SCAN EQU $4422
+READ_APPT_NEXT EQU $442C
+APPT_LATCH_ENTRYDATA EQU $4468
+APPT_LATCH_ENTRYONLY EQU $446C
+READ_APPT_PREV EQU $447C
+FIND_APPT_ENTRY EQU $44C6
+APPT_LATCH_ENTDYDATA EQU $45A5
+CHECK_APPOINTMENTS EQU $45B9
+SET_APPTFIND_NOW EQU $462A
+READ_APPT_FIRST EQU $4686
+READ_APPT_LAST EQU $469D
+CHECK_APPT_TIME EQU $46B7
+READ_APPT_PACKET1 EQU $473A
+READ_NEXT_APPT_PACKET EQU $4749
+READ_APPT_CURRENT EQU $475A
+PROCESS_EVENTS EQU $49F6
+DO_ANYAPP_EVENT EQU $4B42
+DO_NESTAPP_EVENT EQU $4B45
+DO_APP_EVENT EQU $4B81
+DO_NORMAL_STATE EQU $4BB8
+TRANSITION_RBUTTON EQU $48fe
+TRANSITION_LBUTTON EQU $494d
+QUEUE_INDIGLO_OFF EQU $4992
+;QUEUE_INDIGLO_OFF EQU $49D9
+NIGHTMODE_INDIGLO_ON EQU $49E6
+INDIGLO_ON EQU $49EC
+PROCESS_REQUESTS EQU $4C66
+TIMER1_INTERVALS EQU $4de1
+TIMER2_INTERVALS EQU $4dec
+DO_EVENT EQU $4CA4
+GETSTATE EQU $4CFE
+GETSTATE_TAB EQU $4D0e
+CHECK_COMPATIBLE_EVENT EQU $4D96
+STOP_ALL_SOUND EQU $4E68
+PREPARE_TIMER2_TIMER EQU $4E96
+PLAY_HOURLY EQU $4EB1
+PAUSE_WATCH EQU $4EC7
+RESUME_WATCH EQU $4EDE
+RESUME_UPDATE EQU $4EF6
+ACQUIRE_TIME EQU $4F22
+RELEASE_TIME EQU $4F2E
+PLAY_BUTTON_SAFE EQU $4F46
+PREPARE_NEST_CALL EQU $4FA0
+UNPACK_PHONENUM EQU $4FBF
+PHONE_UNPACK_VAL EQU $4FE0
+UNPACK_STRING EQU $4FF0
+READ_PACKET EQU $503E
+FIND_PACKET EQU $5044
+DO_TRANSFER EQU $505F
+TOGGLE_ENTRYFLAG EQU $5077
+MAKE_INST_LDA EQU $50B4
+MAKE_INST_LDA_X EQU $50B8
+MAKE_INST_STA EQU $50BC
+ADD_INSTADDR EQU $50C7
+SET_INSTADDR_0110 EQU $50D7
+GET_INST_BYTE EQU $50EB
+WRITE_FLAG_BYTE EQU $510A
+FILL_EXTRACTBUF EQU $513E
+SAVE_EXTRACTBUF EQU $515D
+SYSTEM_RESET EQU $519B
+SND_OFF EQU $5286
+DO_SOUND EQU $5298
+SET_SYS_0f_4d EQU $5203
+SET_SYS_0f_41 EQU $5208
+ENABLE_EYE EQU $53A6
+SERIAL_DELAY EQU $53B4
+DISABLE_EYE EQU $53BD
+SET_SYS_07 EQU $53C8
+CLEAR_SYS_07 EQU $53CF
+RESET_SYS_07 EQU $53D5
+INITHW_SYS_07 EQU $53DC
+SETHW_07_08_C1 EQU $53F4
+WRITE_ACQUIRE EQU $543C
+WRITE_RELEASE EQU $5448
+MAKE_INST2_LDA_X EQU $5453
+MAKE_INST2_STA_X EQU $5457
+PROM_READ EQU $5462
+PROM_WRITE EQU $5488
+READ_EEPROM_PORT EQU $54CC
+PROM_STARTIO EQU $54D6
+PROM_ACQUIRE EQU $54E2
+PROM_RELEASE EQU $54EC
+PROM_SHOW EQU $54F3
+PROM_HIDE EQU $54F8
+DO_SCROLL EQU $5566
+DO_BLINK EQU $55c8
+PUTDOWTOP EQU $5872
+FMTBLANK0B EQU $5963
+SAYHOLDTODELETE EQU $598a
+PUT_PHONENUM EQU $59a2
+PUTYEARMID EQU $59d9
+CLEAR_HMONTH EQU $59f8
+PUT_HMONTHX EQU $59FD
+CLEAR_HDAY EQU $5a11
+PUT_HDAYX EQU $5a16
+FIXLEAD0 EQU $5A2A
+CLEAR_MONTH EQU $5a36
+IPUT_MONTHX EQU $5a3b
+CLEAR_DAY EQU $5a4f
+IPUT_DAYX EQU $5a54
+CLEAR_YEAR EQU $5a6f
+IPUT_YEARX EQU $5a74
+PUTHALFDATESEP EQU $5aa0
+PUT_LETTERX EQU $5ace
+PUT_HOURX EQU $5ad9
+CLEAR_RANGE EQU $5793
+SYSSYMVALS EQU $57b0
+PHONE_NEXT_ENTRY EQU $616D
+PHONE_PREV_ENTRY EQU $618C
+PHONE_READ_CURRENT EQU $61A7
+PHONE_SHOW_CURRENT EQU $61B0
+PHONE_FIND_SCAN_ENTRY EQU $61F1
+PHONE_READ_ENTRY EQU $622C
+PHONE_READ_NEXT_ENTRY EQU $623D
+PHONE_READ_FIRST_NEXT EQU $6251
+UPDATE_SECONDS EQU $625E
+ADJUST_TZ1TIME EQU $62d7
+ADJUST_TZ2TIME EQU $6343
+UPDATE_TZ1DISP EQU $63af
+UPDATE_TZ2DISP EQU $63e6
+TIME_SET_BLINKON EQU $6660
+TIME_SET_BLINKOFF EQU $6664
+TIME_SET_GET_TIMEPTR EQU $667b
+TIME_SET_SHOWDISPLAY EQU $668a
+TIME_GET_BLINKPARM EQU $66e5
+SHOW_TIME_DISPLAY EQU $676A
+CLEAR_PM EQU $6815
+CLEAR_AM EQU $681c
+SHOWNIGHT_SYM EQU $6840
+SAY_HOLD_TO EQU $6855
+FIX_TMAPP_DAY EQU $6861
+TMAPP_COPYTZ1 EQU $6881
+TMAPP_COPYTZ2 EQU $688c
+GETTZNAME EQU $6897
+GET_MONTHDAYX EQU $689F
+GET_YEAR EQU $68b2
+GET_HOURFORMAT EQU $68bb
+GET_DATEFMT EQU $68cb
+COPY_MDY EQU $68db
+CHECK_TZ EQU $690e
+CALC_DOW EQU $691c
+TIME_BLINKSEL EQU $69A4
+TIME_UPDATESEL EQU $69AF
+TIME_SELMIN EQU $69ba
+TIME_SELMAX EQU $69c5
+LIST_GO_NEXT EQU $6A9F
+LIST_GO_PREV EQU $6AAD
+LIST_DISPLAY_CURRENT EQU $6ABB
+CLEAR_WRISTAPPMEM EQU $6b1f
+DELAY_X EQU $6b31
+DELAY_X16 EQU $6b43
+SHOWNOTE_SYM EQU $6C62
+SHOWALARM_SYM EQU $6C76
+ALARM_CHECK EQU $6BC4
+ALARM_START_BLINK EQU $6E9D
+ALARM_CALL_BLINK EQU $6EA4
+ALARM_GET_BLINKPARM EQU $6EB7
+ALARM_DISPLAY_CURRENT EQU $6EF4
+ALARM_SHOW_HOURLYNOTE EQU $6F39
+ALARM_SHOW_ALARMSYM EQU $6F4A
+ALARM_SHOW_AMPM EQU $6F5B
+ALARM_SHOW_TEXTCHAR EQU $6F7C
+ALARM_FIX_HOUR EQU $6F88
+ALARM_GET_DISPLAYHOUR EQU $6FA0
+ALARM_SET_CURRENT EQU $6FBE
+ALARM_SAVE_STATUS EQU $6FD5
+ALARM_GET_TEXTOFFSET EQU $6FDC
+ALARM_GET_DATAOFFSET EQU $6FE5
+MASK_ALARMS EQU $6FF3
+UNMASK_ALARMS EQU $7000
+ANNIV_SHOW_DATE EQU $7184
+ANNIV_SHOW_SCAN_DATE EQU $719F
+ANNIV_SHOW_CURRENT EQU $71AC
+SHOWREMIND_SYM EQU $71D6
+OFFREMIND_SYM EQU $71EE
+SAY_NO_ANN_ENTRIES EQU $71F5
+APPT_SHOW_TIME EQU $73D7
+APPT_SHOW_DATE EQU $7439
+APPT_SHOW_SCAN EQU $7454
+APPT_SHOW_CURRENT EQU $7461
+APPT_SHOW_UPCOMING EQU $748E
+SAY_NO_APPT_ENTRIES EQU $74BD
+;
+;
+;
+TZ1_MONTH EQU $B2
+TZ2_MONTH EQU $BB
+SCAN_MONTH EQU $7A
+SCAN_DAY EQU $7B
+SCAN_YEAR EQU $7C
+MONTH_JAN EQU 01
+MONTH_DEC EQU 12
diff --git a/number/number.asm b/number/number.asm
new file mode 100644
index 0000000..269a8f1
--- /dev/null
+++ b/number/number.asm
@@ -0,0 +1,117 @@
+;Name: Numbers
+;Version: NUMBER
+;Description: This is a simple number count program
+;by John A. Toebes, VIII
+;
+;TIP: Download your watch faster: Download a WristApp once, then do not send it again. It stays in the watch!
+;HelpFile: watchapp.hlp
+;HelpTopic: 106
+ INCLUDE "wristapp.i"
+;
+; (1) Program specific constants
+;
+FLAGBYTE EQU $61
+; Bit 0 indicates that we want to show the segments instead of the message
+;
+CURVAL EQU $62 ; The current value we are displaying
+START EQU *
+;
+; (2) System entry point vectors
+L0110: jmp MAIN ; The main entry point - WRIST_MAIN
+L0113: rts ; Called when we are suspended for any reason - WRIST_SUSPEND
+ nop
+ nop
+L0116: rts ; Called to handle any timers or time events - WRIST_DOTIC
+ nop
+ nop
+L0119: rts ; Called when the COMM app starts and we have timers pending - WRIST_INCOMM
+ nop
+ nop
+L011c: rts ; Called when the COMM app loads new data - WRIST_NEWDATA
+ nop
+ nop
+
+L011f: lda STATETAB,X ; The state table get routine - WRIST_GETSTATE
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB-STATETAB
+;
+; (3) Program strings
+S6_NUMBER: timex6 "NUMBER"
+S6_COUNT: timex6 "COUNT "
+;
+; (4) State Table
+STATETAB:
+ db 0
+ db EVT_ENTER,TIM_2_8TIC,0 ; Initial state
+ db EVT_TIMER2,TIM_ONCE,0 ; The timer from the enter event
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_DNNEXT,TIM_ONCE,0 ; Next button
+ db EVT_DNPREV,TIM_ONCE,0 ; Prev button
+ db EVT_DNSET,TIM_ONCE,0 ; Set button
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_END
+;
+; (5) State Table 0 Handler
+; This is called to process the state events. We will see ENTER, RESUME, DNNEXT, DNPREV, DNSET, and TIMER2
+;
+HANDLE_STATE0:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_DNNEXT ; Did they press the next button?
+ beq DO_NEXT ; Yes, increment the counter
+ cmp #EVT_DNPREV ; How about the PREV button
+ beq DO_PREV ; handle it
+ cmp #EVT_DNSET ; Maybe the set button?
+ beq DO_SET ; Deal with it!
+ cmp #EVT_ENTER ; Is this our initial entry?
+ bne REFRESH
+;
+; This is the initial event for starting us
+;
+DO_ENTER
+ bclr 1,FLAGBYTE ; Indicate that we need to clear the display
+ jsr CLEARSYM ; Clear the display
+ lda #S6_NUMBER-START
+ jsr PUT6TOP
+ lda #S6_COUNT-START
+ jsr PUT6MID
+ lda #SYS8_MODE
+ jmp PUTMSGBOT
+;
+; (6) Our only real working code...
+DO_NEXT
+ inc CURVAL
+ lda CURVAL
+ cmp #100
+ bne SHOWVAL
+DO_SET
+ clr CURVAL
+SHOWVAL
+ brset 1,FLAGBYTE,NOCLEAR
+REFRESH
+ jsr CLEARALL
+ bset 1,FLAGBYTE
+NOCLEAR
+ ldx CURVAL
+ jsr FMTXLEAD0
+ jmp PUTMID34
+DO_PREV
+ lda CURVAL
+ beq WRAPUP
+ dec CURVAL
+ bra SHOWVAL
+WRAPUP
+ lda #99
+ sta CURVAL
+ bra SHOWVAL
+;
+; (7) This is the main initialization routine which is called when we first get the app into memory
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta WRISTAPP_FLAGS
+ clr FLAGBYTE ; start with a clean slate
+ clr CURVAL
+ rts
diff --git a/password/password.asm b/password/password.asm
new file mode 100644
index 0000000..f8c8122
--- /dev/null
+++ b/password/password.asm
@@ -0,0 +1,232 @@
+;Name: Password
+;Version: PASSWD
+;Description: This is a simple number update/passwd program
+;by John A. Toebes, VIII
+;
+;TIP: Download your watch faster: Download a WristApp once, then do not send it again. It stays in the watch!
+;HelpFile: watchapp.hlp
+;HelpTopic: 106
+ INCLUDE "wristapp.i"
+;
+; (1) Program specific constants
+;
+FLAGBYTE EQU $61
+; Bit 0 indicates which digit we are working on (SET=SECOND DIGIT)
+; Bit 1 indicates that we need to clear the display first
+;
+DIGIT0 EQU $62 ; The first digit to enter
+DIGIT1 EQU $63 ; The second digit to enter
+SYSTEMP0 EQU $A0
+SYSTEMP1 EQU $A1
+;
+; (2) System entry point vectors
+;
+START EQU *
+L0110: jmp MAIN ; The main entry point - WRIST_MAIN
+L0113: rts ; Called when we are suspended for any reason - WRIST_SUSPEND
+ nop
+ nop
+L0116: rts ; Called to handle any timers or time events - WRIST_DOTIC
+ nop
+ nop
+L0119: rts ; Called when the COMM app starts and we have timers pending - WRIST_INCOMM
+ nop
+ nop
+L011c: rts ; Called when the COMM app loads new data - WRIST_NEWDATA
+ nop
+ nop
+
+L011f: lda STATETAB0,X ; The state table get routine - WRIST_GETSTATE
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB0-STATETAB0
+L0127: jmp HANDLE_STATE1
+ db STATETAB1-STATETAB0
+;
+; (3) Program strings
+S6_TOEBES: timex6 "TOEBES"
+S6_SAMPLE: timex6 "SAMPLE"
+S6_PRESS: timex6 "PRESS "
+S8_PASSWORD: timex "PASSWORD"
+SX_MESSAGE timex "BY JOHN A. TOEBES, VIII"
+ db SEPARATOR
+;
+; (4) State Table
+;
+STATETAB0:
+ db 0
+ db EVT_ENTER,TIM_2_8TIC,0 ; Initial state
+ db EVT_TIMER2,TIM_ONCE,0 ; The timer from the enter event
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_SET,TIM_ONCE,1 ; SET button pressed
+ db EVT_END
+
+STATETAB1:
+ db 1
+ db EVT_RESUME,TIM_ONCE,1 ; Resume from a nested app
+ db EVT_DNANY4,TIM_ONCE,1 ; NEXT, PREV, SET, MODE button pressed
+ db EVT_UPANY4,TIM_ONCE,1 ; NEXT, PREV, SET, MODE button released
+ db EVT_USER2,TIM_ONCE,0
+ db EVT_END
+;
+; (5) State Table 0 Handler
+; This is called to process the state events.
+; We see ENTER, TIMER2, and RESUME events
+;
+HANDLE_STATE0:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_ENTER ; Is this our initial entry?
+ bne REFRESH0
+;
+; This is the initial event for starting us
+;
+DO_ENTER
+ bclr 1,FLAGBYTE ; Indicate that we need to clear the display
+ jsr CLEARSYM ; Clear the display
+ lda #S6_TOEBES-START
+ jsr PUT6TOP
+ lda #S6_SAMPLE-START
+ jsr PUT6MID
+ lda #( ( S8_PASSWORD - $10 ) & $ff )
+ jmp BANNER8
+;
+; We come here for a RESUME or TIMER2 event. For this we want to reset the display
+;
+REFRESH0
+ brset 1,FLAGBYTE,NOCLEAR0 ; Do we need to clear the display first?
+ bset 1,FLAGBYTE
+ jsr CLEARSYM
+NOCLEAR0
+ lda #S6_PRESS-START
+ jsr PUT6TOP
+ lda #SYS6_SET
+ jsr PUTMSG2
+ lda #SX_MESSAGE-START
+ jmp SETUP_SCROLL
+;
+; (6) State Table 1 Handler
+; This is called to process the state events.
+; We see SET, RESUME, DNANY4, and UPANY4 events
+;
+HANDLE_STATE1:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_UPANY4
+ beq REFRESH
+ cmp #EVT_DNANY4 ; Is this our initial entry?
+ bne FORCEFRESH
+ lda BTN_PRESSED ; Let's see what the button they pressed was
+ cmp #EVT_PREV ; How about the PREV button
+ beq DO_PREV ; handle it
+ cmp #EVT_NEXT ; Maybe the NEXT button?
+ beq DO_NEXT ; Deal with it!
+ cmp #EVT_MODE ; Perhaps the MODE button
+ beq DO_MODE ; If so, handle it
+ ; It must be the set button, so take us out of this state
+ lda #EVT_USER2
+ jmp POSTEVENT
+;
+; (7) Our real working code...
+DO_NEXT
+ bset 0,SYSFLAGS ; Mark our update direction as up
+ bra DO_UPD
+DO_PREV
+ bclr 0,SYSFLAGS ; Mark our update direction as down
+DO_UPD
+ clra
+ sta UPDATE_MIN ; Our low end is 0
+ lda #99
+ sta UPDATE_MAX ; and the high end is 99 (the max since this is a 2 digit value)
+ brset 0,FLAGBYTE,UPD1
+ ldx DIGIT1
+ jsr FMTXLEAD0
+ jsr PUTMID34
+ ldx #DIGIT0 ; Point to our value to be updated
+ lda #UPD_MID12 ; Request updating in the middle of the display
+ bra UPD2
+UPD1
+ ldx DIGIT0
+ jsr FMTXLEAD0
+ jsr PUTMID12
+ ldx #DIGIT1
+ lda #UPD_MID34
+UPD2
+ jsr START_UPDATEP ; And prepare the update routine
+ bset 4,BTNFLAGS ; Mark that the update is now pending
+ bclr 1,FLAGBYTE
+ lda #SYS8_SET_MODE
+ jmp PUTMSGBOT
+
+DO_MODE
+ lda FLAGBYTE
+ eor #1
+ sta FLAGBYTE
+
+REFRESH
+ brset 1,FLAGBYTE,NOCLEAR ; Do we need to clear the display first?
+FORCEFRESH
+ jsr CLEARALL ; Yes, clear everything before we start
+ bset 1,FLAGBYTE ; And remember that we have already done that
+NOCLEAR
+ bclr 7,BTNFLAGS ; Turn off any update routine that might be pending
+ brset 0,FLAGBYTE,SET1
+ ldx DIGIT1
+ jsr FMTXLEAD0
+ jsr PUTMID34
+ ldx #DIGIT0
+ lda #BLINK_MID12
+ bra SET2
+SET1
+ ldx DIGIT0
+ jsr FMTXLEAD0
+ jsr PUTMID12
+ ldx #DIGIT1
+ lda #BLINK_MID34
+SET2
+ jsr START_BLINKP
+ bset 2,BTNFLAGS ; Mark a blink routine as pending
+ rts
+;
+; (8) This is the main initialization routine which is called when we first get the app into memory
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta WRISTAPP_FLAGS
+ clr FLAGBYTE ; start with a clean slate
+ clr DIGIT0
+ clr DIGIT1
+ rts
+;
+; (9) This subroutine is useful for getting a scrolling string on the screen
+;
+;----------------------------------------------------------------------
+; Routine:
+; SETUP_SCROLL
+; Parameters:
+; X - Offset from Start to the string
+; Returns:
+; MSGBUF - contains copied string
+; Purpose
+; This copies the current string into MSGBUF and calls the appropriate routines
+; to start it scrolling on the bottom line.
+;----------------------------------------------------------------------
+SETUP_SCROLL:
+ clr SYSTEMP0
+ sta SYSTEMP1
+DO_COPY:
+ ldx SYSTEMP1 ; Get the pointer to the source character
+ lda START,X ; Get the character that we are copying
+ ldx SYSTEMP0 ; Get the pointer to the output buffer
+ sta MSGBUF,X ; and store the character away
+ inc SYSTEMP0 ; Increment our count
+ inc SYSTEMP1 ; As well as the pointer to the character
+ cmp #SEPARATOR ; Did we get a terminator character
+ bne DO_COPY ; No, go back for more
+ ;
+ ; The string is now in a buffer terminated by a separator character
+ ;
+ jsr PUTSCROLLMSG ; Initialize the scrolling support
+ jmp SCROLLMSG ; And tell it to actually start scrolling
diff --git a/update/update.asm b/update/update.asm
new file mode 100644
index 0000000..930fcec
--- /dev/null
+++ b/update/update.asm
@@ -0,0 +1,133 @@
+;Name: Update
+;Version: UPDATE
+;Description: This is a simple number update program
+;by John A. Toebes, VIII
+;
+;TIP: Download your watch faster: Download a WristApp once, then do not send it again. It stays in the watch!
+;HelpFile: watchapp.hlp
+;HelpTopic: 106
+ INCLUDE "wristapp.i"
+;
+; (1) Program specific constants
+;
+FLAGBYTE EQU $61
+; Bit 1 indicates that we need to clear the display first
+;
+CURVAL EQU $62 ; The current value we are displaying
+;
+; (2) System entry point vectors
+;
+START EQU *
+L0110: jmp MAIN ; The main entry point - WRIST_MAIN
+L0113: rts ; Called when we are suspended for any reason - WRIST_SUSPEND
+ nop
+ nop
+L0116: rts ; Called to handle any timers or time events - WRIST_DOTIC
+ nop
+ nop
+L0119: rts ; Called when the COMM app starts and we have timers pending - WRIST_INCOMM
+ nop
+ nop
+L011c: rts ; Called when the COMM app loads new data - WRIST_NEWDATA
+ nop
+ nop
+
+L011f: lda STATETAB,X ; The state table get routine - WRIST_GETSTATE
+ rts
+
+L0123: jmp HANDLE_STATE0
+ db STATETAB-STATETAB
+;
+; (3) Program strings
+S6_UPDATE: timex6 "UPDATE"
+S6_SAMPLE: timex6 "SAMPLE"
+;
+; (4) State Table
+;
+STATETAB:
+ db 0
+ db EVT_ENTER,TIM_2_8TIC,0 ; Initial state
+ db EVT_TIMER2,TIM_ONCE,0 ; The timer from the enter event
+ db EVT_RESUME,TIM_ONCE,0 ; Resume from a nested app
+ db EVT_MODE,TIM_ONCE,$FF ; Mode button
+ db EVT_DNANY4,TIM_ONCE,0 ; NEXT, PREV, SET, MODE button pressed
+ db EVT_UPANY4,TIM_ONCE,0 ; NEXT, PREV, SET, MODE button released
+ db EVT_END
+;
+; (5) State Table 0 Handler
+; This is called to process the state events.
+; We see ENTER, TIMER2, RESUME, DNANY4 and UPANY4 events
+;
+HANDLE_STATE0:
+ bset 1,APP_FLAGS ; Indicate that we can be suspended
+ lda BTNSTATE ; Get the event
+ cmp #EVT_DNANY4 ; Did they press a button?
+ bne CHKENTER ; No, pass on to see what else there might be
+ lda BTN_PRESSED ; Let's see what the button they pressed was
+ cmp #EVT_PREV ; How about the PREV button
+ beq DO_PREV ; handle it
+ cmp #EVT_NEXT ; Maybe the NEXT button?
+ beq DO_NEXT ; Deal with it!
+ cmp #EVT_SET ; Perhaps the SET button
+ beq DO_SET ; If so, handle it
+ ; In reality, we can't reach here since we handled all three buttons
+ ; in the above code (the MODE button is handled before we get here and the
+ ; GLOW button doesn't send in an event for this). We can just fall through
+ ; and take whatever we get from it.
+CHKENTER
+ cmp #EVT_ENTER ; Is this our initial entry?
+ bne REFRESH
+;
+; This is the initial event for starting us
+;
+DO_ENTER
+ bclr 1,FLAGBYTE ; Indicate that we need to clear the display
+ jsr CLEARSYM ; Clear the display
+ lda #S6_UPDATE-START
+ jsr PUT6TOP
+ lda #S6_SAMPLE-START
+ jsr PUT6MID
+ lda #SYS8_MODE
+ jmp PUTMSGBOT
+;
+; (6) Our real working code...
+
+DO_NEXT
+ bset 0,SYSFLAGS ; Mark our update direction as up
+ bra DO_UPD
+DO_PREV
+ bclr 0,SYSFLAGS ; Mark our update direction as down
+DO_UPD
+ clra
+ sta UPDATE_MIN ; Our low end is 0
+ lda #99
+ sta UPDATE_MAX ; and the high end is 99 (the max since this is a 2 digit value)
+ ldx #CURVAL ; Point to our value to be updated
+ lda #UPD_MID34 ; Request updating in the middle of the display
+ jsr START_UPDATEP ; And prepare the update routine
+ bset 4,BTNFLAGS ; Mark that the update is now pending
+ bclr 1,FLAGBYTE
+ lda #SYS8_SET_MODE
+ jmp PUTMSGBOT
+
+DO_SET
+ clr CURVAL ; When they hit the set button, we just clear to zero
+SHOWVAL
+ brset 1,FLAGBYTE,NOCLEAR ; Do we need to clear the display first?
+REFRESH
+ jsr CLEARALL ; Yes, clear everything before we start
+ bset 1,FLAGBYTE ; And remember that we have already done that
+NOCLEAR
+ bclr 7,BTNFLAGS ; Turn off any update routine that might be pending
+ ldx CURVAL ; Get the current value
+ jsr FMTXLEAD0 ; Convert it to the two ascii digits
+ jmp PUTMID34 ; And put it on the screen in the right place
+;
+; (7) This is the main initialization routine which is called when we first get the app into memory
+;
+MAIN:
+ lda #$c0 ; We want button beeps and to indicate that we have been loaded
+ sta WRISTAPP_FLAGS
+ clr FLAGBYTE ; start with a clean slate
+ clr CURVAL
+ rts