Mercurial > hg > Members > kono > nitros9-code
annotate level2/modules/clock.asm @ 2926:53961f90b9dd
d64/makefile: Stop building if error in subdirectory build
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sat, 18 Jan 2014 09:54:17 +0100 |
parents | 4036f8e844a7 |
children | f77ac3ae8a43 |
rev | line source |
---|---|
2654
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
1 ******************************************************************** |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
2 * Clock - Clock for OS-9 Level Two/NitrOS-9 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
3 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
4 * Clock module for CoCo 3 and TC9 OS9 Level 2 and NitrOS-9 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
5 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
6 * Includes support for several different RTC chips, GIME Toggle |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
7 * IRQ fix, numerous minor changes. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
8 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
9 * Based on Microware/Tandy Clock Module for CC3/L2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
10 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
11 * $Id$ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
12 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
13 * Edt/Rev YYYY/MM/DD Modified by |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
14 * Comment |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
15 * ------------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
16 * ????/??/?? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
17 * NitrOS-9 2.00 distribution. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
18 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
19 * 9r4 2003/01/01 Boisy G. Pitre |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
20 * Back-ported to OS-9 Level Two. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
21 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
22 * 9r5 2003/08/18 Boisy G. Pitre |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
23 * Separated clock into Clock and Clock2 for modularity. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
24 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
25 nam Clock |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
26 ttl Clock for OS-9 Level Two/NitrOS-9 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
27 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
28 TkPerTS equ 2 ticks per time slice |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
29 GI.Toggl equ %00000001 GIME CART* IRQ enable bit, for CC3 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
30 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
31 * TC9 needs to reset more interrupt sources |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
32 *GI.Toggl equ %00000111 GIME SERINT*, KEYINT*, CART* IRQ enable bits |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
33 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
34 IFP1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
35 use defsfile |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
36 use cocovtio.d |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
37 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
38 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
39 Edtn equ 9 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
40 Vrsn equ 5 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
41 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
42 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
43 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
44 * Start of module |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
45 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
46 mod len,name,Systm+Objct,ReEnt+Vrsn,Init,0 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
47 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
48 name fcs "Clock" |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
49 fcb Edtn |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
50 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
51 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
52 * Table to set up Service Calls: |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
53 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
54 NewSvc fcb F$Time |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
55 fdb F.Time-*-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
56 fcb F$VIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
57 fdb F.VIRQ-*-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
58 fcb F$Alarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
59 fdb F.ALARM-*-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
60 fcb F$STime |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
61 fdb F.STime-*-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
62 fcb $80 end of service call installation table |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
63 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
64 *--------------------------------------------------------- |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
65 * IRQ Handling starts here. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
66 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
67 * Caveat: There may not be a stack at this point, so avoid using one. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
68 * Stack is set up by the kernel between here and SvcVIRQ. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
69 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
70 SvcIRQ lda >IRQEnR Get GIME IRQ Status and save it. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
71 ora <D.IRQS |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
72 sta <D.IRQS |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
73 bita #$08 Check for clock interrupt |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
74 beq NoClock |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
75 anda #^$08 Drop clock interrupt |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
76 sta <D.IRQS |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
77 ldx <D.VIRQ Set VIRQ routine to be executed |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
78 clr <D.QIRQ ---x IS clock IRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
79 bra ContIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
80 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
81 NoClock leax DoPoll,pcr If not clock IRQ, just poll IRQ source |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
82 IFNE H6309 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
83 oim #$FF,<D.QIRQ ---x set flag to NOT clock IRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
84 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
85 lda #$FF |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
86 sta <D.QIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
87 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
88 ContIRQ stx <D.SvcIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
89 jmp [D.XIRQ] Chain through Kernel to continue IRQ handling |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
90 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
91 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
92 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
93 * IRQ handling re-enters here on VSYNC IRQ. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
94 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
95 * - Count down VIRQ timers, mark ones that are done |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
96 * - Call DoPoll/DoToggle to service VIRQs and IRQs and reset GIME |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
97 * - Call Keyboard scan |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
98 * - Update time variables |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
99 * - At end of minute, check alarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
100 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
101 SvcVIRQ clra Flag if we find any VIRQs to service |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
102 pshs a |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
103 ldy <D.CLTb Get address of VIRQ table |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
104 bra virqent |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
105 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
106 virqloop equ * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
107 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
108 ldd 2,y Get Level 3 extended map type |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
109 orcc #IntMasks |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
110 sta >$0643 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
111 stb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
112 std >$FFA1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
113 andcc #^IntMasks |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
114 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
115 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
116 ldd Vi.Cnt,x Decrement tick count |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
117 IFNE H6309 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
118 decd --- subd #1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
119 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
120 subd #$0001 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
121 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
122 bne notzero Is this one done? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
123 lda Vi.Stat,x Should we reset? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
124 bmi doreset |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
125 lbsr DelVIRQ No, delete this entry |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
126 doreset ora #$01 Mark this VIRQ as triggered. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
127 sta Vi.Stat,x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
128 lda #$80 Add VIRQ as interrupt source |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
129 sta ,s |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
130 ldd Vi.Rst,x Reset from Reset count. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
131 notzero std Vi.Cnt,x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
132 virqent ldx ,y++ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
133 bne virqloop |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
134 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
135 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
136 puls d |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
137 orcc #Carry |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
138 stb >$0643 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
139 stb >$FFA1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
140 incb |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
141 stb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
142 stb >$FFA1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
143 andcc #^IntMasks |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
144 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
145 puls a Get VIRQ status flag: high bit set if VIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
146 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
147 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
148 ora <D.IRQS Check to see if other hardware IRQ pending. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
149 bita #%10110111 Any V/IRQ interrupts pending? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
150 beq toggle |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
151 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
152 lbsr DoPoll Yes, go service them. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
153 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
154 bsr DoPoll Yes, go service them. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
155 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
156 bra KbdCheck |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
157 toggle equ * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
158 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
159 lbsr DoToggle No, toggle GIME anyway |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
160 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
161 bsr DoToggle No, toggle GIME anyway |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
162 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
163 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
164 KbdCheck equ * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
165 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
166 lda >$0643 grab current map type |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
167 ldb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
168 pshs d save it |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
169 orcc #IntMasks IRQs off |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
170 lda >$0660 SCF local memory ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
171 sta >$0643 into DAT image ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
172 sta >$FFA1 and into RAM ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
173 inca |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
174 sta >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
175 sta >$FFA2 map in SCF, CC3IO, WindInt, etc. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
176 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
177 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
178 jsr [>D.AltIRQ] go update mouse, gfx cursor, keyboard, etc. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
179 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
180 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
181 puls d restore original map type ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
182 orcc #IntMasks |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
183 sta >$0643 into system DAT image ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
184 stb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
185 std >$FFA1 and into RAM ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
186 andcc #$AF |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
187 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
188 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
189 dec <D.Tick End of second? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
190 bne VIRQend No, skip time update and alarm check |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
191 lda #TkPerSec Reset tick count |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
192 sta <D.Tick |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
193 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
194 * ATD: Modified to call real time clocks on every minute ONLY. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
195 inc <D.Sec go up one second |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
196 lda <D.Sec grab current second |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
197 cmpa #60 End of minute? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
198 blo VIRQend No, skip time update and alarm check |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
199 clr <D.Sec Reset second count to zero |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
200 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
201 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
202 * Call GetTime entry point in Clock2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
203 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
204 ldx <D.Clock2 get entry point to Clock2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
205 jsr $03,x call GetTime entry point |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
206 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
207 NoGet ldd >WGlobal+G.AlPID |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
208 ble VIRQend Quit if no Alarm set |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
209 ldd >WGlobal+G.AlPckt+3 Does Hour/Minute agree? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
210 cmpd <D.Hour |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
211 bne VIRQend |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
212 ldd >WGlobal+G.AlPckt+1 Does Month/Day agree? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
213 cmpd <D.Month |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
214 bne VIRQend |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
215 ldb >WGlobal+G.AlPckt+0 Does Year agree? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
216 cmpb <D.Year |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
217 bne VIRQend |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
218 ldd >WGlobal+G.AlPID |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
219 cmpd #1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
220 beq checkbel |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
221 os9 F$Send |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
222 bra endalarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
223 checkbel ldb <D.Sec Sound bell for 15 seconds |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
224 andb #$F0 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
225 beq dobell |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
226 endalarm ldd #$FFFF |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
227 std >WGlobal+G.AlPID |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
228 bra VIRQend |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
229 dobell ldx >WGlobal+G.BelVec |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
230 beq VIRQend |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
231 jsr ,x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
232 VIRQend jmp [>D.Clock] Jump to kernel's timeslice routine |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
233 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
234 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
235 * Interrupt polling and GIME reset code |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
236 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
237 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
238 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
239 * Call [D.Poll] until all interrupts have been handled |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
240 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
241 Dopoll |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
242 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
243 lda >$0643 Level 3: get map type |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
244 ldb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
245 pshs d save for later |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
246 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
247 Dopoll.i |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
248 jsr [>D.Poll] Call poll routine |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
249 bcc DoPoll.i Until error (error -> no interrupt found) |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
250 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
251 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
252 puls d |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
253 orcc #IntMasks |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
254 sta >$0643 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
255 stb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
256 std >$FFA1 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
257 andcc #^IntMasks |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
258 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
259 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
260 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
261 * Reset GIME to avoid missed IRQs |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
262 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
263 DoToggle lda #^GI.Toggl Mask off CART* bit |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
264 anda <D.IRQS |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
265 sta <D.IRQS |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
266 lda <D.IRQER Get current enable register status |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
267 tfr a,b |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
268 anda #^GI.Toggl Mask off CART* bit |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
269 orb #GI.Toggl --- ensure that 60Hz IRQ's are always enabled |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
270 sta >IRQEnR Disable CART |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
271 stb >IRQEnR Enable CART |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
272 clrb |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
273 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
274 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
275 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
276 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
277 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
278 * Handle F$VIRQ system call |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
279 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
280 F.VIRQ pshs cc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
281 orcc #IntMasks Disable interrupts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
282 ldy <D.CLTb Address of VIRQ table |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
283 ldx <D.Init Address of INIT |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
284 ldb PollCnt,x Number of polling table entries from INIT |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
285 ldx R$X,u Zero means delete entry |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
286 beq RemVIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
287 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
288 bra FindVIRQ ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
289 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
290 v.loop leay 4,y ---x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
291 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
292 FindVIRQ ldx ,y++ Is VIRQ entry null? |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
293 beq AddVIRQ If yes, add entry here |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
294 decb |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
295 bne FindVIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
296 puls cc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
297 comb |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
298 ldb #E$Poll |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
299 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
300 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
301 AddVIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
302 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
303 ldx R$Y,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
304 stx ,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
305 lda >$0643 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
306 ldb >$0645 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
307 std 2,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
308 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
309 leay -2,y point to first null VIRQ entry |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
310 ldx R$Y,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
311 stx ,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
312 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
313 ldy R$D,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
314 sty ,x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
315 bra virqexit |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
316 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
317 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
318 v.chk leay 4,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
319 RemVIRQ ldx ,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
320 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
321 RemVIRQ ldx ,y++ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
322 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
323 beq virqexit |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
324 cmpx R$Y,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
325 bne RemVIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
326 bsr DelVIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
327 virqexit puls cc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
328 clrb |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
329 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
330 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
331 DelVIRQ pshs x,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
332 DelVLup |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
333 IFGT Level-2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
334 ldq ,y++ move entries up in table |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
335 leay 2,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
336 stq -8,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
337 bne DelVLup |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
338 puls x,y,pc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
339 ELSE |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
340 ldx ,y++ move entries up in table |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
341 stx -4,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
342 bne DelVLup |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
343 puls x,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
344 leay -2,y |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
345 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
346 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
347 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
348 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
349 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
350 * Handle F$Alarm call |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
351 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
352 F.Alarm ldx #WGlobal+G.AlPckt |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
353 ldd R$D,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
354 bne DoAlarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
355 std G.AlPID-G.AlPckt,x Erase F$Alarm PID, Signal. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
356 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
357 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
358 DoAlarm tsta If PID != 0, set alarm for this process |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
359 bne SetAlarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
360 cmpd #1 1 -> Set system-wide alarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
361 bne GetAlarm |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
362 SetAlarm std G.AlPID-G.AlPckt,x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
363 ldy <D.Proc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
364 lda P$Task,y Move from process task |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
365 ldb <D.SysTsk To system task |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
366 ldx R$X,u From address given in X |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
367 ldu #WGlobal+G.AlPckt |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
368 ldy #5 Move 5 bytes |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
369 bra FMove |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
370 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
371 GetAlarm cmpd #2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
372 bne AlarmErr |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
373 ldd G.AlPID-G.AlPckt,x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
374 std R$D,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
375 bra RetTime |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
376 AlarmErr comb |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
377 ldb #E$IllArg |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
378 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
379 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
380 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
381 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
382 * Handle F$Time System call |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
383 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
384 F.Time equ * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
385 ldx #D.Time Address of system time packet |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
386 RetTime ldy <D.Proc Get pointer to current proc descriptor |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
387 ldb P$Task,y Process Task number |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
388 lda <D.SysTsk From System Task |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
389 ldu R$X,u |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
390 STime.Mv ldy #6 Move 6 bytes |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
391 FMove os9 F$Move |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
392 rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
393 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
394 *------------------------------------------------------------ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
395 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
396 * Handle F$STime system call |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
397 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
398 * First, copy time packet from user address space to system time |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
399 * variables, then fall through to code to update RTC. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
400 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
401 F.STime equ * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
402 ldx <D.Proc Caller's process descriptor |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
403 lda P$Task,x Source is in user map |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
404 ldx R$X,u Address of caller's time packet |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
405 ldu #D.Time Destination address |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
406 ldb <D.SysTsk Destination is in system map |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
407 bsr STime.Mv Get time packet (ignore errors) |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
408 lda #TkPerSec Reset to start of second |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
409 sta <D.Tick |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
410 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
411 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
412 * Call SetTime entry point in Clock2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
413 ldx <D.Clock2 get entry point to Clock2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
414 jsr $06,x else call GetTime entry point |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
415 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
416 NoSet rts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
417 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
418 Clock2 fcs "Clock2" |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
419 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
420 *-------------------------------------------------- |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
421 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
422 * Clock Initialization |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
423 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
424 * This vector is called by the kernel to service the first F$STime |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
425 * call. F$STime is usually called by CC3Go (with a dummy argument) |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
426 * in order to initialize the clock. F$STime is re-vectored to the |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
427 * service code above to handle future F$STime calls. |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
428 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
429 * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
430 Init ldx <D.Proc save user proc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
431 pshs x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
432 ldx <D.SysPrc make sys for link |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
433 stx <D.Proc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
434 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
435 leax <Clock2,pcr |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
436 lda #Sbrtn+Objct |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
437 os9 F$Link |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
438 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
439 * And here, we restore the original D.Proc value |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
440 puls x |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
441 stx <D.Proc restore user proc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
442 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
443 bcc LinkOk |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
444 lda #E$MNF |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
445 jmp <D.Crash |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
446 LinkOk sty <D.Clock2 save entry point |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
447 InitCont ldx #PIA0Base point to PIA0 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
448 clra no error for return... |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
449 pshs cc save IRQ enable status (and Carry clear) |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
450 orcc #IntMasks stop interrupts |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
451 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
452 * Note: this code can go away once we have a rel_50hz |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
453 IFEQ TkPerSec-50 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
454 ldb <D.VIDMD get video mode register copy |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
455 orb #$08 set 50 Hz VSYNC bit |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
456 stb <D.VIDMD save video mode register copy |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
457 stb >$FF98 set 50 Hz VSYNC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
458 ENDC |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
459 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
460 sta 1,x enable DDRA |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
461 sta ,x set port A all inputs |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
462 sta 3,x enable DDRB |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
463 coma |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
464 sta 2,x set port B all outputs |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
465 ldd #$343C [A]=PIA0 CRA contents, [B]=PIA0 CRB contents |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
466 sta 1,x CA2 (MUX0) out low, port A, disable HBORD high-to-low IRQs |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
467 stb 3,x CB2 (MUX1) out low, port B, disable VBORD low-to-high IRQs |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
468 sta $23,x disable CART +RG Mar 14, 2012 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
469 lda ,x clear possible pending PIA0 HBORD IRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
470 lda 2,x clear possible pending PIA0 VBORD IRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
471 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
472 * Don't need to explicitly read RTC during initialization |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
473 ldd #59*256+TkPerTS last second and time slice in minute |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
474 std <D.Sec Will prompt RTC read at next time slice |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
475 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
476 stb <D.TSlice set ticks per time slice |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
477 stb <D.Slice set first time slice |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
478 leax SvcIRQ,pcr set IRQ handler |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
479 stx <D.IRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
480 leax SvcVIRQ,pcr set VIRQ handler |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
481 stx <D.VIRQ |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
482 leay NewSvc,pcr insert syscalls |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
483 os9 F$SSvc |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
484 * H6309 optimization opportunity here using oim |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
485 lda <D.IRQER get shadow GIME IRQ enable register |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
486 ora #$08 set VBORD bit |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
487 sta <D.IRQER save shadow register |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
488 sta >IRQEnR enable GIME VBORD IRQs |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
489 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
490 * Call Clock2 init routine |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
491 ldy <D.Clock2 get entry point to Clock2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
492 jsr ,y call init entry point of Clock2 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
493 InitRts puls cc,pc recover IRQ enable status and return |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
494 |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
495 emod |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
496 len equ * |
4036f8e844a7
Level 2 now has its own clock source again
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff
changeset
|
497 end |