1 ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 ;
3 ; D O R A D O B a s e B o a r d D e b u g g e r
4 ;
5 ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6
7 ; filed on DoradoBaseDebug.masm
8 ; E. McCreight
9 ; last modified December 7, 1981 10:46 AM
10
11 .EXPORT PacifyWatchdog,SetProblem,ClearProblem
12 .EXPORT CallPtr
13
14 .IMPORT PowerUpMinus5And12,PowerUpAllSupplies,PowerUpDisk
15 .IMPORT DisconnectMufMan
16 .IMPORT StdClockSpeedH,StdClockSpeedL
17 .IMPORT MidasSetup
18 .IMPORT InitEnvironment,DoAllConversions
19 .IMPORT SetManifold,Problems
20
21 .PREDEFINE "MCS6502PREDEFS.SR"
22 .GETNOLIST "DoradoIO.mdefs"
23
24 ; Reset Pointers
25
FFFC 26 .LOC 0fffc
FFFC 02 00 27 .ADR Reset
FFFE 00 00 28 .ADR Interrupt
29
30 ; V a r i a b l e s
31
0000 32 .LOC ResetData
33 .SHORT ResetData
34
35 CallPtr:
0000 36 .BLK 2
37
38 WatchdogTemp:
0002 39 .BLK 1
40
41
0000 42 .LOC ResetCode
43
44 Interrupt:
0000 40 45 RTI
46
47 SetProblem:
48 ClearProblem:
0001 60 49 RTS
50
51 ; This is the reset code that gets run whenever the circuit
52 ; breakers are turned on or the little button on the front
53 ; panel is pushed.
54
55 Reset:
0002 D8 56 CLD
57
58 ; Clear all the bytes in page 0.
59
0003 A2 00 60 LDXI 0
0005 A9 00 61 LDAI 0
62
63 ClearMoreBytes:
0007 95 00 64 STAX 0
0009 CA 65 DEX
000A D0 FB 66 BNE ClearMoreBytes
67
68 ; Set up the stack and prepare for interrupts.
69
000C D8 70 CLD
000D A2 FF 71 LDXI 0ff
000F 9A 72 TXS
0010 20 00 00 73 JSR MidasSetup
74
75 ; Set the data direction registers in the I/O ports, after first
76 ; setting some output registers so their critical bits will
77 ; remain high
78
0013 A2 FF 79 LDXI 0ff ; set for all output bits
0015 8E 01 04 80 STX DAC+DDR
0018 8E 81 05 81 STX MCPBusH+DDR
82
001B E8 83 INX ; set for all input bits
001C 8E 03 05 84 STX CPRegL+DDR
001F 8E 01 05 85 STX CPRegH+DDR
86
0022 A2 E0 87 LDXI ISel ; set for mixtures
0024 8E 81 04 88 STX Comparators+DDR
89
0027 A2 C0 90 LDXI MASync+Trap'
0029 8E 03 04 91 STX CPIBus+DDR
92
002C A2 80 93 LDXI LampOff
002E 8E 82 04 94 STX MiscByte
0031 8E 83 04 95 STX MiscByte+DDR
96
0034 A2 F1 97 LDXI 80+MCPABus+MCPStrobe
0036 8E 83 05 98 STX MCPBusL+DDR
99
0039 A2 40 100 LDXI WatchdogDDRValue
003B 8E 01 06 101 STX Watchdog+DDR
102
103 ; Now initialize the voltage, current, and temperature vectors.
104
003E 20 00 00 105 JSR InitEnvironment
106
107 ; Power sequencing. First make sure our own supply is in spec.
108
109 RebootDorado:
0041 20 BA 00 110 JSR PacifyWatchdog
0044 20 00 00 111 JSR DoAllConversions
112
113 CheckVCC:
0047 A2 00 114 LDXI DisconnectMufMan
0049 20 00 00 115 JSR SetManifold ; force IO reset
116
117 ; Now start up the Ecl supplies.
118
004C A2 00 119 LDXI PowerUpAllSupplies
004E 20 00 00 120 JSR SetManifold
121
122 SuppliesAllUp:
123
124 ; Set the standard clock speed
125
0051 A2 00 126 LDXI StdClockSpeedH
0053 20 00 00 127 JSR SetManifold
0056 A2 00 128 LDXI StdClockSpeedL
0058 20 00 00 129 JSR SetManifold
130
131 Continuous:
005B 20 00 00 132 JSR DoAllConversions
133
005E A9 00 134 LDAI 0
0060 8D 00 00 135 STA Problems
136
0063 A9 E0 137 LDAI 0e0,#LowAddrByte ; standard place
0065 85 00 138 STA CallPtr
0067 A9 00 139 LDAI 0e0,#HighAddrByte
0069 85 01 140 STA CallPtr+1
141
142 Spin:
006B AE 00 00 143 LDX Problems ; this allows debugging subroutines, etc.
006E F0 1A 144 BEQ Routine0
0070 CA 145 DEX
0071 F0 20 146 BEQ Routine1
0073 CA 147 DEX
0074 F0 26 148 BEQ Routine2
0076 CA 149 DEX
0077 F0 33 150 BEQ Routine3
151
0079 20 82 00 152 JSR CallIt
007C 20 BA 00 153 JSR PacifyWatchdog
007F 4C 6B 00 154 JMP Spin
155
156 ;Run the subroutine 0,1,2,or 3, if the location in
157 ;Problems is = to a 0,1,2 or 3. if Problems is larger than
158 ;3 than CallPtr and CallPtr+1 should point to
159 ;the subroutine that you are using for debugging.
160 ;The location Problems is preset to E0.
161
162 CallIt:
0082 A5 01 163 LDA CallPtr+1
0084 48 164 PHA
0085 A5 00 165 LDA CallPtr
0087 48 166 PHA
0088 08 167 PHP
0089 40 168 RTI
169 ;Run this routine if Problems is=to a 0
170 ;This routine will Pacify the watchdog timer and return to spin
171
172 Routine0:
008A 20 00 00 173 JSR DoAllConversions
008D 20 BA 00 174 JSR PacifyWatchdog
0090 4C 6B 00 175 JMP Spin
176
177 ;Run this routine if Problems is=to a 1
178 ;This routine will increment the dac from 0 to 256
179
180 Routine1:
0093 EE 00 04 181 INC DAC
0096 20 BA 00 182 JSR PacifyWatchdog
0099 4C 6B 00 183 JMP Spin
184
185 ;Run this routine if Problems is=to a 2
186 ;This routine will turn all of the dac bits on and then off.
187
188 Routine2:
009C A9 00 189 LDAI 0
009E 8D 00 04 190 STA DAC
00A1 A9 FF 191 LDAI 0ff
00A3 8D 00 04 192 STA DAC
00A6 20 BA 00 193 JSR PacifyWatchdog
00A9 4C 6B 00 194 JMP Spin
195
196 ;Run this routine if Problems is=to a 3
197 ;This routine will turn the lite on and if we exit midas the
198 ;watch dog timer should reboot the dorado and turn off the lite
199
200 Routine3:
00AC A9 00 201 LDAI 0
00AE 8D 82 04 202 STA MiscByte
00B1 4C AC 00 203 JMP Routine3
204
205
206 OnceOnly:
00B4 A9 00 207 LDAI 0
00B6 8D 00 00 208 STA Problems
00B9 60 209 RTS
210
211 ; Let the watchdog timer know we're still alive by copying
212 ; WatchdogIn to WatchdogOut every once in a while.
213
214 PacifyWatchdog:
00BA AD 00 06 215 LDA Watchdog
00BD 29 80 216 ANDI WatchdogIn
00BF 6A 217 RORA ; carries WatchdogIn to WatchdogOut
00C0 85 02 218 STA WatchdogTemp
00C2 78 219 SEI
00C3 AD 00 06 220 LDA Watchdog
00C6 29 BF 221 ANDI 0ff-WatchdogOut
00C8 05 02 222 ORA WatchdogTemp
00CA 8D 00 06 223 STA Watchdog
00CD 58 224 CLI
00CE 60 225 RTS
226
227 .END