annotate level2/modules/clock.asm @ 1099:b77631456f91

Change to makefile
author roug
date Wed, 09 Apr 2003 19:02:19 +0000
parents 4fa216983d96
children a3d0ac951684
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
2 * Clock - Clocks for OS-9 Level Two/NitrOS-9
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
3 *
702
0e31960c7eac Fixed incorrect comments
boisy
parents: 699
diff changeset
4 * Clock module for CoCo 3 and TC9 OS9 Level 2 and NitrOS-9
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
5 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
6 * Includes support for several different RTC chips, GIME Toggle
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
7 * IRQ fix, numerous minor changes.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
8 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
9 * Based on Microware/Tandy Clock Module for CC3/L2
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * Ed. Comments Who YY/MM/DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 * ------------------------------------------------------------------
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
15 * NitrOS-9 2.00 distribution ??/??/??
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
16 * Back-ported to OS-9 Level Two BGP 03/01/01
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
17
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
18 nam Clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
19 ttl Clocks for OS-9 Level Two/NitrOS-9
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
20
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
21 TkPerTS equ 2 ticks per time slice
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
22 GI.Toggl equ %00000001 GIME CART* IRQ enable bit, for CC3
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
23
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
24 * TC9 needs to reset more interrupt sources
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
25 *GI.Toggl equ %00000111 GIME SERINT*, KEYINT*, CART* IRQ enable bits
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
26
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
27 IFP1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
28 use defsfile
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
29 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
30
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
31 Edtn equ 9
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
32 Vrsn equ 4 NitrOS-9 version
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
33
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
34 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
35 * Setup for specific RTC chip
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
36 *
997
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
37 IFNE RTCDriveWire
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
38 RTC.Base equ $0000
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
39 ENDC
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
40
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
41 IFNE RTCElim
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
42 RTC.Sped equ $20 32.768 KHz, rate=0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
43 RTC.Strt equ $06 binary, 24 Hour, DST disabled
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
44 RTC.Stop equ $86 bit 7 set stops clock to allow setting time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
45 RTC.Base equ $FF72 I don't know base for this chip.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
46 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
47
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
48 IFNE RTCDsto2+RTCDsto4
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
49 RTC.Base equ $FF50 Base address of clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
50 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
51
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
52 IFNE RTCBB+RTCTc3
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
53 IFNE RTCBB
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
54 RTC.Base equ $FF5C In SCS* Decode
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
55 ELSE
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
56 RTC.Base equ $FF7C Fully decoded RTC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
57 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
58 RTC.Zero equ -4 Send zero bit by writing this offset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
59 RTC.One equ -3 Send one bit by writing this offset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
60 RTC.Read equ 0 Read data from this offset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
61 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
62
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
63 IFNE RTCSmart
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
64 RTC.Base equ $4004 We map the clock into this addr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
65 RTC.Zero equ -4 Send zero bit by writing this offset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
66 RTC.One equ -3 Send one bit by writing this offset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
67 RTC.Read equ 0 Read data from this offset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
68 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
70 IFNE RTCHarrs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
71 RTC.Base equ $FF60 Base address for clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
72 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
74 IFNE RTCSoft
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
75 RTC.Base equ 0 Have to have one defined.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
76 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
78 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
79 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
80 * Start of module
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
81 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
82 mod len,name,Systm+Objct,ReEnt+Vrsn,Init,RTC.Base
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
84 name fcs "Clock"
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
85 fcb Edtn
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
86
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
87 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
88 SlotSlct fcb MPI.Slot-1 Slot constant for MPI select code
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
89 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
91 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
92 * Table to set up Service Calls:
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
93 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
94 NewSvc fcb F$Time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
95 fdb F.Time-*-2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
96 fcb F$VIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
97 fdb F.VIRQ-*-2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
98 fcb F$Alarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
99 fdb F.ALARM-*-2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
100 fcb F$STime
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
101 fdb F.STime-*-2
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
103 IFNE RTCElim
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
104 fcb F$NVRAM Eliminator adds one new service call
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
105 fdb F.NVRAM-*-2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
106 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
108 fcb $80 end of service call installation table
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
110 *---------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
111 * IRQ Handling starts here.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
112 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
113 * Caveat: There may not be a stack at this point, so avoid using one.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
114 * Stack is set up by the kernel between here and SvcVIRQ.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
115 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
116 SvcIRQ lda >IRQEnR Get GIME IRQ Status and save it.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
117 ora <D.IRQS
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
118 sta <D.IRQS
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
119 bita #$08 Check for clock interrupt
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
120 beq NoClock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
121 anda #^$08 Drop clock interrupt
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
122 sta <D.IRQS
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
123 ldx <D.VIRQ Set VIRQ routine to be executed
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
124 clr <D.QIRQ ---x IS clock IRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
125 bra ContIRQ
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
127 NoClock leax DoPoll,pcr If not clock IRQ, just poll IRQ source
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
128 IFNE H6309
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
129 oim #$FF,<D.QIRQ ---x set flag to NOT clock IRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
130 ELSE
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
131 lda #$FF
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
132 sta <D.QIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
133 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
134 ContIRQ stx <D.SvcIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
135 jmp [D.XIRQ] Chain through Kernel to continue IRQ handling
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
136
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
137 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
138 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
139 * IRQ handling re-enters here on VSYNC IRQ.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
140 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
141 * - Count down VIRQ timers, mark ones that are done
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
142 * - Call DoPoll/DoToggle to service VIRQs and IRQs and reset GIME
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
143 * - Call Keyboard scan
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
144 * - Update time variables
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
145 * - At end of minute, check alarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
146 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
147 SvcVIRQ clra Flag if we find any VIRQs to service
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
148 pshs a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
149 ldy <D.CLTb Get address of VIRQ table
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
150 bra virqent
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
152 virqloop equ *
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
153 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
154 ldd 2,y Get Level 3 extended map type
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
155 orcc #IntMasks
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
156 sta >$0643
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
157 stb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
158 std >$FFA1
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
159 andcc #^IntMasks
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
160 ENDC
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
161
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
162 ldd Vi.Cnt,x Decrement tick count
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
163 IFNE H6309
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
164 decd --- subd #1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
165 ELSE
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
166 subd #$0001
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
167 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
168 bne notzero Is this one done?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
169 lda Vi.Stat,x Should we reset?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
170 bmi doreset
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
171 lbsr DelVIRQ No, delete this entry
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
172 doreset ora #$01 Mark this VIRQ as triggered.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
173 sta Vi.Stat,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
174 lda #$80 Add VIRQ as interrupt source
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
175 sta ,s
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
176 ldd Vi.Rst,x Reset from Reset count.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
177 notzero std Vi.Cnt,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
178 virqent ldx ,y++
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
179 bne virqloop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
180
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
181 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
182 puls d
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
183 orcc #Carry
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
184 stb >$0643
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
185 stb >$FFA1
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
186 incb
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
187 stb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
188 stb >$FFA1
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
189 andcc #^IntMasks
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
190 ELSE
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
191 puls a Get VIRQ status flag: high bit set if VIRQ
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
192 ENDC
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
193
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
194 ora <D.IRQS Check to see if other hardware IRQ pending.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
195 bita #%10110111 Any V/IRQ interrupts pending?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
196 beq toggle
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
197 bsr DoPoll Yes, go service them.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
198 bra KbdCheck
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
199 toggle bsr DoToggle No, toggle GIME anyway
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
200
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
201 KbdCheck equ *
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
202 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
203 lda >$0643 grab current map type
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
204 ldb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
205 pshs d save it
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
206 orcc #IntMasks IRQs off
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
207 lda >$0660 SCF local memory ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
208 sta >$0643 into DAT image ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
209 sta >$FFA1 and into RAM ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
210 inca
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
211 sta >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
212 sta >$FFA2 map in SCF, CC3IO, WindInt, etc.
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
213 ENDC
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
214
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
215 jsr [>D.AltIRQ] go update mouse, gfx cursor, keyboard, etc.
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
216
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
217 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
218 puls d restore original map type ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
219 orcc #IntMasks
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
220 sta >$0643 into system DAT image ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
221 stb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
222 std >$FFA1 and into RAM ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
223 andcc #$AF
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
224 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
226 dec <D.Tick End of second?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
227 bne VIRQend No, skip time update and alarm check
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
228 lda #TkPerSec Reset tick count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
229 sta <D.Tick
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
230
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
231 * ATD: Modified to call real time clocks on every minute ONLY.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
232 inc <D.Sec go up one second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
233 lda <D.Sec grab current second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
234 cmpa #60 End of minute?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
235 blo VIRQend No, skip time update and alarm check
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
236 clr <D.Sec Reset second count to zero
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
237
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
238 lbsr UpdTime
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
240 ldd >WGlobal+G.AlPID
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
241 ble VIRQend Quit if no Alarm set
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
242 ldd >WGlobal+G.AlPckt+3 Does Hour/Minute agree?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
243 cmpd <D.Hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
244 bne VIRQend
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
245 ldd >WGlobal+G.AlPckt+1 Does Month/Day agree?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
246 cmpd <D.Month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
247 bne VIRQend
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
248 ldb >WGlobal+G.AlPckt+0 Does Year agree?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
249 cmpb <D.Year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
250 bne VIRQend
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
251 ldd >WGlobal+G.AlPID
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
252 cmpd #1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
253 beq checkbel
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
254 os9 F$Send
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
255 bra endalarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
256 checkbel ldb <D.Sec Sound bell for 15 seconds
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
257 andb #$F0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
258 beq dobell
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
259 endalarm ldd #$FFFF
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
260 std >WGlobal+G.AlPID
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
261 bra VIRQend
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
262 dobell ldx >WGlobal+G.BelVec
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
263 beq VIRQend
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
264 jsr ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
265 VIRQend jmp [>D.Clock] Jump to kernel's timeslice routine
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
267 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
268 * Interrupt polling and GIME reset code
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
269 *
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
271 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
272 * Call [D.Poll] until all interrupts have been handled
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
273 *
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
274 Dopoll
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
275 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
276 lda >$0643 Level 3: get map type
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
277 ldb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
278 pshs d save for later
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
279 ENDC
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
280 Dopoll.i
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
281 jsr [>D.Poll] Call poll routine
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
282 bcc DoPoll.i Until error (error -> no interrupt found)
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
283
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
284 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
285 puls d
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
286 orcc #IntMasks
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
287 sta >$0643
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
288 stb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
289 std >$FFA1
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
290 andcc #^IntMasks
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
291 ENDC
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
292
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
293 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
294 * Reset GIME to avoid missed IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
295 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
296 DoToggle lda #^GI.Toggl Mask off CART* bit
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 anda <D.IRQS
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 sta <D.IRQS
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
299 lda <D.IRQER Get current enable register status
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
300 tfr a,b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
301 anda #^GI.Toggl Mask off CART* bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
302 orb #GI.Toggl --- ensure that 60Hz IRQ's are always enabled
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
303 sta >IRQEnR Disable CART
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
304 stb >IRQEnR Enable CART
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 clrb
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
306 rts
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
308 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
309 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
310 * Update time subroutines
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
311 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
312 * The subroutine UpdTime is called once per minute. On systems
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
313 * with an RTC, UpdTime reads the RTC and sets the D.Time variables.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
314 *
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
315
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
316 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
317 * Eliminator time update (lacks MPI slot select ability)
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
318 *
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
319 IFNE RTCElim
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
320 UpdTime ldx M$Mem,pcr get RTC base address from fake memory requirement
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
321 ldb #$0A UIP status register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
322 stb ,x generate address strobe
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
323 lda 1,x get UIP status
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
324 bpl NoUIP Update In Progress, go shift next RTC read
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
325 lda #TkPerSec/2 set up next RTC read attempt in 1/2 second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
326 sta <D.Tick save tick
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
327 bra UpdTExit and return
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
328
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
329 NoUIP decb year register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
330 stb ,x generate address strobe
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
331 lda 1,x get year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
332 sta <D.Year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
333 decb month register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
334 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
335 lda 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
336 sta <D.Month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
337 decb day of month register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
338 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
339 lda 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
340 sta <D.Day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
341 ldb #4 hour register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
342 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
343 lda 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
344 sta <D.Hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
345 ldb #2 minute register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
346 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
347 lda 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
348 sta <D.Min
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
349 clrb second register address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
350 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
351 lda 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
352 SaveSec sta <D.Sec
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
353 UpdTExit rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
354 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
355
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
356 *
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
357 * Disto 2-in-1 RTC time update
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
358 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
359 IFNE RTCDsto2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
360 UpdTime pshs a,cc Save old interrupt status and mask IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
361 bsr RTCPre
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
362
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
363 bsr GetVal Get Year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
364 bsr GetVal Get Month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
365 bsr GetVal Get Day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
366 decb ldb #5
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
367 stb 2,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
368 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
369 lda ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
370 anda #3
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
371 bsr GetVal1 Get Hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
372 bsr GetVal Get Minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
373 bsr GetVal Get Second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
374
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
375 RTCPost clr >$FFD9 2 MHz (Really should check $A0 first)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
376 puls cc,b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
377
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
378 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
379 stb >MPI.Slct Restore saved "currently" selected MPak slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
380 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
381
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
382 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
383 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
384
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
385 RTCPre orcc #IntMasks
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
386
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
387 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
388 ldb >MPI.Slct Save currently selected MPak slot on stack
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
389 stb 3,s
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
390 andb #$F0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
391 orb >SlotSlct,pcr Get slot to select
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
392 stb >MPI.Slct Select MPak slot for clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
393 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
394
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
395 ldy #D.Time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
396 ldx M$Mem,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
397 clr 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
398 ldb #12
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
399 clr >$FFD8 1 MHz
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
400 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
401
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
402 GetVal stb 2,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
403 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
404 lda ,x read tens digit from clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
405 anda #$0f
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
406 GetVal1 pshs b save b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
407 ldb #10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
408 mul multiply by 10 to get value
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
409 stb ,y save 10s value
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
410 puls b set up clock for ones digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
411 stb 2,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
412 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
413 lda ,x read ones digit from clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
414 anda #$0f
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
415 adda ,y add ones + tens
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
416 sta ,y+ store clock value into time packet
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
417 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
418
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
419 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
420
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
421 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
422 * Disto 4-in-1 RTC time update
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
423 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
424 IFNE RTCDsto4
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
425 UpdTime equ *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
426 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
427 pshs cc Save old interrupt status and mask IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
428 orcc #IntMasks
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
429 ldb >MPI.Slct Save currently selected MPak slot on stack
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
430 pshs b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
431 andb #$F0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
432 orb >SlotSlct,pcr Select MPak slot for clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
433 stb >MPI.Slct
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
434 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
435
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
436 ldx M$Mem,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
437 ldy #D.Time Start with seconds
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
438
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
439 ldb #11
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
440 bsr GetVal Get Year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
441 bsr GetVal Get Month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
442 bsr GetVal Get Day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
443 lda #3 Mask tens digit of hour to remove AM/PM bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
444 bsr GetVal1 Get Hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
445 bsr GetVal Get Minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
446 bsr GetVal Get Second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
447
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
448 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
449 puls b Restore saved "currently" selected MPak slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
450 stb >MPI.Slct
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
451 puls cc,pc Restore previous IRQ status
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
452 ELSE
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
453 rts No MPI, don't need to mess with slot, CC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
454 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
455
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
456 GetVal lda #$0f Mask to apply to tens digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
457 GetVal1 stb 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
458 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
459 anda ,x read ones digit from clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
460 pshs b save b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
461 ldb #10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
462 mul multiply by 10 to get value
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
463 stb ,y Add to ones digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
464 puls b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
465 stb 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
466 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
467 lda ,x read tens digit from clock and mask it
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
468 anda #$0f
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
469 adda ,y
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
470 sta ,y+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
471 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
472
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
473 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
474
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
475
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
476 *
997
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
477 * Update time from DriveWire
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
478 *
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
479 IFNE RTCDriveWire
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
480
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
481 use bbwrite.asm
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
482
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
483 UpdTime pshs y,x,cc
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
484 lda #'# Time packet
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
485 orcc #IntMasks Disable interrupts
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
486 lbsr SerWrite
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
487 bsr SerRead Read year byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
488 bcs UpdLeave
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
489 sta <D.Year
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
490 bsr SerRead Read month byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
491 bcs UpdLeave
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
492 sta <D.Month
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
493 bsr SerRead Read day byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
494 bcs UpdLeave
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
495 sta <D.Day
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
496 bsr SerRead Read hour byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
497 bcs UpdLeave
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
498 sta <D.Hour
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
499 bsr SerRead Read minute byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
500 bcs UpdLeave
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
501 sta <D.Min
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
502 bsr SerRead Read second byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
503 bcs UpdLeave
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
504 sta <D.Sec
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
505 bsr SerRead Read day of week (0-6) byte
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
506 UpdLeave puls cc,x,y,pc
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
507
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
508 use bbread.asm
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
509
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
510 ENDC
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
511
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
512 *
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
513 * Update time from B&B RTC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
514 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
515 IFNE RTCBB+RTCTc3
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
516 UpdTime pshs u,y,cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
517 leay ReadBCD,pcr Read bytes of clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
518
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
519 TfrTime orcc #IntMasks turn off interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
520 ldu M$Mem,pcr Get base address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
521
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
522 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
523 ldb >MPI.Slct Select slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
524 pshs b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
525 andb #$F0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
526 orb SlotSlct,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
527 stb >MPI.Slct
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
528 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
529
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
530 lbsr SendMsg Initialize clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
531 ldx #D.Sec
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
532 ldb #8 Tfr 8 bytes
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
533
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
534 tfrloop jsr ,y Tfr 1 byte
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
535
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
536 bitb #$03
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
537 beq skipstuf Skip over day-of-week, etc.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
538 leax -1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
539 skipstuf decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
540 bne tfrloop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
541
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
542 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
543 puls b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
544 stb >MPI.Slct restore MPAK slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
545 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
546
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
547 puls u,y,cc,pc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
548
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
549 ClkMsg fcb $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
550 * Enable clock with message $C53AA35CC53AA35C
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
551 SendMsg lda RTC.Read,u Send Initialization message to clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
552 leax <ClkMsg,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
553 ldb #8
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
554 msgloop lda ,x+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
555 bsr SendByte
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
556 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
557 bne msgloop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
558 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
559
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
560 SendBCD pshs b Send byte to clock, first converting to BCD
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
561 bitb #$03
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
562 bne BCDskip Send zero for day-of-week, etc.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
563 lda #0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
564 bra SndBCDGo
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
565 BCDskip lda ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
566 SndBCDGo tfr a,b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
567 bra binenter
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
568 binloop adda #6
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
569 binenter subb #10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
570 bhs binloop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
571 puls b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
572 SendByte coma Send one byte to clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
573 rora
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
574 bcc sendone
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
575 sendzero tst RTC.Zero,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
576 lsra
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
577 bcc sendone
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
578 bne sendzero
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
579 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
580 sendone tst RTC.One,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
581 lsra
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
582 bcc sendone
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
583 bne sendzero
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
584 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
585
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
586
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
587 ReadBCD pshs b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
588 ldb #$80 High bit will rotate out after we read 8 bits
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
589 readbit lda RTC.Read,u Read a bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
590 lsra
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
591 rorb Shift it into B
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
592 bcc readbit Stop when marker bit appears
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
593 tfr b,a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
594 bra BCDEnter Convert BCD number to Binary
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
595 BCDLoop subb #6 by subtracting 6 for each $10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
596 BCDEnter suba #$10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
597 bhs BCDLoop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
598 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
599 puls b,pc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
600
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
601 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
602
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
603
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
604 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
605 * Update time from Smartwatch RTC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
606 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
607 IFNE RTCSmart
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
608 UpdTime pshs cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
609 orcc #IntMasks Disable interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
610 lda >MPI.Slct Get MPI slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
611 ldb <$90 Get GIME shadow of $FF90
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
612 pshs b,a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
613 anda #$F0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
614 ora >SlotSlct,pcr Get new slot to select
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
615 anda #$03 *** TEST ***
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
616 sta >MPI.Slct And select it
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
617 andb #$FC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
618 stb >$FF90 ROM mapping = 16k internal, 16k external
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
619 ldb >$FFA2 Read GIME for $4000-$5fff
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
620 pshs b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
621 lda #$3E
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
622 sta >$FFA2 Put block $3E at $4000-$5fff
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
623 clr >$FFDE Map RAM/ROM, to map in external ROM
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
624 lbsr SendMsg Initialize clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
625 ldx #D.Sec Start with seconds
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
626 lda #$08
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
627 sta ,-s Set up loop counter = 8
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
628 L021E ldb #$08
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
629 L0220 lda >RTC.Read+RTC.Base Read one bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
630 lsra
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
631 ror ,x Put bit into time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
632 decb End of bit loop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
633 bne L0220
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
634 lda ,s Check loop counter
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
635 cmpa #$08
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
636 beq L023D Fill "seconds" twice (ignore 1st value)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
637 cmpa #$04
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
638 bne L0239
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
639 ldb ,x Save 4th value read at $34 (day of week?)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
640 stb $0A,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
641 bra L023D And overwrite "day" with day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
642 L0239 leax -$01,x Go to next time to read
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
643 bsr BCD2Dec Convert 1,x from BCD to decimal
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
644 L023D dec ,s
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
645 bne L021E End of loop for reading time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
646 leas $01,s Done with loop counter
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
647 clr >$FFDF Map all RAM
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
648 puls b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
649 stb >$FFA2 Put back original memory block
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
650 puls b,a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
651 sta >MPI.Slct
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
652 stb >$FF90 Restore original ROM mapping
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
653 puls cc,pc Re-enable interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
654
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
655 * Convert BCD to a normal number
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
656
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
657 BCD2Dec lda $01,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
658 clrb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
659 B2DLoop cmpa #$10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
660 bcs B2DDone
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
661 suba #$10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
662 addb #$0A
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
663 bra B2DLoop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
664 B2DDone pshs a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
665 addb ,s+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
666 stb $01,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
667 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
668
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
669 ClkMsg fcb $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
670
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
671 * Send above "string" to smartwatch, one bit at a time
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
672
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
673 SendMsg leax <ClkMsg,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
674 lda >RTC.Read+RTC.Base Tell clock we're going to start???
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
675 lda #$08
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
676 sta ,-s Store counter = 8
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
677 L006B ldb #$08 Start of outer loop, 8 bytes to send
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
678 lda ,x+ Get byte to send
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
679 L006F lsra Start of inner loop, 8 bits to send
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
680 bcs L0077
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
681 tst >RTC.Zero+RTC.Base Send a "zero" bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
682 bra L007A
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
683 L0077 tst >RTC.One+RTC.Base Send a "one" bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
684 L007A decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
685 bne L006F End of inner loop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
686 dec ,s End of outer loop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
687 bne L006B
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
688 puls pc,a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
689
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
690 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
691
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
692 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
693 * Update time from Harris RTC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
694 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
695 IFNE RTCHarrs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
696 UpdTime pshs cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
697 orcc #IntMasks Disable interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
698
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
699 ldu M$Mem,pcr Get base address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
700 ldy #D.Time Pointer to time in system map
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
701
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
702 lda #%00001100 Init command register (Normal,Int. Disabled,
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
703 sta $11,u Run,24-hour mode, 32kHz)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
704
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
705 lda ,u Read base address to set-up clock regs for read
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
706 lda 6,u Get year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
707 sta ,y+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
708 lda 4,u Get month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
709 sta ,y+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
710 lda 5,u Get day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
711 sta ,y+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
712 lda 1,u Get hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
713 sta ,y+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
714 lda 2,u Get minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
715 sta ,y+
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
716 lda 3,u Get second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
717 sta ,y+
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
718
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
719 puls cc,pc Re-enable interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
720 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
721 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
722 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
723 * Software time update
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
724 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
725 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
726
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
727 IFNE RTCSoft
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
728 UpdTime lda <D.Min grab current minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
729 inca minute+1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
730 cmpa #60 End of hour?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
731 blo UpdMin no, Set start of minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
732 ldd <D.Day get day, hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
733 incb hour+1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
734 cmpb #24 End of Day?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
735 blo UpdHour ..no
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
736 inca day+1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
737 leax months-1,pcr point to months table with offset-1: Jan = +1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
738 ldb <D.Month this month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
739 cmpa b,x end of month?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
740 bls UpdDay ..no, update the day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
741 cmpb #2 yes, is it Feb?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
742 bne NoLeap ..no, ok
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
743 ldb <D.Year else get year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
744 andb #$03 check for leap year: good until 2099
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
745 cmpd #$1D00 29th on leap year?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
746 beq UpdDay ..yes, skip it
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
747 NoLeap ldd <D.Year else month+1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
748 incb month+1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
749 cmpb #13 end of year?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
750 blo UpdMonth ..no
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
751 inca year+1
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
752 ldb #$01 set month to jan
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
753 UpdMonth std <D.Year save year, month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
754 lda #$01 day=1st
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
755 UpdDay clrb hour=midnite
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
756 UpdHour std <D.Day save day,hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
757 clra minute=00
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
758 UpdMin clrb seconds=00
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
759 std <D.Min save min,secs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
760 UpdTExit rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
761 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
762
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
763 months fcb 31,28,31,30,31,30,31,31,30,31,30,31 Days in each month
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
764
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
765
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
766 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
767 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
768 * Handle F$VIRQ system call
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
769 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
770 F.VIRQ pshs cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
771 orcc #IntMasks Disable interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
772 ldy <D.CLTb Address of VIRQ table
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
773 ldx <D.Init Address of INIT
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
774 ldb PollCnt,x Number of polling table entries from INIT
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
775 ldx R$X,u Zero means delete entry
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
776 beq RemVIRQ
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
777 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
778 bra FindVIRQ ---x
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
779
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
780 v.loop leay 4,y ---x
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
781 ENDC
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
782 FindVIRQ ldx ,y++ Is VIRQ entry null?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
783 beq AddVIRQ If yes, add entry here
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
784 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
785 bne FindVIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
786 puls cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
787 comb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
788 ldb #E$Poll
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
789 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
790
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
791 AddVIRQ
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
792 IFGT Level-2
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
793 ldx R$Y,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
794 stx ,y
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
795 lda >$0643
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
796 ldb >$0645
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
797 std 2,y
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
798 ELSE
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
799 leay -2,y point to first null VIRQ entry
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
800 ldx R$Y,u
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
801 stx ,y
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
802 ENDC
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
803 ldy R$D,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
804 sty ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
805 bra virqexit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
806
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
807 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
808 v.chk leay 4,y
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
809 RemVIRQ ldx ,y
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
810 ELSE
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
811 RemVIRQ ldx ,y++
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
812 ENDC
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
813 beq virqexit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
814 cmpx R$Y,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
815 bne RemVIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
816 bsr DelVIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
817 virqexit puls cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
818 clrb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
819 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
820
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
821 DelVIRQ pshs x,y
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
822 DelVLup
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
823 IFGT Level-2
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
824 ldq ,y++ move entries up in table
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
825 leay 2,y
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
826 stq -8,y
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
827 bne DelVLup
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
828 puls x,y,pc
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
829 ELSE
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
830 ldx ,y++ move entries up in table
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
831 stx -4,y
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
832 bne DelVLup
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
833 puls x,y
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
834 leay -2,y
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
835 rts
1048
4fa216983d96 Added Level 3 code, needs testing in that environment
boisy
parents: 997
diff changeset
836 ENDC
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
837
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
838 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
839 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
840 * Handle F$Alarm call
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
841 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
842 F.Alarm ldx #WGlobal+G.AlPckt
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
843 ldd R$D,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
844 bne DoAlarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
845 std G.AlPID-G.AlPckt,x Erase F$Alarm PID, Signal.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
846 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
847
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
848 DoAlarm tsta If PID != 0, set alarm for this process
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
849 bne SetAlarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
850 cmpd #1 1 -> Set system-wide alarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
851 bne GetAlarm
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
852 SetAlarm std G.AlPID-G.AlPckt,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
853 ldy <D.Proc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
854 lda P$Task,y Move from process task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
855 ldb <D.SysTsk To system task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
856 ldx R$X,u From address given in X
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
857 ldu #WGlobal+G.AlPckt
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
858 ldy #5 Move 5 bytes
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
859 bra FMove
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
860
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
861 GetAlarm cmpd #2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
862 bne AlarmErr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
863 ldd G.AlPID-G.AlPckt,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
864 std R$D,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
865 bra RetTime
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
866 AlarmErr comb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
867 ldb #E$IllArg
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
868 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
869
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
870 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
871 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
872 * Handle F$Time System call
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
873 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
874 F.Time ldx #D.Time Address of system time packet
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
875 RetTime ldy <D.Proc Get pointer to current proc descriptor
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
876 ldb P$Task,y Process Task number
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
877 lda <D.SysTsk From System Task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
878 ldu R$X,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
879 STime.Mv ldy #6 Move 6 bytes
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
880 FMove os9 F$Move
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
881 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
882
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
883 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
884 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
885 * Handle F$STime system call
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
886 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
887 * First, copy time packet from user address space to system time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
888 * variables, then fall through to code to update RTC.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
889 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
890 F.STime ldx <D.Proc Caller's process descriptor
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
891 lda P$Task,x Source is in user map
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
892 ldx R$X,u Address of caller's time packet
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
893 ldu #D.Time Destination address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
894 ldb <D.SysTsk Destination is in system map
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
895 bsr STime.Mv Get time packet (ignore errors)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
896 lda #TkPerSec Reset to start of second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
897 sta <D.Tick
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
898
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
899 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
900 * No RTC, just end (Also for SmartWatch, temporarily)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
901 *
997
2115299c9612 Added DriveWire support
boisy
parents: 702
diff changeset
902 IFNE RTCSoft+RTCSmart+RTCDriveWire
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
903 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
904 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
905
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
906 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
907 * Set Eliminator RTC from D.Time
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
908 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
909 IFNE RTCElim
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
910 pshs cc save interrupt status
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
911 orcc #IntMasks disable IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
912 ldx M$Mem,pcr get RTC base address from fake memory requirement
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
913 ldy #D.Time point [Y] to time variables in DP
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
914 ldd #$0B*256+RTC.Stop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
915 bsr UpdatCk0 stop clock before setting it
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
916 ldb #RTC.Sped
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
917 bsr UpdatCk0 set crystal speed, output rate
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
918 bsr UpdatClk go set year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
919 bsr UpdatClk go set month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
920 bsr UpdatClk go set day of month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
921 bsr UpdatCk0 go set day of week (value doesn't matter)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
922 bsr UpdatCk0 go set hours alarm (value doesn't matter)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
923 bsr UpdatClk go set hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
924 bsr UpdatCk0 go set minutes alarm (value doesn't matter)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
925 bsr UpdatClk go set minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
926 bsr UpdatCk0 go set seconds alarm (value doesn't matter)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
927 bsr UpdatClk go set second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
928 ldd #$0B*256+RTC.Strt
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
929 bsr UpdatCk0 go start clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
930 puls cc Recover IRQ status
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
931 clrb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
932 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
933
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
934 UpdatClk ldb ,y+ get data from D.Time variables in DP
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
935 UpdatCk0 std ,x generate address strobe, save data
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
936 deca set [A] to next register down
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
937 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
938 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
939
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
940 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
941 * Set Disto 2-in-1 RTC from Time variables
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
942 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
943 IFNE RTCDsto2
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
944 pshs a,cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
945 lbsr RTCPre Initialize
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
946
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
947 bsr SetVal Set Year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
948 bsr SetVal Set Month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
949 bsr SetVal Set Day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
950 ldd #$0805 $08 in A, $05 in B
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
951 bsr SetVal1 Set Hour (OR value in A ($08) with hour)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
952 bsr SetVal Set Minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
953 bsr SetVal Set Second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
954
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
955 lbra RTCPost Clean up + return
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
956
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
957 SetVal clra
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
958 SetVal1 stb 2,x Set Clock address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
959 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
960 pshs b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
961 ldb ,y+ Get current value
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
962 DvLoop subb #10 Get Tens digit in A, ones digit in B
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
963 bcs DvDone
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
964 inca
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
965 bra DvLoop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
966 DvDone addb #10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
967 sta ,x Store tens digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
968 tfr b,a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
969 puls b Get back original clock address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
970 stb 2,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
971 decb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
972 sta ,x Store ones digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
973 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
974 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
975
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
976 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
977 * Set Disto 4-in-1 RTC from Time variables
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
978 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
979 IFNE RTCDsto4
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
980 pshs cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
981 orcc #IntMasks
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
982
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
983 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
984 ldb >MPI.Slct Save currently selected MPak slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
985 pshs b
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
986 andb #$F0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
987 orb >SlotSlct,pcr Get slot to select
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
988 stb >MPI.Slct Select MPak slot for clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
989 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
990
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
991 ldy #D.Time+6
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
992 ldx M$Mem,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
993 clrb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
994 bsr SetVal Set Second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
995 bsr SetVal Set Minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
996 bsr SetVal Set Hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
997 bsr SetVal Set Day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
998 bsr SetVal Set Month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
999 bsr SetVal Set Year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1000
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1001 IFNE MPIFlag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1002 puls b Restore old MPAK slot
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1003 stb >MPI.Slct
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1004 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1005
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1006 puls cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1007 clrb No error
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1008 rts
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1009
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1010 SetVal clr ,-s Create variable for tens digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1011 lda ,-y Get current value
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1012 DvLoop suba #10 Get Tens digit on stack, ones digit in A
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1013 bcs DvDone
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1014 inc ,s
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1015 bra DvLoop
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1016 DvDone adda #10
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1017 stb 1,x Set Clock address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1018 incb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1019 sta ,x Store ones digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1020 stb 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1021 incb
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1022 puls a
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1023 sta ,x Store tens digit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1024 rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1025 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1026
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1027 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1028 * Set B&B RTC from Time variables
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1029 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1030 IFNE RTCBB+RTCTc3
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1031 pshs u,y,cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1032 leay SendBCD,pcr Send bytes of clock
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1033 lbra TfrTime
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1034 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1035
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1036 *------------------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1037 * read/write RTC Non Volatile RAM (NVRAM)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1038 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1039 * INPUT: [U] = pointer to caller's register stack
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1040 * R$A = access mode (1 = read, 2 = write, other = error)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1041 * R$B = byte count (1 through 50 here, but in other implementations
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1042 * may be 1 through 256 where 0 implies 256)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1043 * R$X = address of buffer in user map
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1044 * R$Y = start address in NVRAM
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1045 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1046 * OUTPUT: RTC NVRAM read/written
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1047 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1048 * ERROR OUTPUT: [CC] = Carry set
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1049 * [B] = error code
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1050 IFNE RTCElim
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1051 F.NVRAM tfr u,y copy caller's register stack pointer
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1052 ldd #$0100 ask for one page
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1053 os9 F$SRqMem
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1054 bcs NVR.Exit go report error...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1055 pshs y,u save caller's stack and data buffer pointers
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1056 ldx R$Y,y get NVRAM start address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1057 cmpx #50 too high?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1058 bhs Arg.Err yes, go return error...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1059 ldb R$B,y get NVRAM byte count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1060 beq Arg.Err
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1061 abx check end address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1062 cmpx #50 too high?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1063 bhi Arg.Err yes, go return error...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1064 lda R$A,y get direction flag
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1065 cmpa #WRITE. put caller's data into NVRAM?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1066 bne ChkRead no, go check if read...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1067 clra [D]=byte count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1068 pshs d save it...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1069 ldx <D.Proc get caller's process descriptor address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1070 lda P$Task,x caller is source task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1071 ldb <D.SysTsk system is destination task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1072 ldx R$X,y get caller's source pointer
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1073 puls y recover byte count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1074 os9 F$Move go MOVE data
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1075 bcs NVR.Err
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1076 ldy ,s get caller's register stack pointer from stack
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1077 lda R$Y+1,y get NVRAM start address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1078 adda #$0E add offset to first RTC NVRAM address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1079 ldb R$B,y get byte count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1080 ldx M$Mem,pcr get clock base address from fake memory requirement
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1081 pshs cc,b save IRQ enable status and byte counter
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1082 orcc #IntMasks disable IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1083 WrNVR.Lp ldb ,u+ get caller's data
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1084 std ,x generate RTC address strobe and save data to NVRAM
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1085 inca next NVRAM address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1086 dec 1,s done yet?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1087 bne WrNVR.Lp no, go save another byte
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1088 puls cc,b recover IRQ enable status and clean up stack
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1089 NVR.RtM puls y,u recover register stack & data buffer pointers
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1090 ldd #$0100 return one page
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1091 os9 F$SRtMem
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1092 NVR.Exit rts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1093
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1094 Arg.Err ldb #E$IllArg Illegal Argument error
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1095 bra NVR.Err
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1096
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1097 ChkRead cmpa #READ. return NVRAM data to caller?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1098 bne Arg.Err illegal access mode, go return error...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1099 lda R$Y+1,y get NVRAM start address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1100 adda #$0E add offset to first RTC NVRAM address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1101 ldx M$Mem,pcr get clock base address from fake memory requirement
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1102 pshs cc,b save IRQ enable status and byte counter
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1103 orcc #IntMasks disable IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1104 RdNVR.Lp sta ,x generate RTC address strobe
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1105 ldb 1,x get NVRAM data
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1106 stb ,u+ save it to buffer
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1107 inca next NVRAM address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1108 dec 1,s done yet?
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1109 bne RdNVR.Lp no, go get another byte
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1110 puls cc,a recover IRQ enable status, clean up stack ([A]=0)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1111 ldb R$B,y [D]=byte count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1112 pshs d save it...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1113 ldx <D.Proc get caller's process descriptor address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1114 ldb P$Task,x caller is source task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1115 lda <D.SysTsk system is destination task
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1116 ldu R$X,y get caller's source pointer
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1117 puls y recover byte count
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1118 ldx 2,s get data buffer (source) pointer
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1119 os9 F$Move go MOVE data
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1120 bcc NVR.RtM
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1121 NVR.Err puls y,u recover caller's stack and data pointers
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1122 pshs b save error code
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1123 ldd #$0100 return one page
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1124 os9 F$SRtMem
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1125 comb set Carry for error
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1126 puls b,pc recover error code, return...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1127 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1128 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1129 * Set Harris 1770 RTC from Time variables
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1130 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1131 IFNE RTCHarrs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1132 pshs cc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1133 orcc #IntMasks Disable interrupts
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1134
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1135 ldu M$Mem,pcr Get base address
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1136 ldy #D.Time Pointer to time in system map
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1137
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1138 lda #%00000100 Init command register (Normal,Int. Disabled,
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1139 sta $11,u STOP clock,24-hour mode, 32kHz)
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1140
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1141 lda ,y+ Get year
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1142 sta 6,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1143 lda ,y+ Get month
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1144 sta 4,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1145 lda ,y+ Get day
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1146 sta 5,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1147 lda ,y+ Get hour
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1148 sta 1,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1149 lda ,y+ Get minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1150 sta 2,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1151 lda ,y Get second
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1152 sta 3,u
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1153
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1154 lda #%00001100 Init command register (Normal,Int. Disabled,
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1155 sta $11,u START clock,24-hour mode, 32kHz)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1156
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1157 puls cc,pc Re-enable interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1158 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1159
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1160 *--------------------------------------------------
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1161 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1162 * Clock Initialization
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1163 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1164 * This vector is called by the kernel to service the first F$STime
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1165 * call. F$STime is usually called by CC3Go (with a dummy argument)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1166 * in order to initialize the clock. F$STime is re-vectored to the
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1167 * service code above to handle future F$STime calls.
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1168 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1169 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1170 Init ldx #PIA0Base point to PIA0
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1171 clra no error for return...
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1172 pshs cc save IRQ enable status (and Carry clear)
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1173 orcc #IntMasks stop interrupts
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1174
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1175 IFEQ TkPerSec-50
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1176 ldb <D.VIDMD get video mode register copy
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1177 orb #$08 set 50 Hz VSYNC bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1178 stb <D.VIDMD save video mode register copy
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1179 stb >$FF98 set 50 Hz VSYNC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1180 ENDC
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1181
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1182 sta 1,x enable DDRA
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1183 sta ,x set port A all inputs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1184 sta 3,x enable DDRB
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1185 coma
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1186 sta 2,x set port B all outputs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1187 ldd #$343C [A]=PIA0 CRA contents, [B]=PIA0 CRB contents
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1188 sta 1,x CA2 (MUX0) out low, port A, disable HBORD high-to-low IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1189 stb 3,x CB2 (MUX1) out low, port B, disable VBORD low-to-high IRQs
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1190 lda ,x clear possible pending PIA0 HBORD IRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1191 lda 2,x clear possible pending PIA0 VBORD IRQ
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1192
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1193 * Don't need to explicitly read RTC during initialization
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1194 ldd #59*256+TkPerTS last second and time slice in minute
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1195 std <D.Sec Will prompt RTC read at next time slice
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1196
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1197 stb <D.TSlice set ticks per time slice
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1198 stb <D.Slice set first time slice
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1199 leax SvcIRQ,pcr set IRQ handler
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1200 stx <D.IRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1201 leax SvcVIRQ,pcr set VIRQ handler
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1202 stx <D.VIRQ
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1203 leay NewSvc,pcr insert syscalls
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1204 os9 F$SSvc
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1205 lda <D.IRQER get shadow GIME IRQ enable register
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1206 ora #$08 set VBORD bit
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1207 sta <D.IRQER save shadow register
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1208 sta >IRQEnR enable GIME VBORD IRQs
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1209
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1210 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1211 * RTC-specific initializations here
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1212 *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1213 IFNE RTCDsto4
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1214 ldx M$Mem,pcr
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1215 ldd #$010F Set mode for RTC chip
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1216 stb 1,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1217 sta ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1218 ldd #$0504
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1219 sta ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1220 stb ,x
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1221 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1222
699
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1223 puls cc,pc recover IRQ enable status and return
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1224
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1225 emod
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1226 len equ *
3a6527ccdb74 clock from NitrOS-9 is now integrated... no lonnger do we have split clocks
boisy
parents: 67
diff changeset
1227 end