annotate level1/modules/clock.asm @ 641:767a608364b2

Some extra comments to the Makefile
author roug
date Sun, 08 Dec 2002 11:13:21 +0000
parents 4f81e616d397
children da4002e207e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * Clock - OS-9 Level One V2 Clock module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * NOTE: This clock is TOTALLY VALID for ALL DATES between 1900-2155
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * Ed. Comments Who YY/MM/DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 * ------------------------------------------------------------------
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
10 * 5 Tandy/Microware original version
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
11 * 6 Modified to handle leap years properly for BGP 99/05/03
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * 1900 and 2100 A.D.
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
13 * Added TC^3 SCSI/B&B RTC Clock Support BGP 02/05/14
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 nam Clock
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 ttl OS-9 Level One V2 Clock module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
18 IFP1
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 use defsfile
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
20 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 tylg set Systm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 atrv set ReEnt+rev
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
24 rev set $1
201
668388823050 Fixed headers to be consistent
boisy
parents: 87
diff changeset
25 edition set 6
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
27 mod eom,name,tylg,atrv,ClkEnt,RTC.Base
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31 name fcs /Clock/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
34 * If no RTC defines are set, then this is a software clock
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
35 IFEQ RTCBB+RTCTC3
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
36 SOFT set 1
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
37 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
38
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
39 IFNE RTCBB
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
40 MPIFlag set 1
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
41 SlotSlct set $22
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
42 RTC.Base equ $FF5C
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
43 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
44 IFNE RTCTC3
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
45 RTC.Base equ $FF7C
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
46 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
47 IFNE SOFT
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
48 RTC.Base equ size
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
49 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
50
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
51 IFNE RTCBB+RTCTC3
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
52 RTC.Zero equ -4 Send zero bit by writing this offset
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
53 RTC.One equ -3 Send one bit by writing this offset
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
54 RTC.Read equ 0 Read data from this offset
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
55 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
56
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 SysTbl fcb F$Time
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 fdb FTime-*-2
87
39ea0a63ce31 F$VIRQ in place of Unknown label
boisy
parents: 62
diff changeset
59 fcb F$VIRQ
39ea0a63ce31 F$VIRQ in place of Unknown label
boisy
parents: 62
diff changeset
60 fdb FVIRQ-*-2
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
61
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
62 IFEQ SOFT
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
63
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
64 fcb F$STime
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
65 fdb FSTime-*-2
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
66
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
67 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
68
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 fcb $80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
71 IFNE SOFT
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 * table of days of the month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 MonthChk fcb 00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 fcb 31 January
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 fcb 28 February
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 fcb 31 March
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 fcb 30 April
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 fcb 31 May
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 fcb 30 June
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 fcb 31 July
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 fcb 31 August
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 fcb 30 September
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 fcb 31 October
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 fcb 30 November
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 fcb 31 December
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
87 ELSE
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
88
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
89 FSTime ldx R$X,u
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
90 ldd ,x
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
91 std <D.Year
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
92 ldd 2,x
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
93 std <D.Day
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
94 ldd 4,x
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
95 std <D.Min
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
96 andcc #^Carry
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
97 pshs u,y,cc
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
98
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
99 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
100
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
101 IFNE RTCBB+RTCTC3
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
102
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
103 leay SendBCD,pcr Send bytes of clock
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
104 lbra TfrTime
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
105 *
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
106 * Update time from B&B/TC3 RTC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
107 *
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
108 UpdTime pshs u,y,cc
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
109 leay ReadBCD,pcr Read bytes of clock
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
110
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
111 TfrTime orcc #IntMasks turn off interrupts
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
112 ldu M$Mem,pcr Get base address
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
113
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
114 IFNE MPIFlag
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
115 ldb >MPI.Slct Select slot
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
116 pshs b
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
117 andb #$F0
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
118 orb SlotSlct,pcr
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
119 stb >MPI.Slct
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
120 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
121
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
122 lbsr SendMsg Initialize clock
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
123 ldx #D.Sec
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
124 ldb #8 Tfr 8 bytes
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
125
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
126 tfrloop jsr ,y Tfr 1 byte
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
127 bitb #$03
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
128 beq skipstuf Skip over day-of-week, etc.
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
129 leax -1,x
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
130 skipstuf decb
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
131 bne tfrloop
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
132
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
133 IFNE MPIFlag
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
134 puls b
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
135 stb >MPI.Slct restore MPAK slot
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
136 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
137
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
138 puls u,y,cc,pc
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
139
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
140 ClkMsg fcb $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
141 * Enable clock with message $C53AA35CC53AA35C
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
142 SendMsg lda RTC.Read,u Send Initialization message to clock
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
143 leax <ClkMsg,pcr
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
144 ldb #8
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
145 msgloop lda ,x+
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
146 bsr SendByte
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
147 decb
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
148 bne msgloop
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
149 rts
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
150
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
151 SendBCD pshs b Send byte to clock, first converting to BCD
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
152 bitb #$03
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
153 bne BCDskip Send zero for day-of-week, etc.
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
154 lda #0
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
155 bra SndBCDGo
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
156 BCDskip lda ,x
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
157 SndBCDGo tfr a,b
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
158 bra binenter
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
159 binloop adda #6
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
160 binenter subb #10
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
161 bhs binloop
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
162 puls b
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
163 SendByte coma Send one byte to clock
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
164 rora
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
165 bcc sendone
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
166 sendzero tst RTC.Zero,u
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
167 lsra
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
168 bcc sendone
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
169 bne sendzero
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
170 rts
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
171 sendone tst RTC.One,u
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
172 lsra
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
173 bcc sendone
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
174 bne sendzero
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
175 rts
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
176
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
177 ReadBCD pshs b
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
178 ldb #$80 High bit will rotate out after we read 8 bits
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
179 readbit lda RTC.Read,u Read a bit
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
180 lsra
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
181 rorb Shift it into B
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
182 bcc readbit Stop when marker bit appears
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
183 tfr b,a
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
184 bra BCDEnter Convert BCD number to Binary
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
185 BCDLoop subb #6 by subtracting 6 for each $10
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
186 BCDEnter suba #$10
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
187 bhs BCDLoop
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
188 stb ,x
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
189 puls b,pc
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
190 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
191
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 ClockIRQ clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 tfr a,dp set direct page to zero
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
194 lda PIA.U4+3 get hw byte
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 bmi L0032 branch if sync flag on
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 jmp [>D.SvcIRQ]
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
197 L0032 lda PIA.U4+2 clear interrupt?
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 dec <D.Tick decrement tick counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 bne L007F go around if not zero
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 ldd <D.Min get minutes/seconds
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 * Seconds increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 incb increment seconds
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 cmpb #60 full minute?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 bcs L0079 nope...
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
205
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
206 IFNE RTCBB+RTCTC3
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
207
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
208 lbsr UpdTime
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
209 bra L007B
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
210
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
211 ELSE
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
212
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 * Minutes increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 inca else increment minute
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 cmpa #60 full hour?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 bcs L0078 nope...
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
217 ldd <D.Day else increment day
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 * Hour increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 incb increment hour
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 cmpb #24 past 23rd hour?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 bcs L0075 branch if not
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 * Day increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 inca else increment day
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 leax >MonthChk,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 ldb <D.Month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 * cmpb #3 is this February?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 * bne L005F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 * ldb <D.Year check year
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 * beq L005F if century, it's a leap year
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 * andb #$03 leap year? (divisible by 4)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 * beq L0060 nope
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 *L005F inca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 *L0060 ldb <D.Month get month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 cmpa b,x compare days to max days
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 bls L0074 branch if ok
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 cmpb #2 is this February?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 bne L006X if not, go on to year/month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 * Leap year cases checked here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 ldb <D.Year else check for leap year cases
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 beq L006X branch if year 1900
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 cmpb #200 is it 1900+200 (2100)?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 beq L006X if so, branch
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 andb #$03 see if 2^4 bit set (leap year)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 cmpd #$1D00 29th on leap year?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 beq L0074 it's a leap year...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 L006X ldd <D.Year else get year and month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 * Month increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 incb increment month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 cmpb #13 past December?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 bcs L0070 branch if not
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 * Year increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 inca else in year
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 ldb #1 and start month in January
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 L0070 std <D.Year update year/month
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 lda #1 new month, first day
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 L0074 clrb hour 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 L0075 std <D.Day update day/hour
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 clra 0 minutes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 L0078 clrb 0 seconds
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
260
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
261 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
262
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 L0079 std <D.Min update min/sec
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
264 L007B lda <D.TSec
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 sta <D.Tick
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 L007F clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 ldy <D.CLTB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 bra L009E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 L0087 ldd ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 subd #$0001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 bne L009C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 lda #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 sta ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 lda $04,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 beq L00B8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 L0096 ora #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 sta $04,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
279 ldd $02,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280 L009C std ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 L009E ldx ,y++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
282 bne L0087
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 lda ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 beq L00B4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
285 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
286 beq L00AE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 tst P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 bpl L00BC branch if sysstate not set
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 L00AE jsr [>D.Poll]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 bcc L00AE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291 L00B4 jmp [>D.AltIRQ]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 L00B8 bsr L00DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293 bra L0096
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 L00BC leay >L00C4,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 jmp [>D.URtoSs]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296 L00C4 jsr [>D.Poll]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 bcc L00C4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 ldb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 andb #^SysState turn off sysstate bit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 stb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 ldd <P$SWI2,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 std <D.SWI2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 ldd <D.UsrIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 std <D.SvcIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 bra L00B4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 L00DD pshs y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 L00DF ldx ,y++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309 stx -$04,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310 bne L00DF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
311 puls y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312 leay -2,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
313 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314
87
39ea0a63ce31 F$VIRQ in place of Unknown label
boisy
parents: 62
diff changeset
315 FVIRQ pshs cc
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
316 orcc #FIRQMask+IRQMask
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
317 ldy <D.CLTB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
318 ldx <D.Init
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
319 ldb PollCnt,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
320 ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
321 beq L0118
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
322 tst ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
323 beq L010C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
324 subb #$02
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
325 lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
326 leay b,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
327 tst ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
328 bne L0128
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
329 L0106 tst ,--y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
330 beq L0106
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
331 leay $02,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
332 L010C ldx R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
333 stx ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
334 ldy R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
335 sty ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
336 bra L0124
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
337 L0118 leax R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
338 L011A tst ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
339 beq L0124
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
340 cmpx ,y++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
341 bne L011A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
342 bsr L00DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
343 L0124 puls cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
344 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
345 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
346 L0128 puls cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
347 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
348 ldb #E$Poll
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
349 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
350
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
351 ClkEnt equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
352 pshs dp,cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
353 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
354 tfr a,dp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
355
62
0817702b8a2e clock.asm now references TPS, defsfile references systype
boisy
parents: 0
diff changeset
356 lda #TPS
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
357
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
358 sta <D.TSec
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
359 sta <D.Tick
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
360
62
0817702b8a2e clock.asm now references TPS, defsfile references systype
boisy
parents: 0
diff changeset
361 lda #TPS/10
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
362
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
363 sta <D.TSlice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
364 sta <D.Slice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
365 orcc #FIRQMask+IRQMask mask ints
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
366 leax >ClockIRQ,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
367 stx <D.IRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
368 * install system calls
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
369 leay >SysTbl,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
370 os9 F$SSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
371 ldx #PIA.U4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
372 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
373 sta 1,x change PIA.U4 side A to DDR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
374 sta ,x clear PIA.U4 side A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
375 sta 3,x change PIA.U4 side B to DDR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
376 coma complement A side A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
377 sta 2,x write all 1's to PIA.U4 side B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
378 lda #$34
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
379 sta 1,x PIA.U4 side A to I/O reg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
380 lda #$3F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
381 sta 3,x PIA.U4 side B to I/O reg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
382 lda 2,x
506
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
383
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
384 IFEQ SOFT
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
385
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
386 lbsr UpdTime Update time from RTC if one
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
387
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
388 ENDC
4f81e616d397 clock.asm now has B&B and TC^3 clock code
boisy
parents: 201
diff changeset
389
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
390 puls pc,dp,cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
391
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
392 * F$Time system call code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
393 FTime ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
394 ldd <D.Year
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
395 std ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
396 ldd <D.Day
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
397 std 2,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
398 ldd <D.Min
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
399 std 4,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
400 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
401 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
402
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
403 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
404 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
405 end