annotate level1/modules/clock2.asm @ 1692:96c2b4a93483

Robert's reorganized clock2.asm, with each clock supported in alphabetical order
author boisy
date Mon, 02 Aug 2004 13:19:03 +0000
parents a4d7f06d1797
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1 ********************************************************************
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
2 * Clock2 - Real-Time Clock Subroutines
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
3 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
4 * $Id$
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
5 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
6 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
7 * RTC Specific Notes:
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
8 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
9 * Dallas Semiconductor DS1216 SmartWatch
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
10 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
11 * Wakeup sequence $C5 3A A3 5C C5 3A A3 5C
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
12 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
13 * Time byte sequence in Binary Coded Decimal
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
14 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
15 * byte bit 7 6 5 4 3 2 1 0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
16 * 0 | 0.1 sec MSB | 0.1 sec LSB |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
17 * 1 | 0 | 10 sec | seconds |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
18 * 2 | 0 | 10 min | minutes |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
19 * 3 |12/24| 0 | AM/PM | HR | Hour |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
20 * | 10 HR | Hour |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
21 * 0=12, 1=24 0=AM, 1=PM
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
22 * 4 | 0 | 0 | OSC |RESET| 0 | Weekday |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
23 * 5 | 0 | 0 | 10 Date | Date |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
24 * 6 | 0 | 0 | 0 |10 Month| Month |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
25 * 7 | 10 Year | Year |
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
26 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
27 * OSC = 1; turns off clock to save battery. RESET not used in Coco circuit.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
28 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
29 * When inserted in external ROM socket, the clock is addressed at:
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
30 * $C000 bit = 0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
31 * $C001 bit = 1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
32 * $C004 read byte to wakeup then send wakeup sequence to bit toggles.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
33 * Then either read or send time.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
34 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
35 *
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
36 * Edt/Rev YYYY/MM/DD Modified by
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
37 * Comment
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
38 * ------------------------------------------------------------------
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
39 * 1 2003/08/18 Boisy G. Pitre
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
40 * Stripped from clock.asm in order to modularize clocks.
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
41 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
42 * 2004/07/13 Robert Gault
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
43 * Added Vavasour/Collyer emulator & MESS (Disto) versions and relocated
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
44 * 'GetTime equ' statement so it is not within a chip heading.
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
45 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
46 * 2004/07/28 Robert Gault
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
47 * Complete rewrite of SmartWatch segment which would never have worked.
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
48 * See previous versions for old code if desired. Routine now will search
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
49 * through all MPI slots to find clock and accept either AM/PM or military
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
50 * time. User notified if clock not found or data memory not available.
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
51 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
52 * Initialization routine contains code that bypasses OS-9 system calls to
1691
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
53 * acquire needed low RAM that can't become ROM. This type of code is not
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
54 * recommended in most cases but nothing else was usable.
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
55 * 2004/07/31 Robert Gault
1691
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
56 * Added a settime routine and changed "no clock found" routine. If the
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
57 * clock is not found, the D.Time entries are cleared but no message is sent.
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
58 * Date -t will never get passed one minute.
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
59 * 2004/07/31 Rodney Hamilton
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
60 * Improved RTCJVEmu code, conditionalized RTC type comments.
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
61 * 2004/08/2 Robert Gault
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
62 * Alphabetized all clock listings so things can be found much more easily.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
63 * Placed list of clock types at beginning of source for record keeping.
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
64
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
65 nam Clock2
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
66 ttl Real-Time Clock Subroutines
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
67
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
68 ifp1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
69 use defsfile
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
70 endc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
71
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
72 *---------------------------------------------------------------------------
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
73 * Setup for specific RTC chip
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
74 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
75 * CHIP TYPES INCLUDED:
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
76 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
77 * RTCBB+RTCCloud9
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
78 * RTCDriveWire
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
79 * RTCDsto2+RTCDsto4
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
80 * RTCElim
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
81 * RTCHarrs
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
82 * RTCJVEmu
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
83 * RTCMESSEmu
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
84 * RTCSmart
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
85 * RTCSoft
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
86
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
87 IFNE RTCBB+RTCCloud9
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
88 IFNE RTCBB
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
89 RTC.Base equ $FF5C In SCS* Decode
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
90 ELSE
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
91 RTC.Base equ $FF7C Fully decoded RTC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
92 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
93 RTC.Zero equ -4 Send zero bit by writing this offset
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
94 RTC.One equ -3 Send one bit by writing this offset
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
95 RTC.Read equ 0 Read data from this offset
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
96 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
97
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
98 IFNE RTCDriveWire
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
99 RTC.Base equ $0000
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
100 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
101
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
102 IFNE RTCDsto2+RTCDsto4
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
103 RTC.Base equ $FF50 Base address of clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
104 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
105
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
106 IFNE RTCElim
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
107 RTC.Sped equ $20 32.768 KHz, rate=0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
108 RTC.Strt equ $06 binary, 24 Hour, DST disabled
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
109 RTC.Stop equ $86 bit 7 set stops clock to allow setting time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
110 RTC.Base equ $FF72 I don't know base for this chip.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
111 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
112
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
113 IFNE RTCHarrs
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
114 RTC.Base equ $FF60 Base address for clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
115 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
116
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
117 IFNE RTCJVEmu
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
118 RTC.Base equ $FFC0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
119 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
120
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
121 IFNE RTCMESSEmu
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
122 RTC.Base equ $FF50
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
123 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
124
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
125 IFNE RTCSmart
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
126 RTC.Base equ $C000 clock mapped to $C000-$DFFF; $FFA6 MMU slot
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
127 RTC.Zero equ 0 Send zero bit
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
128 RTC.One equ 1 Send ones bit
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
129 RTC.Read equ 4
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
130 *D.SWPage on system DP; Refer to os9defs.
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
131 D.RTCSlt equ 0 on SmartWatch ?data? page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
132 D.RTCFlg equ 1 on SW page
1691
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
133 D.RTCMod equ 2
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
134 D.Temp equ 3 on SW page, holds "clock" data
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
135 D.Start equ 4 on SW page, code starts here
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
136 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
137
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
138 IFNE RTCSoft
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
139 RTC.Base equ 0 Have to have one defined.
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
140 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
141
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
142 *------------------------------------------------------------
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
143 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
144 * Start of module
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
145 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
146 mod len,name,Sbrtn+Objct,ReEnt+0,JmpTable,RTC.Base
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
147
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
148 name fcs "Clock2"
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
149 fcb 1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
150
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
151 IFNE MPIFlag
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
152 SlotSlct fcb MPI.Slot-1 Slot constant for MPI select code
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
153 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
154
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
155 * Jump table for RTC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
156 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
157 * Entry points:
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
158 * - Init
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
159 * - SetTime
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
160 * - GetTime
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
161 JmpTable
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
162 lbra Init
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
163 bra GetTime
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
164 nop
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
165 lbra SetTime
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
166
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
167 *--------------------------------------------------------------------------
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
168 * GetTime Subroutine
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
169 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
170 * This subroutine is called by the main clock module.
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
171 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
172
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
173 GetTime equ *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
174
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
175 IFNE RTCBB+RTCCloud9
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
176 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
177 * Update time from B&B RTC
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
178 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
179 pshs u,y,cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
180 leay ReadBCD,pcr Read bytes of clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
181
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
182 TfrTime orcc #IntMasks turn off interrupts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
183 ldu M$Mem,pcr Get base address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
184
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
185 IFNE MPIFlag
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
186 ldb >MPI.Slct Select slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
187 pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
188 andb #$F0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
189 orb SlotSlct,pcr
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
190 stb >MPI.Slct
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
191 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
192
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
193 lbsr SendMsg Initialize clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
194 ldx #D.Sec
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
195 ldb #8 Tfr 8 bytes
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
196
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
197 tfrloop jsr ,y Tfr 1 byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
198
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
199 bitb #$03
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
200 beq skipstuf Skip over day-of-week, etc.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
201 leax -1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
202 skipstuf decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
203 bne tfrloop
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
204
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
205 IFNE MPIFlag
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
206 puls b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
207 stb >MPI.Slct restore MPAK slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
208 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
209
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
210 puls u,y,cc,pc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
211
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
212 ClkMsg fcb $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
213 * Enable clock with message $C53AA35CC53AA35C
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
214 SendMsg lda RTC.Read,u Send Initialization message to clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
215 leax <ClkMsg,pcr
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
216 ldb #8
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
217 msgloop lda ,x+
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
218 bsr SendByte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
219 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
220 bne msgloop
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
221 rts
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
222
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
223 SendBCD pshs b Send byte to clock, first converting to BCD
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
224 bitb #$03
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
225 bne BCDskip Send zero for day-of-week, etc.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
226 lda #0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
227 bra SndBCDGo
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
228 BCDskip lda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
229 SndBCDGo tfr a,b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
230 bra binenter
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
231 binloop adda #6
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
232 binenter subb #10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
233 bhs binloop
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
234 puls b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
235 SendByte coma Send one byte to clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
236 rora
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
237 bcc sendone
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
238 sendzero tst RTC.Zero,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
239 lsra
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
240 bcc sendone
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
241 bne sendzero
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
242 rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
243 sendone tst RTC.One,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
244 lsra
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
245 bcc sendone
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
246 bne sendzero
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
247 rts
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
248
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
249 ReadBCD pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
250 ldb #$80 High bit will rotate out after we read 8 bits
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
251 readbit lda RTC.Read,u Read a bit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
252 lsra
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
253 rorb Shift it into B
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
254 bcc readbit Stop when marker bit appears
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
255 tfr b,a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
256 bra BCDEnter Convert BCD number to Binary
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
257 BCDLoop subb #6 by subtracting 6 for each $10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
258 BCDEnter suba #$10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
259 bhs BCDLoop
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
260 stb ,x
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
261 puls b,pc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
262 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
263
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
264 IFNE RTCDriveWire
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
265 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
266 * Update time from DriveWire
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
267 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
268 lbra DoDW
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
269
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
270 use bbwrite.asm
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
271
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
272 DoDW pshs y,x,cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
273 lda #'# Time packet
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
274 orcc #IntMasks Disable interrupts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
275 lbsr SerWrite
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
276 bsr SerRead Read year byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
277 bcs UpdLeave
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
278 sta <D.Year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
279 bsr SerRead Read month byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
280 bcs UpdLeave
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
281 sta <D.Month
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
282 bsr SerRead Read day byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
283 bcs UpdLeave
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
284 sta <D.Day
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
285 bsr SerRead Read hour byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
286 bcs UpdLeave
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
287 sta <D.Hour
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
288 bsr SerRead Read minute byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
289 bcs UpdLeave
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
290 sta <D.Min
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
291 bsr SerRead Read second byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
292 bcs UpdLeave
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
293 sta <D.Sec
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
294 bsr SerRead Read day of week (0-6) byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
295 UpdLeave puls cc,x,y,pc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
296
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
297 use bbread.asm
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
298 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
299
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
300 IFNE RTCDsto2
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
301 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
302 * Disto 2-in-1 RTC time update
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
303 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
304 pshs a,cc Save old interrupt status and mask IRQs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
305 bsr RTCPre
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
306
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
307 bsr GetVal Get Year
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
308 bsr GetVal Get Month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
309 bsr GetVal Get Day
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
310 decb ldb #5
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
311 stb 2,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
312 decb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
313 lda ,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
314 anda #3
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
315 bsr GetVal1 Get Hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
316 bsr GetVal Get Minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
317 bsr GetVal Get Second
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
318
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
319 RTCPost clr >$FFD9 2 MHz (Really should check $A0 first)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
320 puls cc,b
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
321
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
322 IFNE MPIFlag
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
323 stb >MPI.Slct Restore saved "currently" selected MPak slot
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
324 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
325
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
326 clrb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
327 rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
328
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
329 RTCPre orcc #IntMasks
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
330
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
331 IFNE MPIFlag
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
332 ldb >MPI.Slct Save currently selected MPak slot on stack
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
333 stb 3,s
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
334 andb #$F0
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
335 orb >SlotSlct,pcr Get slot to select
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
336 stb >MPI.Slct Select MPak slot for clock
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
337 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
338
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
339 ldy #D.Time
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
340 ldx M$Mem,pcr
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
341 clr 1,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
342 ldb #12
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
343 clr >$FFD8 1 MHz
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
344 rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
345
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
346 GetVal stb 2,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
347 decb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
348 lda ,x read tens digit from clock
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
349 anda #$0f
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
350 GetVal1 pshs b save b
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
351 ldb #10
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
352 mul multiply by 10 to get value
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
353 stb ,y save 10s value
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
354 puls b set up clock for ones digit
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
355 stb 2,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
356 decb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
357 lda ,x read ones digit from clock
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
358 anda #$0f
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
359 adda ,y add ones + tens
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
360 sta ,y+ store clock value into time packet
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
361 rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
362
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
363 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
364
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
365 IFNE RTCDsto4
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
366 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
367 * Disto 4-in-1 RTC time update
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
368 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
369 IFNE MPIFlag
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
370 pshs cc Save old interrupt status and mask IRQs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
371 orcc #IntMasks
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
372 ldb >MPI.Slct Save currently selected MPak slot on stack
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
373 pshs b
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
374 andb #$F0
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
375 orb >SlotSlct,pcr Select MPak slot for clock
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
376 stb >MPI.Slct
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
377 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
378
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
379 ldx M$Mem,pcr
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
380 ldy #D.Time Start with seconds
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
381
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
382 ldb #11
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
383 bsr GetVal Get Year
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
384 bsr GetVal Get Month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
385 bsr GetVal Get Day
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
386 lda #3 Mask tens digit of hour to remove AM/PM bit
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
387 bsr GetVal1 Get Hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
388 bsr GetVal Get Minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
389 bsr GetVal Get Second
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
390
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
391 IFNE MPIFlag
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
392 puls b Restore saved "currently" selected MPak slot
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
393 stb >MPI.Slct
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
394 puls cc,pc Restore previous IRQ status
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
395 ELSE
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
396 rts No MPI, don't need to mess with slot, CC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
397 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
398
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
399 GetVal lda #$0f Mask to apply to tens digit
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
400 GetVal1 stb 1,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
401 decb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
402 anda ,x read ones digit from clock
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
403 pshs b save b
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
404 ldb #10
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
405 mul multiply by 10 to get value
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
406 stb ,y Add to ones digit
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
407 puls b
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
408 stb 1,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
409 decb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
410 lda ,x read tens digit from clock and mask it
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
411 anda #$0f
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
412 adda ,y
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
413 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
414 rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
415 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
416
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
417 IFNE RTCElim
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
418 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
419 * Eliminator time update (lacks MPI slot select ability)
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
420 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
421 ldx M$Mem,pcr get RTC base address from fake memory requirement
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
422 ldb #$0A UIP status register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
423 stb ,x generate address strobe
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
424 lda 1,x get UIP status
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
425 bpl NoUIP Update In Progress, go shift next RTC read
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
426 lda #TkPerSec/2 set up next RTC read attempt in 1/2 second
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
427 sta <D.Tick save tick
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
428 bra UpdTExit and return
1691
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
429
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
430 NoUIP decb year register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
431 stb ,x generate address strobe
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
432 lda 1,x get year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
433 sta <D.Year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
434 decb month register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
435 stb ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
436 lda 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
437 sta <D.Month
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
438 decb day of month register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
439 stb ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
440 lda 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
441 sta <D.Day
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
442 ldb #4 hour register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
443 stb ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
444 lda 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
445 sta <D.Hour
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
446 ldb #2 minute register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
447 stb ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
448 lda 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
449 sta <D.Min
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
450 clrb second register address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
451 stb ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
452 lda 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
453 SaveSec sta <D.Sec
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
454 UpdTExit rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
455 ENDC
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
456
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
457 IFNE RTCHarrs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
458 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
459 * Update time from Harris RTC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
460 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
461 pshs cc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
462 orcc #IntMasks Disable interrupts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
463
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
464 ldu M$Mem,pcr Get base address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
465 ldy #D.Time Pointer to time in system map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
466
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
467 lda #%00001100 Init command register (Normal,Int. Disabled,
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
468 sta $11,u Run,24-hour mode, 32kHz)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
469
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
470 lda ,u Read base address to set-up clock regs for read
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
471 lda 6,u Get year
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
472 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
473 lda 4,u Get month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
474 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
475 lda 5,u Get day
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
476 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
477 lda 1,u Get hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
478 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
479 lda 2,u Get minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
480 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
481 lda 3,u Get second
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
482 sta ,y+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
483
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
484 puls cc,pc Re-enable interrupts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
485 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
486
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
487 IFNE RTCJVEmu
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
488 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
489 * Vavasour / Collyer Emulator (ignores MPI slot)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
490 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
491 ldx #RTC.Base
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
492 ldd ,x get year (CCYY)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
493 suba #20
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
494 bmi yr1 19xx, OK as is
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
495 yr0 addb #100 20xx adjustment
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
496 deca also check for
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
497 bpl yr0 21xx (optional)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
498 yr1 stb <D.Year set year (~YY)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
499 ldd 2,x get date
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
500 std <D.Month set date (MMDD)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
501 IFNE Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
502 ldd 4,x get time (wwhh)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
503 sta <D.Daywk set day of week
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
504 ELSE
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
505 ldb 5,x get hour (hh)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
506 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
507 stb <D.Hour set hour (hh)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
508 ldd 6,x get time (mmss)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
509 std <D.Min set time (mmss)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
510 * rts fall thru to Setime/Init rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
511 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
512
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
513 IFNE RTCMESSEmu
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
514 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
515 * MESS time update in Disto mode (ignores MPI)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
516 * Assumes that PC clock is in AM/PM mode!!!
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
517 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
518 ldx #RTC.Base
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
519 ldy #D.Time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
520 ldb #12 counter for data
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
521 stb 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
522 lda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
523 anda #7
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
524 IFNE Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
525 sta <D.Daywk
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
526 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
527 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
528 bsr getval
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
529 lda -1,y
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
530 cmpa #70 if >xx70 then its 19xx
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
531 bhi not20
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
532 adda #100
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
533 sta -1,y
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
534 not20 bsr getval month
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
535 bsr getval day
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
536 lda #7 AM/PM mask
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
537 stb 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
538 anda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
539 bitb #4
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
540 pshs cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
541 anda #3
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
542 bsr getval1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
543 puls cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
544 beq AM
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
545 lda #12 convert to 24hr time as it is PM
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
546 adda -1,y
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
547 sta -1,y
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
548 AM bsr getval minute
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
549 * and now fall through into get second
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
550 getval lda #$0f
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
551 stb 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
552 anda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
553 getval1 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
554 pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
555 ldb #10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
556 mul
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
557 stb ,y
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
558 puls b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
559 stb 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
560 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
561 lda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
562 anda #$0f
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
563 adda ,y
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
564 sta ,y+
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
565 * rts fall thru to Setime/Init rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
566 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
567
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
568 IFNE RTCSmart
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
569 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
570 * Update time from Smartwatch RTC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
571 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
572
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
573 pshs cc,d,x,y,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
574 orcc #$50
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
575 lda D.SWPage
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
576 clrb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
577 tfr d,u point to working space
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
578 lda $FF7F
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
579 pshs a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
580 lda D.RTCSlt,u info for MPI slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
581 sta $FF7F
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
582 clr D.RTCMod,u set for read time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
583 jsr D.Start,u jsr to it
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
584 lbra exit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
585 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
586
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
587 IFNE RTCSoft
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
588 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
589 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
590 * Software time update
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
591 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
592 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
593 lda <D.Min grab current minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
594 inca minute+1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
595 cmpa #60 End of hour?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
596 blo UpdMin no, Set start of minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
597 ldd <D.Day get day, hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
598 incb hour+1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
599 cmpb #24 End of Day?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
600 blo UpdHour ..no
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
601 inca day+1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
602 leax <months-1,pcr point to months table with offset-1: Jan = +1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
603 ldb <D.Month this month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
604 cmpa b,x end of month?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
605 bls UpdDay ..no, update the day
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
606 cmpb #2 yes, is it Feb?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
607 bne NoLeap ..no, ok
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
608 ldb <D.Year else get year
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
609 andb #$03 check for leap year: good until 2099
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
610 cmpd #$1D00 29th on leap year?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
611 beq UpdDay ..yes, skip it
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
612 NoLeap ldd <D.Year else month+1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
613 incb month+1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
614 cmpb #13 end of year?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
615 blo UpdMonth ..no
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
616 inca year+1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
617 ldb #$01 set month to jan
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
618 UpdMonth std <D.Year save year, month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
619 lda #$01 day=1st
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
620 UpdDay clrb hour=midnite
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
621 UpdHour std <D.Day save day,hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
622 clra minute=00
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
623 UpdMin clrb seconds=00
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
624 std <D.Min save min,secs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
625 UpdTExit rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
626
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
627 months fcb 31,28,31,30,31,30,31,31,30,31,30,31 Days in each month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
628 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
629
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
630
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
631 *--------------------------------------------------------------------------
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
632 * SetTime Subroutine
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
633 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
634 * This subroutine is called by the main clock module.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
635 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
636
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
637 SetTime equ *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
638
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
639 IFNE RTCBB+RTCCloud9
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
640 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
641 * Set B&B RTC from Time variables
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
642 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
643 pshs u,y,cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
644 leay SendBCD,pcr Send bytes of clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
645 lbra TfrTime
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
646 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
647
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
648 IFNE RTCDsto2
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
649 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
650 * Set Disto 2-in-1 RTC from Time variables
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
651 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
652 pshs a,cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
653 lbsr RTCPre Initialize
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
654
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
655 bsr SetVal Set Year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
656 bsr SetVal Set Month
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
657 bsr SetVal Set Day
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
658 ldd #$0805 $08 in A, $05 in B
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
659 bsr SetVal1 Set Hour (OR value in A ($08) with hour)
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
660 bsr SetVal Set Minute
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
661 bsr SetVal Set Second
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
662
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
663 lbra RTCPost Clean up + return
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
664
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
665 SetVal clra
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
666 SetVal1 stb 2,x Set Clock address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
667 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
668 pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
669 ldb ,y+ Get current value
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
670 DvLoop subb #10 Get Tens digit in A, ones digit in B
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
671 bcs DvDone
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
672 inca
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
673 bra DvLoop
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
674 DvDone addb #10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
675 sta ,x Store tens digit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
676 tfr b,a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
677 puls b Get back original clock address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
678 stb 2,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
679 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
680 sta ,x Store ones digit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
681 rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
682 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
683
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
684 IFNE RTCDsto4
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
685 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
686 * Set Disto 4-in-1 RTC from Time variables
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
687 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
688 pshs cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
689 orcc #IntMasks
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
690
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
691 IFNE MPIFlag
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
692 ldb >MPI.Slct Save currently selected MPak slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
693 pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
694 andb #$F0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
695 orb >SlotSlct,pcr Get slot to select
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
696 stb >MPI.Slct Select MPak slot for clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
697 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
698
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
699 ldy #D.Time+6
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
700 ldx M$Mem,pcr
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
701 clrb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
702 bsr SetVal Set Second
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
703 bsr SetVal Set Minute
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
704 bsr SetVal Set Hour
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
705 bsr SetVal Set Day
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
706 bsr SetVal Set Month
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
707 bsr SetVal Set Year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
708
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
709 IFNE MPIFlag
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
710 puls b Restore old MPAK slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
711 stb >MPI.Slct
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
712 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
713
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
714 puls cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
715 clrb No error
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
716 rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
717
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
718 SetVal clr ,-s Create variable for tens digit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
719 lda ,-y Get current value
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
720 DvLoop suba #10 Get Tens digit on stack, ones digit in A
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
721 bcs DvDone
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
722 inc ,s
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
723 bra DvLoop
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
724 DvDone adda #10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
725 stb 1,x Set Clock address
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
726 incb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
727 sta ,x Store ones digit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
728 stb 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
729 incb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
730 puls a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
731 sta ,x Store tens digit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
732 rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
733 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
734
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
735 IFNE RTCElim
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
736 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
737 * Set Eliminator RTC from D.Time
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
738 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
739 pshs cc save interrupt status
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
740 orcc #IntMasks disable IRQs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
741 ldx M$Mem,pcr get RTC base address from fake memory requirement
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
742 ldy #D.Time point [Y] to time variables in DP
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
743 ldd #$0B*256+RTC.Stop
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
744 bsr UpdatCk0 stop clock before setting it
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
745 ldb #RTC.Sped
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
746 bsr UpdatCk0 set crystal speed, output rate
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
747 bsr UpdatClk go set year
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
748 bsr UpdatClk go set month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
749 bsr UpdatClk go set day of month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
750 bsr UpdatCk0 go set day of week (value doesn't matter)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
751 bsr UpdatCk0 go set hours alarm (value doesn't matter)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
752 bsr UpdatClk go set hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
753 bsr UpdatCk0 go set minutes alarm (value doesn't matter)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
754 bsr UpdatClk go set minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
755 bsr UpdatCk0 go set seconds alarm (value doesn't matter)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
756 bsr UpdatClk go set second
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
757 ldd #$0B*256+RTC.Strt
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
758 bsr UpdatCk0 go start clock
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
759 puls cc Recover IRQ status
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
760 clrb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
761 rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
762
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
763 UpdatClk ldb ,y+ get data from D.Time variables in DP
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
764 UpdatCk0 std ,x generate address strobe, save data
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
765 deca set [A] to next register down
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
766 rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
767
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
768 IFGT Level-1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
769 * OS-9 Level Two code only (for now)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
770 NewSvc fcb F$NVRAM Eliminator adds one new service call
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
771 fdb F.NVRAM-*-2
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
772 fcb $80 end of service call installation table
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
773
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
774 *------------------------------------------------------------
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
775 * read/write RTC Non Volatile RAM (NVRAM)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
776 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
777 * INPUT: [U] = pointer to caller's register stack
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
778 * R$A = access mode (1 = read, 2 = write, other = error)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
779 * R$B = byte count (1 through 50 here, but in other implementations
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
780 * may be 1 through 256 where 0 implies 256)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
781 * R$X = address of buffer in user map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
782 * R$Y = start address in NVRAM
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
783 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
784 * OUTPUT: RTC NVRAM read/written
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
785 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
786 * ERROR OUTPUT: [CC] = Carry set
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
787 * [B] = error code
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
788 F.NVRAM tfr u,y copy caller's register stack pointer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
789 ldd #$0100 ask for one page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
790 os9 F$SRqMem
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
791 bcs NVR.Exit go report error...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
792 pshs y,u save caller's stack and data buffer pointers
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
793 ldx R$Y,y get NVRAM start address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
794 cmpx #50 too high?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
795 bhs Arg.Err yes, go return error...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
796 ldb R$B,y get NVRAM byte count
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
797 beq Arg.Err
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
798 abx check end address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
799 cmpx #50 too high?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
800 bhi Arg.Err yes, go return error...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
801 lda R$A,y get direction flag
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
802 cmpa #WRITE. put caller's data into NVRAM?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
803 bne ChkRead no, go check if read...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
804 clra [D]=byte count
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
805 pshs d save it...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
806 ldx <D.Proc get caller's process descriptor address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
807 lda P$Task,x caller is source task
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
808 ldb <D.SysTsk system is destination task
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
809 ldx R$X,y get caller's source pointer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
810 puls y recover byte count
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
811 os9 F$Move go MOVE data
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
812 bcs NVR.Err
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
813 ldy ,s get caller's register stack pointer from stack
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
814 lda R$Y+1,y get NVRAM start address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
815 adda #$0E add offset to first RTC NVRAM address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
816 ldb R$B,y get byte count
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
817 ldx M$Mem,pcr get clock base address from fake memory requirement
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
818 pshs cc,b save IRQ enable status and byte counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
819 orcc #IntMasks disable IRQs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
820 WrNVR.Lp ldb ,u+ get caller's data
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
821 std ,x generate RTC address strobe and save data to NVRAM
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
822 inca next NVRAM address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
823 dec 1,s done yet?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
824 bne WrNVR.Lp no, go save another byte
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
825 puls cc,b recover IRQ enable status and clean up stack
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
826 NVR.RtM puls y,u recover register stack & data buffer pointers
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
827 ldd #$0100 return one page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
828 os9 F$SRtMem
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
829 NVR.Exit rts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
830
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
831 Arg.Err ldb #E$IllArg Illegal Argument error
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
832 bra NVR.Err
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
833
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
834 ChkRead cmpa #READ. return NVRAM data to caller?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
835 bne Arg.Err illegal access mode, go return error...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
836 lda R$Y+1,y get NVRAM start address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
837 adda #$0E add offset to first RTC NVRAM address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
838 ldx M$Mem,pcr get clock base address from fake memory requirement
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
839 pshs cc,b save IRQ enable status and byte counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
840 orcc #IntMasks disable IRQs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
841 RdNVR.Lp sta ,x generate RTC address strobe
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
842 ldb 1,x get NVRAM data
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
843 stb ,u+ save it to buffer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
844 inca next NVRAM address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
845 dec 1,s done yet?
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
846 bne RdNVR.Lp no, go get another byte
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
847 puls cc,a recover IRQ enable status, clean up stack ([A]=0)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
848 ldb R$B,y [D]=byte count
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
849 pshs d save it...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
850 ldx <D.Proc get caller's process descriptor address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
851 ldb P$Task,x caller is source task
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
852 lda <D.SysTsk system is destination task
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
853 ldu R$X,y get caller's source pointer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
854 puls y recover byte count
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
855 ldx 2,s get data buffer (source) pointer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
856 os9 F$Move go MOVE data
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
857 bcc NVR.RtM
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
858 NVR.Err puls y,u recover caller's stack and data pointers
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
859 pshs b save error code
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
860 ldd #$0100 return one page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
861 os9 F$SRtMem
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
862 comb set Carry for error
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
863 puls b,pc recover error code, return...
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
864 ENDC
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
865 ENDC
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
866
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
867 IFNE RTCHarrs
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
868 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
869 * Set Harris 1770 RTC from Time variables
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
870 *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
871 pshs cc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
872 orcc #IntMasks Disable interrupts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
873
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
874 ldu M$Mem,pcr Get base address
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
875 ldy #D.Time Pointer to time in system map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
876
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
877 lda #%00000100 Init command register (Normal,Int. Disabled,
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
878 sta $11,u STOP clock,24-hour mode, 32kHz)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
879
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
880 lda ,y+ Get year
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
881 sta 6,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
882 lda ,y+ Get month
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
883 sta 4,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
884 lda ,y+ Get day
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
885 sta 5,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
886 lda ,y+ Get hour
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
887 sta 1,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
888 lda ,y+ Get minute
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
889 sta 2,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
890 lda ,y Get second
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
891 sta 3,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
892
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
893 lda #%00001100 Init command register (Normal,Int. Disabled,
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
894 sta $11,u START clock,24-hour mode, 32kHz)
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
895
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
896 puls cc,pc Re-enable interrupts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
897 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
898
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
899 IFNE RTCSmart
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
900 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
901 * Update time from Smartwatch RTC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
902 *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
903 * This set time routine forces military time. It can't turn off clock but can
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
904 * be used as a timer if time set to 0:0:0 hr:min:sec
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
905 pshs cc,d,x,y,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
906 orcc #$50
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
907 lda D.SWPage
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
908 clrb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
909 tfr d,u point to working space
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
910 lda $FF7F
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
911 pshs a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
912 lda D.RTCSlt,u info for MPI slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
913 sta $FF7F
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
914 lda #-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
915 sta D.RTCMod,u indicate set time rather than read
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
916 IFGT Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
917 ldx #D.Slice
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
918 ELSE
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
919 ldx #D.TSec
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
920 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
921 tfr u,y get location of safe region
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
922 leay >D.Start+alrtend-reloc,y point to end of wakeup code
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
923 lda ,-x get D.Time data and store it
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
924 ldb #4 convert tenths sec, sec, min, hours
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
925 bsr binbcd to binary coded decimal
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
926 IFGT Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
927 lda D.Daywk
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
928 ELSE
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
929 clra
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
930 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
931 sta ,y+ set day of week if present
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
932 lda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
933 ldb #3 convert day of month, month, year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
934 bsr binbcd to BCD
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
935 jsr >D.Start,u send data to clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
936 lbra exit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
937
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
938 binbcd pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
939 bcd3 clrb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
940 bcd1 cmpa #10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
941 bcs bcd2
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
942 addd #$f610 decrease bin regA by 10 add bcd $10 to regB
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
943 bra bcd1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
944 bcd2 pshs a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
945 addb ,s+ add in remainder; BCD = binary when less than 10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
946 stb ,y+ place in message to clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
947 lda ,-x get next byte of D.Time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
948 dec ,s decrease counter
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
949 bne bcd3
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
950 puls b,pc
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
951
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
952 * This becomes D.Start
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
953 reloc equ *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
954 IFGT Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
955 lda D.HINIT
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
956 anda #$CC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
957 sta $FF90
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
958 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
959 ldb $FFA6 choose to use normal location
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
960 pshs b
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
961 ldb #$3E
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
962 stb $FFA6 reset MMU for clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
963 sta $FFDE
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
964 ldd #RTC.Base
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
965 tfr a,dp DP now points to clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
966 tst D.RTCMod,u are we reading the clock or setting it?
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
967 beq findclk go if reading
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
968 lbsr wakeup we are setting a found clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
969 lbra found
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
970 findclk lda #-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
971 sta alrtend,pcr
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
972 lbsr wakeup wakeup the clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
973 ldx #D.Sec one incoming byte dropped
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
974 lda #8 bytes to get
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
975 pshs a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
976 L0050 ldb #8 bits to get
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
977 L0052 lsr <RTC.Read get a bit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
978 rora
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
979 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
980 bne L0052
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
981 tst D.RTCFlg,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
982 bne maybe
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
983 cmpa D.Temp,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
984 beq maybe clock might look like ROM
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
985 inc D.RTCFlg,u found the clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
986 maybe sta ,x transfer it to time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
987 lda ,s check loop counter
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
988 cmpa #8
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
989 beq L006F skip if 0.1 sec
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
990 cmpa #4
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
991 bne L006B skip if not day of week
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
992 IFGT Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
993 lda ,x move to correct location
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
994 anda #7
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
995 sta D.Daywk
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
996 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
997 bra L006F
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
998 L006B cmpa #5 hour byte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
999 bne wd
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1000 lda ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1001 bita #%10000000 12/24hr
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1002 beq wd
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1003 bita #%00100000 AM/PM
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1004 pshs cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1005 anda #%00011111 keep only time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1006 puls cc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1007 bne pm
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1008 cmpa #$12 these are BCD tests
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1009 bne am
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1010 clr ,x 12AM=0hr military
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1011 bra wd
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1012 pm cmpa #$12 12PM=12hr military
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1013 beq wd
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1014 adda #$12 1-11PM add 12 for military
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1015 am sta ,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1016 wd leax -1,x update time slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1017 bsr L0087 convert from BCD to binary
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1018 L006F dec ,s
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1019 bne L0050 get the next byte from clock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1020 lda 1,x get year
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1021 cmpa #50 half assed test for century
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1022 bhs c19
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1023 adda #100 make it 20th
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1024 c19 sta 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1025 leas 1,s
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1026 tst D.RTCFlg,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1027 bne found
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1028 ldb D.RTCSlt,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1029 bitb #$30
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1030 beq found
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1031 subb #$10 not found so move to next slot
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1032 stb D.RTCSlt,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1033 stb $FF7F
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1034 lbra findclk
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1035 found clra system DP is always 0
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1036 tfr a,dp
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1037 IFGT Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1038 lda D.HINIT reset system before rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1039 sta $FF90
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1040 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1041 sta $FFDF
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1042 puls a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1043 sta $FFA6
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1044 rts go back to normal code location
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1045
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1046 * Convert BCD to binary
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1047 L0087 lda 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1048 clrb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1049 L008A cmpa #$10 BCD 10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1050 bcs L0094
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1051 addd #$F00A decrease BCD by $10 and add binary 10
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1052 bra L008A
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1053 L0094 pshs a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1054 addb ,s+
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1055 stb 1,x
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1056 term rts
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1057
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1058 wakeup lda <RTC.Read clear the clock for input
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1059 * When getting time data, bit0 is rotated into a full byte. This
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1060 * means the result is $00 or $FF for ROM. Any other value used for a test
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1061 * will give a false positive for the clock.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1062 clrb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1063 bita #1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1064 beq w1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1065 comb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1066 w1 stb D.Temp,u
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1067 leax alert,pcr point to message
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1068 nxtbyte ldb #8 8 bytes to send
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1069 lda ,x+
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1070 cmpa #-1 changed from 0 to -1 to accommodate settime
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1071 beq term
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1072 nxtbit lsra bits sent to clock by toggling
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1073 bcs high Zero and One
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1074 cmpa <RTC.Zero faster than tst
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1075 bra nxtbit2
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1076 high cmpa <RTC.One
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1077 nxtbit2 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1078 bne nxtbit
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1079 bra nxtbyte
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1080
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1081 * SmartWatch wakeup sequence
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1082 alert fcb $c5,$3a,$a3,$5c,$c5,$3a,$a3,$5c
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1083 * The next 8 bytes become time data when setting the clock. Terminator is
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1084 * now $FF instead of $00 to permit $00 as data.
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1085 alrtend fcb $FF
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1086 alrtime rmb 7
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1087 fcb $FF
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1088
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1089 exit equ *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1090 puls a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1091 sta $FF7F restore MPI
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1092 tst D.RTCFlg,u was clock found?
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1093 beq noclock
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1094 puls cc,d,x,y,u,pc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1095 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1096
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1097 *-----------------------------------------------------------------------
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1098 * RTC-specific initializations here
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1099 *
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1100
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1101 Init equ *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1102
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1103 IFNE RTCDsto4
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1104 * Disto 4-N-1 RTC specific initialization
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1105 ldx M$Mem,pcr
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1106 ldd #$010F Set mode for RTC chip
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1107 stb 1,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1108 sta ,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1109 ldd #$0504
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1110 sta ,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1111 stb ,x
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1112 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1113
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1114 IFNE RTCElim
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1115 IFGT Level-1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1116 * Eliminator will install specific system calls
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1117 leay NewSvc,pcr insert syscalls
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1118 os9 F$SSvc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1119 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1120 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1121
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1122 IFNE RTCSmart
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1123 clr <D.SWPage safe location for Read
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1124 pshs d,x,y,u
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1125 IFGT Level-1
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1126 ldx <D.SysMem get memory map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1127 ldy <D.SysDAT get MMU map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1128 ldb #$20 first 20 pages always in use
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1129 abx point to page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1130 A1 tst ,x+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1131 beq A2 found free page so go
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1132 incb update page counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1133 bpl A1 still in RAM only, then go
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1134 A4 lda #2 can't find RAM only memory
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1135 leax mem_mes,pcr
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1136 ldy #40
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1137 os9 I$WritLn
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1138 puls d,x,y,u,pc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1139 A2 pshs b save page #
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1140 andb #%11100000 modulo MMU blocks
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1141 lsrb convert to DAT byte value
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1142 lsrb page# * $100 / $2000 = MMU #
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1143 lsrb $2000/$100=$20 at 2 bytes per MMU
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1144 lsrb then page#/$10 gives answer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1145 ldd b,y get the MMU value
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1146 cmpd #$333E is DAT unused
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1147 pshs cc save answer
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1148 inc 1,s update page # for a used page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1149 puls cc,b get back answer and page #
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1150 beq A1 if unused keep going
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1151 lda #RAMinUse
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1152 sta ,-x flag the memory in use
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1153 ELSE
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1154 ldx <$20 D.FMBM free memory bit map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1155 ldy <$22 top of memory bit map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1156 ldb #-1 preset counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1157 A1 lda ,x+ get bits
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1158 incb update $800 counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1159 pshs y test for end of map
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1160 cmpx ,s+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1161 bhi A4 send error message
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1162 clr -1,s preset bit counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1163 A2 inc ,s
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1164 lsra read left to right
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1165 bcs A2
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1166 lda ,s+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1167 deca convert to number of shifts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1168 cmpa #8 overflow value
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1169 beq A1 get more map on ov
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1170 pshs a save the number of shifts
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1171 lda #8 bytes*8
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1172 mul
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1173 addb ,s add modulo $800
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1174 cmpb #$7E need RAM not ROM for clock data
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1175 bhs A4
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1176 lda #%10000000 need to create mask to map the
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1177 A5 lsra unused bit, so reverse the process
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1178 dec ,s decrease shift counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1179 bne A5
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1180 leas 1,s yank counter
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1181 ora -1,x mark bit used and
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1182 sta -1,x tell the system
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1183 bra A3
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1184 A4 leas 1,s yank bit info
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1185 lda #2 error path #
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1186 leax mem_mes,pcr good memory not found
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1187 ldy #200
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1188 os9 I$WritLn
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1189 puls d,x,y,u,pc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1190 A3 equ *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1191 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1192 stb <D.SWPage keep the info for Read
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1193 tfr b,a
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1194 clrb
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1195 tfr d,x regX now points to SW data page
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1196 ldb $FF7F get MPI values
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1197 andb #3 keep IRQ info
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1198 orb #$30 force slot #4 to start search
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1199 stb D.RTCSlt,x save the info
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1200 clr D.RTCFlg,x set to no clock found
1691
a4d7f06d1797 And so it continues. This was submitted by Rodney AFTER Robert's submission
boisy
parents: 1689
diff changeset
1201 clr D.RTCMod,x set to read time
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1202 leax D.Start,x safe location for moved code
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1203 IFNE H6309
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1204 leay reloc,pcr
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1205 ldw #exit-reloc
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1206 tfm y+,x+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1207 ELSE
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1208 leau reloc,pcr relocation routine to move code
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1209 ldy #exit-reloc to a RAM only location
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1210 B3 lda ,u+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1211 sta ,x+
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1212 leay -1,y
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1213 bne B3
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1214 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1215 puls d,x,y,u,pc
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1216
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1217 noclock equ *
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1218 ldd #7 seven time bytes to clear
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1219 ldx #D.Time
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1220 IFGT Level-1
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1221 sta D.Daywk
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1222 ENDC
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1223 nc sta ,x+
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1224 decb
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1225 bne nc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1226 puls cc,d,x,y,u,pc
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1227
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1228 mem_mes fcc /There is no system memory for/
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1229 fcb $0a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1230 fcc /the SmartWatch. Please reduce/
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1231 fcb $0a
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1232 fcc /os9boot size or use soft clock./
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1233 fcb $0d
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1234
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1235 ELSE
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1236
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1237 rts used for clocks without Init routines
1689
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1238 ENDC
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1239
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1240 emod
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1241 len equ *
1f8962dfa31b This clock2 has Rodney H's changes of 8/1 plus Robert's SmartWatch changes.
boisy
parents: 1652
diff changeset
1242 end
1692
96c2b4a93483 Robert's reorganized clock2.asm, with each clock supported in alphabetical order
boisy
parents: 1691
diff changeset
1243