0
|
1 ********************************************************************
|
|
2 * Clock2 - Disto 2N1/4N1 clock driver
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 1 MPI slot dependent Disto RTC where edition BRI 89/10/12
|
|
9 * byte is really MPI slot code.
|
|
10
|
|
11 nam Clock2
|
|
12 ttl Disto 2N1/4N1 clock driver
|
|
13
|
|
14 ifp1
|
|
15 use defsfile
|
|
16 endc
|
|
17
|
|
18 tylg set Systm+Objct
|
|
19 atrv set ReEnt+rev
|
|
20 rev set 1
|
|
21 edition set 3
|
|
22
|
|
23
|
|
24 RTCMPSlt equ $33
|
|
25 RTCBase equ $FF50 clock base address
|
|
26
|
|
27 mod eom,name,tylg,atrv,start,RTCBase
|
|
28
|
|
29 name fcs "Clock2"
|
|
30 fcb edition
|
|
31 MPISlot fcb RTCMPSlt
|
|
32
|
|
33 start bra Init
|
|
34 nop
|
|
35 bra GetTime
|
|
36 nop
|
|
37 lbra SetTime
|
|
38
|
|
39 Init pshs x,a,cc
|
|
40 ldx M$Mem,pcr get hw addr of disto clock
|
|
41 orcc #IntMasks mask IRQ and FIRQ
|
|
42 sta >$FFD8 slow down CoCo 3 to .89MHz
|
|
43 ldb >MPI.Slct get current MPI slot
|
|
44 pshs b save it
|
|
45 lda >MPISlot,pcr get our slot selection
|
|
46 sta >MPI.Slct select it!
|
|
47 ldd #$010F
|
|
48 stb 1,x
|
|
49 sta ,x
|
|
50 ldd #$0504
|
|
51 sta ,x
|
|
52 stb ,x
|
|
53 puls b get original slot
|
|
54 stb >MPI.Slct select it!
|
|
55 stb >$FFD9 speed Coco 3 up to 1.78MHz
|
|
56 ldb #59 last second in minute
|
|
57 stb <D.Sec force RTC read
|
|
58 puls x,a,cc fall through to RTC read ebelow
|
|
59
|
|
60 GetTime clrb return no error
|
|
61 pshs u,y,x,b,a,cc save regs to be altered
|
|
62 ldb <D.Sec get current second
|
|
63 incb next...
|
|
64 cmpb #60 minute done?
|
|
65 bcc L005E yes, go read RTC...
|
|
66 stb <D.Sec set new second
|
|
67 bra GTExit go clean up & return
|
|
68 L005E ldx M$Mem,pcr get clock base addr
|
|
69 orcc #IntMasks
|
|
70 sta >$FFD8
|
|
71 ldb >MPI.Slct
|
|
72 pshs b
|
|
73 lda >MPISlot,pcr
|
|
74 sta >MPI.Slct
|
|
75 ldy #D.Time
|
|
76 ldb #$0B
|
|
77 bsr L0098
|
|
78 bsr L0098
|
|
79 bsr L0098
|
|
80 ldb #$05
|
|
81 stb 1,x
|
|
82 decb
|
|
83 lda ,x
|
|
84 anda #$03
|
|
85 bsr L009F
|
|
86 bsr L0098
|
|
87 bsr L0098
|
|
88 puls b
|
|
89 stb >MPI.Slct
|
|
90 stb >$FFD9
|
|
91 GTExit puls pc,u,y,x,b,a,cc recover regs & return
|
|
92
|
|
93 L0098 stb $01,x
|
|
94 decb
|
|
95 lda ,x
|
|
96 anda #$0F
|
|
97 L009F pshs b
|
|
98 ldb #$0A
|
|
99 mul
|
|
100 pshs b
|
|
101 ldb $01,s
|
|
102 stb $01,x
|
|
103 lda ,x
|
|
104 anda #$0F
|
|
105 adda ,s+
|
|
106 puls b
|
|
107 decb
|
|
108 sta ,y+
|
|
109 rts
|
|
110
|
|
111 SetTime clrb no error for return...
|
|
112 pshs u,y,x,b,a,cc save regs to be altered
|
|
113 ldx M$Mem,pcr get clock base addres
|
|
114 orcc #IntMasks
|
|
115 sta >$FFD8
|
|
116 ldb >MPI.Slct
|
|
117 pshs b
|
|
118 lda >MPISlot,pcr
|
|
119 sta >MPI.Slct
|
|
120 ldy #D.Time
|
|
121 ldb #$0B
|
|
122 bsr L00EA
|
|
123 bsr L00EA
|
|
124 bsr L00EA
|
|
125 bsr L00EA
|
|
126 bsr L00EA
|
|
127 bsr L00EA
|
|
128 puls b
|
|
129 stb >MPI.Slct
|
|
130 stb >$FFD9
|
|
131 puls pc,u,y,x,b,a,cc restore altered regs & return
|
|
132
|
|
133 L00EA stb $01,x
|
|
134 decb
|
|
135 clra
|
|
136 pshs b,a
|
|
137 ldb ,y+
|
|
138 clr ,-s
|
|
139 L00F4 subb #$0A
|
|
140 bcs L00FC
|
|
141 inc ,s
|
|
142 bra L00F4
|
|
143 L00FC addb #$0A
|
|
144 puls a
|
|
145 ora ,s+
|
|
146 sta ,x
|
|
147 tfr b,a
|
|
148 puls b
|
|
149 stb $01,x
|
|
150 decb
|
|
151 sta ,x
|
|
152 rts
|
|
153
|
|
154 emod
|
|
155 eom equ *
|
|
156 end
|
|
157
|