Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/clock.asm @ 2725:c2112f93923a lwtools-port
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
o Added NMI code (as a conditional) to clock
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Tue, 31 Jul 2012 11:54:02 -0500 |
parents | 8399491c0821 |
children | d9760f344c96 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
1927 | 2 * Clock - NitrOS-9 System Clock |
1313 | 3 * |
0 | 4 * $Id$ |
5 * | |
1287 | 6 * Edt/Rev YYYY/MM/DD Modified by |
7 * Comment | |
0 | 8 * ------------------------------------------------------------------ |
1313 | 9 * ????/??/?? |
10 * NitrOS-9 2.00 distribution. | |
1287 | 11 * |
1313 | 12 * 9r4 2003/01/01 Boisy G. Pitre |
13 * Back-ported to OS-9 Level Two. | |
1287 | 14 * |
1313 | 15 * 9r5 2003/08/18 Boisy G. Pitre |
16 * Separated clock into Clock and Clock2 for modularity. | |
17 * | |
18 * 9r6 2003/09/04 Boisy G. Pitre | |
19 * Combined Level One and Level Two sources | |
1735 | 20 * |
1742 | 21 * 9r7 2004/11/27 Phill Harvey-Smith |
1735 | 22 * Fixed bug in init routine that was causing DP and CC to |
1742 | 23 * be pulled off the stack and stored in D.Proc under Level 1 |
1735 | 24 * |
1744 | 25 * 9r7 2005/01/17 Boisy G. Pitre |
26 * Fixed incorrect value for PIA initialization. Robert indicated | |
27 * that it should be $3434, not $3435. | |
28 * | |
1794 | 29 * 9r7 2005/04/08 Phill Harvey-Smith |
30 * Made the above level dependent as having PIAs inited with $3434 | |
31 * will disable the IRQ from them, this is ok for Level 2/CoCo 3 as the | |
32 * IRQ is later enabled from the GIME, however the CoCo 1,2 and Dragon | |
33 * do not posses a GIME so anything dependent on the clock tick will | |
34 * hang. So changed to conditionaly compile based on level :- | |
35 * | |
1945 | 36 * 9r8 2005/12/04 Boisy G. Pitre |
37 * Minor code optimizations, fixed issue in Level 1 where clock ran slow | |
38 * due to improper initialization of certain system globals. | |
39 | |
1927 | 40 nam Clock |
41 ttl NitrOS-9 System Clock | |
42 | |
43 ifp1 | |
44 use defsfile | |
45 endc | |
46 | |
47 tylg set Systm+Objct | |
48 atrv set ReEnt+rev | |
1945 | 49 rev set 8 |
1927 | 50 edition set 9 |
51 | |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
52 IFNE atari |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
53 USENMI EQU 0 |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
54 ENDC |
1927 | 55 |
1313 | 56 *------------------------------------------------------------ |
57 * | |
58 * Start of module | |
59 * | |
1927 | 60 mod len,name,tylg,atrv,init,0 |
61 | |
62 name fcs "Clock" | |
63 fcb edition | |
64 | |
65 | |
66 TkPerTS equ TkPerSec/10 ticks per time slice | |
67 | |
1313 | 68 * |
1726
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
69 * Table to set up Service Calls |
1313 | 70 * |
1927 | 71 NewSvc fcb F$Time |
72 fdb FTime-*-2 | |
73 fcb F$VIRQ | |
74 fdb FVIRQ-*-2 | |
75 fcb F$STime | |
76 fdb FSTime-*-2 | |
77 fcb $80 end of service call installation table | |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
78 |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
79 |
1313 | 80 *------------------------------------------------------------ |
81 * | |
82 * Handle F$STime system call | |
83 * | |
84 * First, copy time packet from user address space to system time | |
85 * variables, then fall through to code to update RTC. | |
86 * | |
1927 | 87 FSTime equ * |
88 ldx R$X,u | |
89 ldd ,x | |
90 std <D.Year | |
91 ldd 2,x | |
92 std <D.Day | |
93 ldd 4,x | |
94 std <D.Min | |
95 lda #TkPerSec reset to start of second | |
96 sta <D.Tick | |
97 ldx <D.Clock2 get entry point to Clock2 | |
1945 | 98 clra clear carry |
1927 | 99 jmp $06,x and call SetTime entry point |
100 | |
1313 | 101 *-------------------------------------------------- |
102 * | |
103 * Clock Initialization | |
104 * | |
105 * This vector is called by the kernel to service the first F$STime | |
1742 | 106 * call. F$STime is usually called by SysGo (with a dummy argument) |
1313 | 107 * in order to initialize the clock. F$STime is re-vectored to the |
108 * service code above to handle future F$STime calls. | |
109 * | |
110 * | |
1927 | 111 |
112 Clock2 fcs "Clock2" | |
113 | |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
114 init |
1927 | 115 pshs dp,cc save DP and CC |
116 clra | |
117 tfr a,dp set DP to zero | |
118 leax <Clock2,pcr | |
119 lda #Sbrtn+Objct | |
120 os9 F$Link | |
121 bcc LinkOk | |
122 jmp >$FFFE level 1: jump to reset vector | |
123 | |
124 LinkOk | |
125 puls cc,dp ; Restore saved dp and cc | |
126 sty <D.Clock2 save entry point | |
127 InitCont | |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
128 * Do not need to explicitly read RTC during initialization |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
129 ldd #59*256+$01 last second and last tick |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
130 std <D.Sec will prompt RTC read at next time slice |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
131 ldb #TkPerSec |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
132 stb <D.TSec set ticks per second |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
133 ldb #TkPerTS get ticks per time slice |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
134 stb <D.TSlice set ticks per time slice |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
135 stb <D.Slice set first time slice |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
136 IFNE atari |
2714
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
137 leax SvcIRQ,pcr set IRQ handler |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
138 IFNE USENMI |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
139 stx <D.NMI |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
140 ELSE |
2714
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
141 stx <D.IRQ |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
142 ENDC |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
143 ELSE |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
144 leax SvcIRQ,pcr set IRQ handler |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
145 stx <D.IRQ |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
146 ENDC |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
147 |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
148 leay NewSvc,pcr insert syscalls |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
149 os9 F$SSvc |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
150 |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
151 * Call Clock2 init routine |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
152 ldy <D.Clock2 get entry point to Clock2 |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
153 jsr ,y call init entry point of Clock2 |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
154 |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
155 * Initialize clock hardware |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
156 IFNE atari |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
157 IFNE USENMI |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
158 lda #$40 |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
159 sta NMIEN enable VBlank NMI |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
160 rts |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
161 ELSE |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
162 lda #IRQST.TIMER1 |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
163 pshs cc |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
164 orcc #IntMasks |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
165 ora <D.IRQENShdw |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
166 sta <D.IRQENShdw |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
167 sta IRQEN |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
168 lda #%00101001 |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
169 sta AUDCTL |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
170 clr AUDC1 |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
171 lda #$FF |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
172 sta AUDF1 |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
173 sta STIMER |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
174 puls cc,pc |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
175 ENDC |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
176 ELSE |
1927 | 177 ldx #PIA0Base point to PIA0 |
178 clra no error for return... | |
179 pshs cc save IRQ enable status (and Carry clear) | |
180 orcc #IntMasks stop interrupts | |
181 | |
182 sta 1,x enable DDRA | |
183 sta ,x set port A all inputs | |
184 sta 3,x enable DDRB | |
185 coma | |
186 sta 2,x set port B all outputs | |
187 | |
1735 | 188 ; ldd #$343C [A]=PIA0 CRA contents, [B]=PIA0 CRB contents |
1927 | 189 |
190 ldd #$3435 IRQ needs to be left enabled for Level1, as no GIME generated IRQ | |
191 | |
192 sta 1,x CA2 (MUX0) out low, port A, disable HBORD high-to-low IRQs | |
193 stb 3,x CB2 (MUX1) out low, port B, disable VBORD low-to-high IRQs | |
194 | |
195 lda 2,x clear possible pending PIA0 VBORD IRQ | |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
196 puls cc,pc recover IRQ enable status and return |
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
197 ENDC |
1927 | 198 |
1726
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
199 * |
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
200 * Clock IRQ Entry Point |
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
201 * |
1945 | 202 * For CoCo 1/2, called once every 16.667 milliseconds |
1927 | 203 SvcIRQ |
204 clra | |
205 tfr a,dp set direct page to zero | |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
206 IFNE atari |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
207 IFNE USENMI |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
208 sta NMIRES clear NMI interrupt |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
209 ELSE |
2714
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
210 lda IRQST get hw byte |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
211 bita #IRQST.TIMER1 |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
212 beq L0032 branch if interrupt occurred |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
213 jmp [>D.SvcIRQ] else service other possible IRQ |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
214 L0032 |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
215 lda #$FF |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
216 sta AUDF1 |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
217 lda <D.IRQENShdw |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
218 tfr a,b A = clear interrupt, B = set interrupt |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
219 anda #^IRQST.TIMER1 |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
220 orb #IRQST.TIMER1 |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
221 sta IRQEN |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
222 stb IRQEN |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
223 stb <D.IRQENShdw |
8399491c0821
Reworked sources so that serial polling for the atari works.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2657
diff
changeset
|
224 sta STIMER |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2714
diff
changeset
|
225 ENDC |
2657
90d13dbd887a
Fixed error in source
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2656
diff
changeset
|
226 ELSE |
90d13dbd887a
Fixed error in source
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2656
diff
changeset
|
227 tst PIA0Base+3 get hw byte |
1927 | 228 bmi L0032 branch if sync flag on |
229 jmp [>D.SvcIRQ] else service other possible IRQ | |
1945 | 230 L0032 tst PIA0Base+2 clear interrupt |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
231 ENDC |
1927 | 232 dec <D.Tick decrement tick counter |
233 bne L007F go around if not zero | |
234 ldb <D.Sec get minutes/seconds | |
1726
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
235 * Seconds increment |
1927 | 236 incb increment seconds |
237 cmpb #60 full minute? | |
238 bcs L0079 nope... | |
1726
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
239 * |
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
240 * Call GetTime entry point in Clock2 |
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
241 * |
1927 | 242 ldx <D.Clock2 get entry point to Clock2 |
243 jsr $03,x call GetTime entry point | |
244 fcb $8C skip next 2 bytes | |
245 L0079 stb <D.Sec update sec | |
246 L007B lda <D.TSec get ticks per second value | |
247 sta <D.Tick and repopulate tick decrement counter | |
248 L007F clra clear A | |
249 pshs a and save it on the stack | |
250 ldy <D.CLTb get pointer to VIRQ Polling Entries | |
251 bra L009E go to the processing portion of the loop | |
252 L0087 ldd Vi.Cnt,x get count down counter | |
253 subd #$0001 subtract tick count | |
254 bne L009C branch if not at terminal count ($0000) | |
255 lda #$01 | |
256 sta ,s set flag on stack to 1 | |
257 lda Vi.Stat,x get status byte | |
258 beq DelEntry branch if zero (one shot, so delete) | |
259 L0096 ora #Vi.IFlag set interrupted flag | |
260 sta Vi.Stat,x save in packet | |
261 ldd Vi.Rst,x get reset count | |
262 L009C std Vi.Cnt,x save tick count back | |
263 L009E ldx ,y++ get two bytes at Y | |
264 bne L0087 if not zero, branch | |
265 lda ,s+ else get byte off stack | |
266 beq GoAltIRQ branch if zero | |
267 ldx <D.Proc else get pointer to current process descriptor | |
268 beq L00AE branch if none | |
2631
442795681807
o Fixed Atari SIO DWRead to timeout longer
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
269 tst P$State,x test process state |
1927 | 270 bpl UsrPoll branch if system state not set |
271 L00AE jsr [>D.Poll] poll ISRs | |
272 bcc L00AE keep polling until carry set | |
273 GoAltIRQ | |
274 jmp [>D.AltIRQ] jump into an alternate IRQ if available | |
275 DelEntry | |
276 bsr DelVIRQ delete the VIRQ entry | |
277 bra L0096 | |
278 | |
279 UsrPoll leay >up@,pcr point to routine to execute | |
280 jmp [>D.URtoSs] User to System | |
281 up@ jsr [>D.Poll] call polling routine | |
282 bcc up@ keep polling until carry set | |
283 ldx <D.Proc get current process descriptor | |
284 ldb P$State,x and its state | |
285 andb #^SysState turn off sysstate bit | |
286 stb P$State,x save new state | |
287 ldd <P$SWI2,x | |
288 std <D.SWI2 | |
289 ldd <D.UsrIRQ | |
290 std <D.SvcIRQ | |
291 bra GoAltIRQ | |
292 | |
293 DelVIRQ pshs y,x save off Y,X | |
294 dl@ ldx ,y++ get next entry | |
295 stx -$04,y move up | |
296 bne dl@ continue until all are moved | |
297 puls y,x restore | |
298 leay -2,y move back 2 from Y (points to last entry) | |
299 rts return | |
300 | |
1726
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
301 * Install or Remove VIRQ Entry |
1927 | 302 FVIRQ pshs cc |
303 orcc #IntMasks mask all interrupts | |
304 ldy <D.CLTb get pointer to VIRQ polling table | |
305 ldx <D.Init get pointer to init module | |
306 ldb PollCnt,x get poll count | |
307 ldx R$X,u get pointer to caller's X | |
308 beq L0118 branch if removing | |
309 tst ,y entry available? | |
310 beq L010C | |
311 subb #$02 | |
312 lslb | |
313 leay b,y | |
314 tst ,y | |
315 bne PTblFul polling table full | |
316 L0106 tst ,--y | |
317 beq L0106 | |
318 leay $02,y | |
319 L010C ldx R$Y,u | |
320 stx ,y | |
321 ldy R$D,u | |
322 sty ,x | |
323 bra L0124 | |
324 L0118 leax R$Y,u X = caller's Y | |
325 L011A tst ,y end of VIRQ table | |
326 beq L0124 branch if so | |
327 cmpx ,y++ else compare to current VIRQ entry and inc Y | |
328 bne L011A continue searching if not matched | |
329 bsr DelVIRQ else delete entry | |
330 L0124 puls cc | |
331 clrb | |
332 rts | |
333 PTblFul puls cc | |
334 comb | |
335 ldb #E$Poll | |
336 rts | |
337 | |
338 | |
339 | |
1726
043d330e2f0e
Recomposed source lines to share more common code between Level 1
boisy
parents:
1658
diff
changeset
|
340 * F$Time system call code |
1927 | 341 FTime ldx R$X,u |
342 ldd <D.Year | |
343 std ,x | |
344 ldd <D.Day | |
345 std 2,x | |
346 ldd <D.Min | |
347 std 4,x | |
348 clrb | |
349 rts | |
350 | |
351 emod | |
352 len equ * | |
353 end |