Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/clock2_smart.asm @ 2152:74fb212cb659
Changelog comes from higher up
author | boisy |
---|---|
date | Wed, 14 May 2008 02:13:22 +0000 |
parents | f389c6bca482 |
children |
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 - Dallas Semiconductor 1216 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 * Dallas Semiconductor DS1216 SmartWatch |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
7 * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
8 * Wakeup sequence $C5 3A A3 5C C5 3A A3 5C |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
9 * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
10 * Time byte sequence in Binary Coded Decimal |
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 * byte bit 7 6 5 4 3 2 1 0 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
13 * 0 | 0.1 sec MSB | 0.1 sec LSB | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
14 * 1 | 0 | 10 sec | seconds | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
15 * 2 | 0 | 10 min | minutes | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
16 * 3 |12/24| 0 | AM/PM | HR | Hour | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
17 * | 10 HR | Hour | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
18 * 0=12, 1=24 0=AM, 1=PM |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
19 * 4 | 0 | 0 | OSC |RESET| 0 | Weekday | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
20 * 5 | 0 | 0 | 10 Date | Date | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
21 * 6 | 0 | 0 | 0 |10 Month| Month | |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
22 * 7 | 10 Year | Year | |
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 * OSC = 1; turns off clock to save battery. RESET not used in Coco circuit. |
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 * When inserted in external ROM socket, the clock is addressed at: |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
27 * $C000 bit = 0 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
28 * $C001 bit = 1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
29 * $C004 read byte to wakeup then send wakeup sequence to bit toggles. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
30 * Then either read or send time. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
31 * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
32 * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
33 * 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
|
34 * Comment |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
35 * ------------------------------------------------------------------ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
36 * 2004/07/28 Robert Gault |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
37 * Complete rewrite of SmartWatch segment which would never have worked. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
38 * See previous versions for old code if desired. Routine now will search |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
39 * through all MPI slots to find clock and accept either AM/PM or military |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
40 * time. User notified if clock not found or data memory not available. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
41 * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
42 * Initialization routine contains code that bypasses OS-9 system calls to |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
43 * acquire needed low RAM that can't become ROM. This type of code is not |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
44 * recommended in most cases but nothing else was usable. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
45 * 2004/07/31 Robert Gault |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
46 * Added a settime routine and changed "no clock found" routine. If the |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
47 * clock is not found, the D.Time entries are cleared but no message is sent. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
48 * Date -t will never get passed one minute. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
49 * 2004/07/31 Rodney Hamilton |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
50 * Improved RTCJVEmu code, conditionalized RTC type comments. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
51 * 2004/08/2 Robert Gault |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
52 * Alphabetized all clock listings so things can be found much more easily. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
53 * Placed list of clock types at beginning of source for record keeping. |
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 * 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
|
56 * Separated clock2 modules for source clarity. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
57 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
58 nam Clock2 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
59 ttl Dallas Semiconductor 1216 RTC Driver |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
60 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
61 ifp1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
62 use defsfile |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
63 endc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
64 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
65 tylg set Sbrtn+Objct |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
66 atrv set ReEnt+rev |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
67 rev set $00 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
68 edition set 1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
69 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
70 RTC.Base equ $C000 clock mapped to $C000-$DFFF; $FFA6 MMU slot |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
71 RTC.Zero equ 0 Send zero bit |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
72 RTC.One equ 1 Send ones bit |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
73 RTC.Read equ 4 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
74 *D.SWPage on system DP; Refer to os9defs. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
75 D.RTCSlt equ 0 on SmartWatch ?data? page |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
76 D.RTCFlg equ 1 on SW page |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
77 D.RTCMod equ 2 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
78 D.Temp equ 3 on SW page, holds "clock" data |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
79 D.Start equ 4 on SW page, code starts here |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
80 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
81 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
82 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
|
83 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
84 name fcs "Clock2" |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
85 fcb edition |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
86 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
87 IFNE MPIFlag |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
88 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
|
89 ENDC |
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 JmpTable |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
92 lbra Init |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
93 bra GetTime |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
94 nop |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
95 lbra SetTime |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
96 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
97 GetTime pshs cc,d,x,y,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
98 orcc #$50 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
99 lda D.SWPage |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
100 clrb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
101 tfr d,u point to working space |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
102 lda $FF7F |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
103 pshs a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
104 lda D.RTCSlt,u info for MPI slot |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
105 sta $FF7F |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
106 clr D.RTCMod,u set for read time |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
107 jsr D.Start,u jsr to it |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
108 lbra exit |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
109 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
110 |
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 * This set time routine forces military time. It can't turn off clock but can |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
113 * be used as a timer if time set to 0:0:0 hr:min:sec |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
114 SetTime pshs cc,d,x,y,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
115 orcc #$50 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
116 lda D.SWPage |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
117 clrb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
118 tfr d,u point to working space |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
119 lda $FF7F |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
120 pshs a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
121 lda D.RTCSlt,u info for MPI slot |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
122 sta $FF7F |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
123 lda #-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
124 sta D.RTCMod,u indicate set time rather than read |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
125 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
126 ldx #D.Slice |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
127 ELSE |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
128 ldx #D.TSec |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
129 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
130 tfr u,y get location of safe region |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
131 leay >D.Start+alrtend-reloc,y point to end of wakeup code |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
132 lda ,-x get D.Time data and store it |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
133 ldb #4 convert tenths sec, sec, min, hours |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
134 bsr binbcd to binary coded decimal |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
135 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
136 lda D.Daywk |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
137 ELSE |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
138 clra |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
139 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
140 sta ,y+ set day of week if present |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
141 lda ,x |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
142 ldb #3 convert day of month, month, year |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
143 bsr binbcd to BCD |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
144 jsr >D.Start,u send data to clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
145 lbra exit |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
146 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
147 binbcd pshs b |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
148 bcd3 clrb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
149 bcd1 cmpa #10 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
150 bcs bcd2 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
151 addd #$f610 decrease bin regA by 10 add bcd $10 to regB |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
152 bra bcd1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
153 bcd2 pshs a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
154 addb ,s+ add in remainder; BCD = binary when less than 10 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
155 stb ,y+ place in message to clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
156 lda ,-x get next byte of D.Time |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
157 dec ,s decrease counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
158 bne bcd3 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
159 puls b,pc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
160 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
161 * This becomes D.Start |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
162 reloc equ * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
163 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
164 lda D.HINIT |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
165 anda #$CC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
166 sta $FF90 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
167 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
168 ldb $FFA6 choose to use normal location |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
169 pshs b |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
170 ldb #$3E |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
171 stb $FFA6 reset MMU for clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
172 sta $FFDE |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
173 ldd #RTC.Base |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
174 tfr a,dp DP now points to clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
175 tst D.RTCMod,u are we reading the clock or setting it? |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
176 beq findclk go if reading |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
177 lbsr wakeup we are setting a found clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
178 lbra found |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
179 findclk lda #-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
180 sta alrtend,pcr |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
181 lbsr wakeup wakeup the clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
182 ldx #D.Sec one incoming byte dropped |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
183 lda #8 bytes to get |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
184 pshs a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
185 L0050 ldb #8 bits to get |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
186 L0052 lsr <RTC.Read get a bit |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
187 rora |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
188 decb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
189 bne L0052 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
190 tst D.RTCFlg,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
191 bne maybe |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
192 cmpa D.Temp,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
193 beq maybe clock might look like ROM |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
194 inc D.RTCFlg,u found the clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
195 maybe sta ,x transfer it to time |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
196 lda ,s check loop counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
197 cmpa #8 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
198 beq L006F skip if 0.1 sec |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
199 cmpa #4 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
200 bne L006B skip if not day of week |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
201 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
202 lda ,x move to correct location |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
203 anda #7 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
204 sta D.Daywk |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
205 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
206 bra L006F |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
207 L006B cmpa #5 hour byte |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
208 bne wd |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
209 lda ,x |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
210 bita #%10000000 12/24hr |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
211 beq wd |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
212 bita #%00100000 AM/PM |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
213 pshs cc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
214 anda #%00011111 keep only time |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
215 puls cc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
216 bne pm |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
217 cmpa #$12 these are BCD tests |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
218 bne am |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
219 clr ,x 12AM=0hr military |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
220 bra wd |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
221 pm cmpa #$12 12PM=12hr military |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
222 beq wd |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
223 adda #$12 1-11PM add 12 for military |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
224 am sta ,x |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
225 wd leax -1,x update time slot |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
226 bsr L0087 convert from BCD to binary |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
227 L006F dec ,s |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
228 bne L0050 get the next byte from clock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
229 lda 1,x get year |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
230 cmpa #50 half assed test for century |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
231 bhs c19 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
232 adda #100 make it 20th |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
233 c19 sta 1,x |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
234 leas 1,s |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
235 tst D.RTCFlg,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
236 bne found |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
237 ldb D.RTCSlt,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
238 bitb #$30 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
239 beq found |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
240 subb #$10 not found so move to next slot |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
241 stb D.RTCSlt,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
242 stb $FF7F |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
243 lbra findclk |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
244 found clra system DP is always 0 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
245 tfr a,dp |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
246 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
247 lda D.HINIT reset system before rts |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
248 sta $FF90 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
249 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
250 sta $FFDF |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
251 puls a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
252 sta $FFA6 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
253 rts go back to normal code location |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
254 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
255 * Convert BCD to binary |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
256 L0087 lda 1,x |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
257 clrb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
258 L008A cmpa #$10 BCD 10 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
259 bcs L0094 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
260 addd #$F00A decrease BCD by $10 and add binary 10 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
261 bra L008A |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
262 L0094 pshs a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
263 addb ,s+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
264 stb 1,x |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
265 term rts |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
266 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
267 wakeup lda <RTC.Read clear the clock for input |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
268 * When getting time data, bit0 is rotated into a full byte. This |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
269 * means the result is $00 or $FF for ROM. Any other value used for a test |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
270 * will give a false positive for the clock. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
271 clrb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
272 bita #1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
273 beq w1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
274 comb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
275 w1 stb D.Temp,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
276 leax alert,pcr point to message |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
277 nxtbyte ldb #8 8 bytes to send |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
278 lda ,x+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
279 cmpa #-1 changed from 0 to -1 to accommodate settime |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
280 beq term |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
281 nxtbit lsra bits sent to clock by toggling |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
282 bcs high Zero and One |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
283 cmpa <RTC.Zero faster than tst |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
284 bra nxtbit2 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
285 high cmpa <RTC.One |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
286 nxtbit2 decb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
287 bne nxtbit |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
288 bra nxtbyte |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
289 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
290 * SmartWatch wakeup sequence |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
291 alert fcb $c5,$3a,$a3,$5c,$c5,$3a,$a3,$5c |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
292 * The next 8 bytes become time data when setting the clock. Terminator is |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
293 * now $FF instead of $00 to permit $00 as data. |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
294 alrtend fcb $FF |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
295 alrtime rmb 7 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
296 fcb $FF |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
297 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
298 exit equ * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
299 puls a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
300 sta $FF7F restore MPI |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
301 tst D.RTCFlg,u was clock found? |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
302 beq noclock |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
303 puls cc,d,x,y,u,pc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
304 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
305 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
306 Init equ * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
307 clr <D.SWPage safe location for Read |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
308 pshs d,x,y,u |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
309 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
310 ldx <D.SysMem get memory map |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
311 ldy <D.SysDAT get MMU map |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
312 ldb #$20 first 20 pages always in use |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
313 abx point to page |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
314 A1 tst ,x+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
315 beq A2 found free page so go |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
316 incb update page counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
317 bpl A1 still in RAM only, then go |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
318 A4 lda #2 can't find RAM only memory |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
319 leax mem_mes,pcr |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
320 ldy #40 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
321 os9 I$WritLn |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
322 puls d,x,y,u,pc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
323 A2 pshs b save page # |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
324 andb #%11100000 modulo MMU blocks |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
325 lsrb convert to DAT byte value |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
326 lsrb page# * $100 / $2000 = MMU # |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
327 lsrb $2000/$100=$20 at 2 bytes per MMU |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
328 lsrb then page#/$10 gives answer |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
329 ldd b,y get the MMU value |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
330 cmpd #$333E is DAT unused |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
331 pshs cc save answer |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
332 inc 1,s update page # for a used page |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
333 puls cc,b get back answer and page # |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
334 beq A1 if unused keep going |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
335 lda #RAMinUse |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
336 sta ,-x flag the memory in use |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
337 ELSE |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
338 ldx <$20 D.FMBM free memory bit map |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
339 ldy <$22 top of memory bit map |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
340 ldb #-1 preset counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
341 A1 lda ,x+ get bits |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
342 incb update $800 counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
343 pshs y test for end of map |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
344 cmpx ,s+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
345 bhi A4 send error message |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
346 clr -1,s preset bit counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
347 A2 inc ,s |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
348 lsra read left to right |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
349 bcs A2 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
350 lda ,s+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
351 deca convert to number of shifts |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
352 cmpa #8 overflow value |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
353 beq A1 get more map on ov |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
354 pshs a save the number of shifts |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
355 lda #8 bytes*8 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
356 mul |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
357 addb ,s add modulo $800 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
358 cmpb #$7E need RAM not ROM for clock data |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
359 bhs A4 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
360 lda #%10000000 need to create mask to map the |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
361 A5 lsra unused bit, so reverse the process |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
362 dec ,s decrease shift counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
363 bne A5 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
364 leas 1,s yank counter |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
365 ora -1,x mark bit used and |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
366 sta -1,x tell the system |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
367 bra A3 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
368 A4 leas 1,s yank bit info |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
369 lda #2 error path # |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
370 leax mem_mes,pcr good memory not found |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
371 ldy #200 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
372 os9 I$WritLn |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
373 puls d,x,y,u,pc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
374 A3 equ * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
375 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
376 stb <D.SWPage keep the info for Read |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
377 tfr b,a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
378 clrb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
379 tfr d,x regX now points to SW data page |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
380 ldb $FF7F get MPI values |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
381 andb #3 keep IRQ info |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
382 orb #$30 force slot #4 to start search |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
383 stb D.RTCSlt,x save the info |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
384 clr D.RTCFlg,x set to no clock found |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
385 clr D.RTCMod,x set to read time |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
386 leax D.Start,x safe location for moved code |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
387 IFNE H6309 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
388 leay reloc,pcr |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
389 ldw #exit-reloc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
390 tfm y+,x+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
391 ELSE |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
392 leau reloc,pcr relocation routine to move code |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
393 ldy #exit-reloc to a RAM only location |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
394 B3 lda ,u+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
395 sta ,x+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
396 leay -1,y |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
397 bne B3 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
398 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
399 puls d,x,y,u,pc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
400 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
401 noclock equ * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
402 ldd #7 seven time bytes to clear |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
403 ldx #D.Time |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
404 IFGT Level-1 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
405 sta D.Daywk |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
406 ENDC |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
407 nc sta ,x+ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
408 decb |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
409 bne nc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
410 puls cc,d,x,y,u,pc |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
411 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
412 mem_mes fcc /There is no system memory for/ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
413 fcb $0a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
414 fcc /the SmartWatch. Please reduce/ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
415 fcb $0a |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
416 fcc /os9boot size or use soft clock./ |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
417 fcb $0d |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
418 |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
419 emod |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
420 eom equ * |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
421 end |
f389c6bca482
New clock2_*.asm files split from single clock2.asm for more source clarity
boisy
parents:
diff
changeset
|
422 |