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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
1 ********************************************************************
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
2 * SWRead - Read SmartWatch clock
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
3 *
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
4 * $Id$
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
5 *
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
8 * SWREAD will read smartwatch compensating for 12hr mode if active
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
9 * time will be sent to OS-9 in 24hr mode for compatability
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
10 *
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
11 * The routine does grab a large uninterruptible block of time from
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
12 * the system, but no other way seems possible.
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
13 *
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
14 * syntax swread [n&] n=1-60 minutes
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
15 * D.Daywk stored for possible use
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
16 *
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
17 * Ed. Comments Who YY/MM/DD
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
18 * ------------------------------------------------------------------
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
19 * 1 Created RG 91/03/01
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
20 * 1 Changed irq handling; MPI handling; RG 91/10/29
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
21 * error handling
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
22 * 1 Removed relocation routine. Removal could be RG 92/12/26
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
23 * dangerous if OS-9 did not grab block from the
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
24 * low addresses first. Code must not be in a
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
25 * RAM/ROM block when ROMs activated.
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
26 * 2 Relocated part of clock read routine to RG 94/12/19
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
36 nam SWRead
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
39 ifp1
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
40 use defsfile
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
41 endc
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
54 rom equ $FFDE
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
55 ram equ $FFDF
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
56 IEN equ %00100000
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
57 FEN equ %00010000
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
58 SCS equ %00000100
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
59 ROM1 equ %00000010
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
67 type set prgrm+objct
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
73 name fcs /SWRead/
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
76 locblk0 rmb 2 pointer to block 0
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
77 locblk3E rmb 2 pointer to block $3E ie. disk ROM
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
80 clkflag rmb 1 set when clock is found
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
81 mpiimage rmb 1
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
82 sleepflg rmb 1 indicates multiple reads requested
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
83 timer rmb 1 count down for sleep interval; per minute
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
84 century rmb 1 century flag
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
87 stack rmb 200
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
90 message1 fcc /no clock found/
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
93 setime fcc /setime/ forced chain to setime routine
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
102 fcb C$LF
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
103 fcc / The parameter string is optional; n = 1 to 60 min/
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
106 fcb C$LF
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
107 fcc / n minutes. Use decimal time values./
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
115 cmpd #2
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
116 blo noparams
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
117 ldd ,x
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
123 cmpb #'0 if second byte is CR then only one number
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
124 blo onebyte
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
132 pshs b convert reg.D to hexidecimal
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
133 ldb #10
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
134 mul
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
135 addb ,s+
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
147
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
148 onebyte suba #'0
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
156 noparams equ *
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
157 lda MPI.Slct
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
158 anda #3 retain IRQ settings
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
163 doit pshs u
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
166 os9 F$MapBlk map into user space clock ROM
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
167 bcs exit2
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
168 stu locblk3E save pointer
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
169 ldx #0 system direct page
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
170 os9 F$MapBlk system direct page
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
171 bcs exit2
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
172 stu locblk0 save pointer
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
178 os9 F$ClrBlk
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
205 snooze ldx #3540 = one minute of ticks minus one second for overhead
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
206 os9 F$Sleep
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
207 cmpx #0
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
210 dec timer
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
213 lda sleep reset timer
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
214 sta timer
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
219
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
223 error2 lda #2 error path
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
224 leax message1,pcr
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
225 ldy #40
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
228 * force a normal Setime as SmartWatch was not detected
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
229 lda #Prgrm+Objct modul type
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
230 ldb #2 size of data area
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
231 leax setime,pcr
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
246 ldb MPI.Slct get current setting
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
249 anda #^(IEN+FEN+ROM1+ROM0) no GIME IRQ/FIRQ; external access
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
250 orcc #IntMasks stop interrupts
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
272 nxtbyte ldb #8 bits/byte
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
273 lda ,y+
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
274 beq gettime
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
275 nxtbit lsra do a serial generation
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
280 high2 decb
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
281 bne nxtbit
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
286
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
287 gettime lda #8 8 bytes to read from clock
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
317 maybe dec ,s
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
318 bne timebyte
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
327 bra findclk
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
331 sta ram go back to RAM mode
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
332 puls d
255
8537883cc963 Comment improvements
boisy
parents: 221
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
342 ldx #rawdata
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
348 ldb #8
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
349 pshs b
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
350 trans lda ,x+ translate serial data into OS-9 format
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
351 ldb ,s
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
352 cmpb #1 year
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
353 bne notyr
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
354 cmpa #$80 binary coded decimal number
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
359 notyr cmpb #4 day of the week
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
362 anda #7
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
365 bra nxtdata
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
366 notdywk cmpb #5 special 12/24, AM/PM indicator
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
367 bne cnvrt convert any number
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
368 bita #%10000000 12/24 hour bit
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
369 beq cnvrt 24 hour time
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
370 bita #%00100000 AM/PM bit since 12 hour time, check AM/PM
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
373 puls cc
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
374 bne PMhr
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
375 cmpa #$12 bcd value
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
376 bne cnvrt
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
377 clra 12 AM = 0 hrs 24hr time
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
378 bra cnvrt
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
379 Pmhr cmpa #$12 bcd value
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
389 stb ,-y decrease pointer and then store
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
390 nxtdata dec ,s
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
7d4057b4b5cd Fixed bug pointed out by Robert Gault
boisy
parents: 255
diff changeset
395 adda ,y
7d4057b4b5cd Fixed bug pointed out by Robert Gault
boisy
parents: 255
diff changeset
396 sta ,y
221
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
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
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
408
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
409 emod
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
410 pgrmend equ *
5a27279ccc08 Added new utils
boisy
parents:
diff changeset
411 end