annotate level1/modules/clock2_disto4.asm @ 2687:f3b7ca8083fd

Fixed creation of descriptors
author Boisy Pitre <boisy.pitre@nuance.com>
date Sun, 15 Jul 2012 11:10:20 -0500
parents f389c6bca482
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1724
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
1 ********************************************************************
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
2 * Clock2 - Disto 4-N-1 RTC Driver
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
3 *
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
4 * $Id$
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
5 *
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
7 * Comment
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
9 * 1 2004/08/18 Boisy G. Pitre
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
10 * Separated clock2 modules for source clarity.
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
11
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
12 nam Clock2
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
13 ttl Disto 4-N-1 RTC Driver
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
14
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
15 ifp1
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
16 use defsfile
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
17 endc
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
18
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
19 tylg set Sbrtn+Objct
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
20 atrv set ReEnt+rev
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
21 rev set $00
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
22 edition set 1
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
23
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
24 RTC.Base equ $FF50 Base address of clock
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
25
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
26 mod eom,name,tylg,atrv,JmpTable,RTC.Base
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
27
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
28 name fcs "Clock2"
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
29 fcb edition
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
30
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
31 IFNE MPIFlag
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
32 SlotSlct fcb MPI.Slot-1 Slot constant for MPI select code
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
33 ENDC
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
34
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
35 JmpTable
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
36 lbra Init
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
37 bra GetTime
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
38 nop
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
39 lbra SetTime
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
40
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
41 GetTime equ *
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
42 IFNE MPIFlag
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
43 pshs cc Save old interrupt status and mask IRQs
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
44 orcc #IntMasks
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
45 ldb >MPI.Slct Save currently selected MPak slot on stack
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
46 pshs b
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
47 andb #$F0
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
48 orb >SlotSlct,pcr Select MPak slot for clock
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
49 stb >MPI.Slct
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
50 ENDC
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
51
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
52 ldx M$Mem,pcr
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
53 ldy #D.Time Start with seconds
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
54
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
55 ldb #11
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
56 bsr GetVal Get Year
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
57 bsr GetVal Get Month
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
58 bsr GetVal Get Day
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
59 lda #3 Mask tens digit of hour to remove AM/PM bit
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
60 bsr GetVal1 Get Hour
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
61 bsr GetVal Get Minute
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
62 bsr GetVal Get Second
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
63
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
64 IFNE MPIFlag
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
65 puls b Restore saved "currently" selected MPak slot
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
66 stb >MPI.Slct
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
67 puls cc,pc Restore previous IRQ status
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
68 ELSE
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
69 rts No MPI, don't need to mess with slot, CC
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
70 ENDC
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
71
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
72 GetVal lda #$0f Mask to apply to tens digit
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
73 GetVal1 stb 1,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
74 decb
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
75 anda ,x read ones digit from clock
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
76 pshs b save b
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
77 ldb #10
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
78 mul multiply by 10 to get value
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
79 stb ,y Add to ones digit
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
80 puls b
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
81 stb 1,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
82 decb
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
83 lda ,x read tens digit from clock and mask it
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
84 anda #$0f
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
85 adda ,y
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
86 sta ,y+
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
87 rts
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
88
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
89
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
90
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
91 SetTime pshs cc
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
92 orcc #IntMasks
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
93
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
94 IFNE MPIFlag
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
95 ldb >MPI.Slct Save currently selected MPak slot
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
96 pshs b
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
97 andb #$F0
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
98 orb >SlotSlct,pcr Get slot to select
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
99 stb >MPI.Slct Select MPak slot for clock
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
100 ENDC
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
101
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
102 ldy #D.Time+6
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
103 ldx M$Mem,pcr
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
104 clrb
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
105 bsr SetVal Set Second
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
106 bsr SetVal Set Minute
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
107 bsr SetVal Set Hour
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
108 bsr SetVal Set Day
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
109 bsr SetVal Set Month
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
110 bsr SetVal Set Year
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
111
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
112 IFNE MPIFlag
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
113 puls b Restore old MPAK slot
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
114 stb >MPI.Slct
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
115 ENDC
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
116
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
117 puls cc
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
118 clrb No error
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
119 rts
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
120
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
121 SetVal clr ,-s Create variable for tens digit
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
122 lda ,-y Get current value
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
123 DvLoop suba #10 Get Tens digit on stack, ones digit in A
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
124 bcs DvDone
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
125 inc ,s
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
126 bra DvLoop
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
127 DvDone adda #10
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
128 stb 1,x Set Clock address
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
129 incb
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
130 sta ,x Store ones digit
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
131 stb 1,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
132 incb
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
133 puls a
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
134 sta ,x Store tens digit
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
135 rts
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
136
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
137
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
138 Init
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
139 * Disto 4-N-1 RTC specific initialization
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
140 ldx M$Mem,pcr
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
141 ldd #$010F Set mode for RTC chip
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
142 stb 1,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
143 sta ,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
144 ldd #$0504
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
145 sta ,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
146 stb ,x
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
147 rts
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
148
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
149 emod
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
150 eom equ *
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
151 end
f389c6bca482 New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff changeset
152