Mercurial > hg > Members > kono > nitros9-code
annotate 3rdparty/utils/smartwatch/swread.asm @ 2665:ead8a007432b lwtools-port
Fix duplicate symbol definition
MPI.Slct is already defined using SET at some point. Replace the EQU
statement with SET statement to eliminate duplicate defininition error.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 10 Jun 2012 13:25:34 -0600 |
parents | e2ac12787e55 |
children |
rev | line source |
---|---|
221 | 1 ******************************************************************** |
2 * SWRead - Read SmartWatch clock | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Copyright May, 1990 by Robert Gault | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
7 |
221 | 8 * SWREAD will read smartwatch compensating for 12hr mode if active |
9 * time will be sent to OS-9 in 24hr mode for compatability | |
10 * | |
11 * The routine does grab a large uninterruptible block of time from | |
12 * the system, but no other way seems possible. | |
13 * | |
14 * syntax swread [n&] n=1-60 minutes | |
15 * D.Daywk stored for possible use | |
16 * | |
17 * Ed. Comments Who YY/MM/DD | |
18 * ------------------------------------------------------------------ | |
19 * 1 Created RG 91/03/01 | |
20 * 1 Changed irq handling; MPI handling; RG 91/10/29 | |
21 * error handling | |
22 * 1 Removed relocation routine. Removal could be RG 92/12/26 | |
23 * dangerous if OS-9 did not grab block from the | |
24 * low addresses first. Code must not be in a | |
25 * RAM/ROM block when ROMs activated. | |
26 * 2 Relocated part of clock read routine to RG 94/12/19 | |
27 * shorten the time spent with irqs off. | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
28 * 3 Adapted module for Level-1 use. Trimmed code. RG 04/07/24 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
29 * Forced to add back the relocation loop for Level-1. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
30 * Attempted to write a clock2 modules but just too |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
31 * difficult to acquire needed system low ram. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
32 * Removed 6309 code for consistency as it had |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
33 * little effect on speed or size. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
34 * Switched from Chain to Setime to Fork. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
35 |
221 | 36 nam SWRead |
37 ttl Read SmartWatch clock | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
38 |
221 | 39 ifp1 |
40 use defsfile | |
41 endc | |
42 | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
43 DOHELP equ 0 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
44 SETIME equ 0 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
45 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
46 * Next three lines for testing purposes. Remove as makefile will |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
47 * handle this choice. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
48 *Level equ 1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
49 *Level equ 2 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
50 *D.TSec equ $5A |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
51 |
221 | 52 cartI equ $FF22 cartridge IRQ report |
2665
ead8a007432b
Fix duplicate symbol definition
William Astle <lost@l-w.ca>
parents:
1682
diff
changeset
|
53 MPI.Slct set $FF7F |
221 | 54 rom equ $FFDE |
55 ram equ $FFDF | |
56 IEN equ %00100000 | |
57 FEN equ %00010000 | |
58 SCS equ %00000100 | |
59 ROM1 equ %00000010 | |
60 ROM0 equ %00000001 | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
61 RTC.Base equ $C000 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
62 RTC.Blk equ $3E |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
63 RTC.Read equ 4 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
64 RTC.Zero equ 0 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
65 RTC.One equ 1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
66 |
221 | 67 type set prgrm+objct |
68 revs set reent+1 | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
69 edition set 3 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
70 |
221 | 71 mod pgrmend,name,type,revs,start,size |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
72 |
221 | 73 name fcs /SWRead/ |
74 fcb edition | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
75 |
221 | 76 locblk0 rmb 2 pointer to block 0 |
77 locblk3E rmb 2 pointer to block $3E ie. disk ROM | |
78 sleep rmb 1 sleep interval time in minutes | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
79 byte1 rmb 1 clock read data; if no change - no clock |
221 | 80 clkflag rmb 1 set when clock is found |
81 mpiimage rmb 1 | |
82 sleepflg rmb 1 indicates multiple reads requested | |
83 timer rmb 1 count down for sleep interval; per minute | |
84 century rmb 1 century flag | |
85 rawdata rmb 8 direct readout from clock chip | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
86 relocimg rmb 300 place in data for relocated code |
221 | 87 stack rmb 200 |
88 size equ . | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
89 |
221 | 90 message1 fcc /no clock found/ |
255 | 91 fcb C$CR |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
92 IFNE SETIME |
221 | 93 setime fcc /setime/ forced chain to setime routine |
255 | 94 fcb C$CR |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
95 ENDC |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
96 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
97 IFNE DOHELP |
255 | 98 errmes fcb C$LF |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
99 fcc /SWRead syntax:/ |
255 | 100 fcb C$LF,C$LF |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
101 fcc /SWRead [n&]/ |
255 | 102 fcb C$LF |
221 | 103 fcc / The parameter string is optional; n = 1 to 60 min/ |
255 | 104 fcb C$LF |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
105 fcc / permits watch to be polled in background every/ |
255 | 106 fcb C$LF |
221 | 107 fcc / n minutes. Use decimal time values./ |
255 | 108 fcb C$CR |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
109 ENDC |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
110 errmes2 fcb C$LF |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
111 fcc /Don't have relocation memory./ |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
112 fcb C$LF,C$CR |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
113 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
114 start clr sleepflg |
221 | 115 cmpd #2 |
116 blo noparams | |
117 ldd ,x | |
118 cmpa #'? | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
119 beq syntax |
221 | 120 cmpa #'- |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
121 beq syntax |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
122 |
221 | 123 cmpb #'0 if second byte is CR then only one number |
124 blo onebyte | |
125 subd #$3030 convert from ascii to bcd | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
126 |
221 | 127 cmpd #$600 one hour skip is max |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
128 bhi syntax |
221 | 129 cmpb #9 must be a number from 0-9 |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
130 bhi syntax |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
131 |
221 | 132 pshs b convert reg.D to hexidecimal |
133 ldb #10 | |
134 mul | |
135 addb ,s+ | |
136 bra storeit | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
137 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
138 syntax |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
139 IFNE DOHELP |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
140 lda #2 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
141 leax errmes,pcr |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
142 ldy #300 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
143 os9 I$Writln |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
144 ENDC |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
145 clrb |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
146 os9 F$Exit |
221 | 147 |
148 onebyte suba #'0 | |
149 cmpa #9 | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
150 bhi syntax |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
151 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
152 storeit stb timer |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
153 stb sleep used to reset timer on count down |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
154 com sleepflg |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
155 |
221 | 156 noparams equ * |
255 | 157 lda MPI.Slct |
221 | 158 anda #3 retain IRQ settings |
159 ora #$30 start at slot 4; ROM setting | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
160 sta mpiimage |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
161 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
162 IFGT Level-1 |
221 | 163 doit pshs u |
164 ldb #1 single block | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
165 ldx #RTC.Blk disk rom; $07C000-$07DFFF |
255 | 166 os9 F$MapBlk map into user space clock ROM |
221 | 167 bcs exit2 |
168 stu locblk3E save pointer | |
169 ldx #0 system direct page | |
255 | 170 os9 F$MapBlk system direct page |
221 | 171 bcs exit2 |
172 stu locblk0 save pointer | |
173 bsr readclk | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
174 ldb #1 block count |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
175 ldu locblk3E |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
176 os9 F$ClrBlk unmap the block |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
177 ldu locblk0 |
255 | 178 os9 F$ClrBlk |
221 | 179 puls u |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
180 ELSE |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
181 tfr u,d |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
182 cmpa #$7E |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
183 lbhs noroom the assigned DP is too close to ROM |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
184 ldx #RTC.Base |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
185 stx locblk3E |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
186 ldx #0 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
187 stx locblk0 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
188 leax readclk,pcr |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
189 pshs u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
190 leau relocimg,u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
191 ldy #endrel-readclk |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
192 reloc lda ,x+ move the read routines to the data page |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
193 sta ,u+ |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
194 leay -1,y |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
195 bne reloc |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
196 puls u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
197 doit jsr relocimg,u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
198 ENDC |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
199 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
200 tst clkflag was clock found? |
221 | 201 beq error2 |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
202 tst sleepflg are we in repeat mode? |
221 | 203 beq exit |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
204 |
221 | 205 snooze ldx #3540 = one minute of ticks minus one second for overhead |
255 | 206 os9 F$Sleep |
221 | 207 cmpx #0 |
208 bne exit received signal so quit | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
209 |
221 | 210 dec timer |
211 bne snooze | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
212 |
221 | 213 lda sleep reset timer |
214 sta timer | |
215 bra doit go and read the clock | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
216 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
217 exit2 puls u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
218 bra ex |
221 | 219 |
255 | 220 error ldb #E$IllArg |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
221 bra ex |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
222 |
221 | 223 error2 lda #2 error path |
224 leax message1,pcr | |
225 ldy #40 | |
226 os9 I$WritLn | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
227 IFNE SETIME |
221 | 228 * force a normal Setime as SmartWatch was not detected |
255 | 229 lda #Prgrm+Objct modul type |
221 | 230 ldb #2 size of data area |
231 leax setime,pcr | |
232 ldy #0 parameter size | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
233 * leas stack,u |
221 | 234 os9 F$Chain |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
235 ENDC |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
236 exit equ * |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
237 clrb |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
238 ex os9 F$Exit |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
239 |
221 | 240 * this is the heart of the clock reading routine |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
241 |
221 | 242 readclk pshs cc |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
243 IFGT Level-1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
244 lda d.hinit,u get $FF90 image |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
245 ENDC |
255 | 246 ldb MPI.Slct get current setting |
221 | 247 pshs d save them |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
248 IFGT Level-1 |
221 | 249 anda #^(IEN+FEN+ROM1+ROM0) no GIME IRQ/FIRQ; external access |
255 | 250 orcc #IntMasks stop interrupts |
221 | 251 sta $FF90 |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
252 ELSE |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
253 orcc #IntMasks stop interrupts |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
254 ENDC |
221 | 255 sta rom go to ROM mode |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
256 ldx locblk3E point to clock ROM |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
257 ldb mpiimage get new value for MPI |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
258 clr clkflag start with clock not found |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
259 |
255 | 260 findclk stb MPI.Slct set new slot |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
261 leay <alert,pcr point to clock wakeup code |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
262 lda RTC.Read,x clear clock at $C004 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
263 * Reading clock fills a byte with bit0. If clock not present, |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
264 * then result is either $00 or $FF. Any other test byte will |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
265 * result in a false positive for finding the clock. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
266 clrb |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
267 bita #1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
268 beq f1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
269 comb |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
270 f1 stb byte1 set initial value and look for change |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
271 |
221 | 272 nxtbyte ldb #8 bits/byte |
273 lda ,y+ | |
274 beq gettime | |
275 nxtbit lsra do a serial generation | |
276 bcs high | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
277 cmpa RTC.Zero,x talk to clock at $C000; cmp faster than tst |
221 | 278 bra high2 |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
279 high cmpa RTC.One,x talk to clock at $C001 |
221 | 280 high2 decb |
281 bne nxtbit | |
282 bra nxtbyte | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
283 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
284 * Code to tell swatch socket to switch from ROM to clock. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
285 alert fcb $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C,0 |
221 | 286 |
287 gettime lda #8 8 bytes to read from clock | |
288 pshs a | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
289 IFGT Level-1 |
221 | 290 ldy #rawdata |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
291 ELSE |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
292 leay rawdata,u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
293 ENDC |
221 | 294 * read serial bit stream from clock |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
295 timebyte lsr RTC.Read,x this is faster than a short loop with dec/bne |
221 | 296 rora |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
297 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
298 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
299 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
300 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
301 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
302 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
303 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
304 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
305 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
306 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
307 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
308 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
309 lsr RTC.Read,x |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
310 rora |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
311 sta ,y+ store in raw data |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
312 tst clkflag once clock found, bypass tests |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
313 bne maybe |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
314 cmpa byte1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
315 beq maybe always possible a clock byte looks like ROM |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
316 inc clkflag |
221 | 317 maybe dec ,s |
318 bne timebyte | |
319 leas 1,s yank counter | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
320 tst clkflag |
221 | 321 bne found |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
322 ldb mpiimage |
221 | 323 bitb #$30 did we get to slot 0? |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
324 beq found yes? then quick looking |
221 | 325 subb #$10 next slot |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
326 stb mpiimage |
221 | 327 bra findclk |
328 | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
329 noclk rts |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
330 found equ * |
221 | 331 sta ram go back to RAM mode |
332 puls d | |
255 | 333 stb MPI.Slct restore to original setting |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
334 tst cartI clear CART flag for autostart ROM pack present in MPI |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
335 IFGT Level-1 |
221 | 336 sta $FF90 restore GIME mode |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
337 ENDC |
221 | 338 puls cc restore IRQs |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
339 tst clkflag |
221 | 340 beq noclk |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
341 IFGT Level-1 |
221 | 342 ldx #rawdata |
343 leay D.Slice,u | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
344 ELSE |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
345 leax rawdata,u |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
346 ldy #D.TSec $5A |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
347 ENDC |
221 | 348 ldb #8 |
349 pshs b | |
350 trans lda ,x+ translate serial data into OS-9 format | |
351 ldb ,s | |
352 cmpb #1 year | |
353 bne notyr | |
354 cmpa #$80 binary coded decimal number | |
355 bhi nintn | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
356 sta century |
221 | 357 bra notyr |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
358 nintn clr century |
221 | 359 notyr cmpb #4 day of the week |
360 bne notdywk | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
361 IFGT Level-1 |
221 | 362 anda #7 |
363 sta D.Daywk,u | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
364 ENDC |
221 | 365 bra nxtdata |
366 notdywk cmpb #5 special 12/24, AM/PM indicator | |
367 bne cnvrt convert any number | |
368 bita #%10000000 12/24 hour bit | |
369 beq cnvrt 24 hour time | |
370 bita #%00100000 AM/PM bit since 12 hour time, check AM/PM | |
371 pshs cc | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
372 anda #%00011111 keep only time 1-12 |
221 | 373 puls cc |
374 bne PMhr | |
375 cmpa #$12 bcd value | |
376 bne cnvrt | |
377 clra 12 AM = 0 hrs 24hr time | |
378 bra cnvrt | |
379 Pmhr cmpa #$12 bcd value | |
380 beq cnvrt 12PM = 1200 24 hr time | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
381 adda #$12 bcd value; other times (1-11) add 12; ie. 1300-2300 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
382 cnvrt clrb convert BCD to binary |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
383 a1 cmpa #$10 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
384 bcs a2 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
385 addd #$f00a |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
386 bra a1 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
387 a2 pshs a |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
388 addb ,s+ |
221 | 389 stb ,-y decrease pointer and then store |
390 nxtdata dec ,s | |
391 bne trans | |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
392 tst century |
221 | 393 beq not20 |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
394 lda #100 user convention for >1999 values |
1305 | 395 adda ,y |
396 sta ,y | |
221 | 397 not20 puls b,pc |
1682
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
398 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
399 * This is the end of the code to be relocated. |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
400 endrel equ * |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
401 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
402 noroom lda #2 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
403 leax errmes2,pcr |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
404 ldy #300 |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
405 os9 I$WritLn |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
406 clrb |
e2ac12787e55
Sticking with clock2_smart for now. Also moved Robert's swread and swset to 3rdparty/utils
boisy
parents:
1305
diff
changeset
|
407 os9 F$Exit |
221 | 408 |
409 emod | |
410 pgrmend equ * | |
411 end |