annotate 3rdparty/drivers/burke/hdutil3.src @ 1299:1f0995cd0431

REL is now back-ported to OS-9 Level One
author boisy
date Mon, 01 Sep 2003 16:59:50 +0000
parents c10820aa211b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
91
boisy
parents:
diff changeset
1 * COPYRIGHT BURKE & BURKE 1987
boisy
parents:
diff changeset
2 * ALL RIGHTS RESERVED
boisy
parents:
diff changeset
3 *
boisy
parents:
diff changeset
4 * COCO XT UTILITY ROUTINES
boisy
parents:
diff changeset
5 *
boisy
parents:
diff changeset
6 * Date Who Description
boisy
parents:
diff changeset
7 * -------- --- ---------------------------------
boisy
parents:
diff changeset
8 * 08-14-87 CJB Added modification history.
boisy
parents:
diff changeset
9 * Added assembly switch for controller
boisy
parents:
diff changeset
10 * in slot 1.
boisy
parents:
diff changeset
11 *
boisy
parents:
diff changeset
12 * 10-26-87 CJB Added conditional assembly to leave
boisy
parents:
diff changeset
13 * interrupts enabled if IRQFLG zero.
boisy
parents:
diff changeset
14 *
boisy
parents:
diff changeset
15 * 11-20-87 CJB Fixed IRQ DISABLE bug (uses switch IRQFLG)
boisy
parents:
diff changeset
16 * Added work-around for F$SLEEP bug (GRFDRV ONLY)
boisy
parents:
diff changeset
17 *
boisy
parents:
diff changeset
18 * 12-20-87 CJB Added routine to sleep or delay while waiting
boisy
parents:
diff changeset
19 * for disk seeks (SNOOZE)
boisy
parents:
diff changeset
20 *
boisy
parents:
diff changeset
21 * 01/28/88 CJB Added improved slot switching and slot
boisy
parents:
diff changeset
22 * independence. Slot # in PD.DNS
boisy
parents:
diff changeset
23 *
boisy
parents:
diff changeset
24 * 02/08/88 CJB Added SAVSLT for improved read cache performance
boisy
parents:
diff changeset
25 * 05/18/88 cjb Added CLR V.WAKE,U in SLOT4 routine
boisy
parents:
diff changeset
26 * 07/14/91 cjb Rev. 2.5 added support for fast recalibration
boisy
parents:
diff changeset
27 *
boisy
parents:
diff changeset
28
boisy
parents:
diff changeset
29 page
boisy
parents:
diff changeset
30 *
boisy
parents:
diff changeset
31 * Select HD controller slot SPARESEL in multi-Pak.
boisy
parents:
diff changeset
32 *
boisy
parents:
diff changeset
33 * Enter w/ Reg-U -> static storage,
boisy
parents:
diff changeset
34 * Reg-Y -> path descriptor
boisy
parents:
diff changeset
35 *
boisy
parents:
diff changeset
36 * The active ROM/CART slot is preserved.
boisy
parents:
diff changeset
37 *
boisy
parents:
diff changeset
38 * This routine is normally called with interrupts enabled.
boisy
parents:
diff changeset
39 * It disables them if IRQFLG is 1, for use on L1, V1
boisy
parents:
diff changeset
40 * systems.
boisy
parents:
diff changeset
41 *
boisy
parents:
diff changeset
42 * Note that this routine does *NOT* set the DMA semaphore.
boisy
parents:
diff changeset
43 * This is only done once, at the very beginning of each command.
boisy
parents:
diff changeset
44 *
boisy
parents:
diff changeset
45 SLOT3 equ *
boisy
parents:
diff changeset
46
boisy
parents:
diff changeset
47 ifeq IRQFLG ;If level 2, or version 2 of level 1
boisy
parents:
diff changeset
48 pshs CC ;Save entry CC
boisy
parents:
diff changeset
49 endc
boisy
parents:
diff changeset
50
boisy
parents:
diff changeset
51 orcc #$50 ;No interrupts during MPAK update
boisy
parents:
diff changeset
52
boisy
parents:
diff changeset
53 bsr SavSlt ;Save old slot #, get to A
boisy
parents:
diff changeset
54 anda #%11110000
boisy
parents:
diff changeset
55 ora PD.DNS,Y ;Use device's slot #
boisy
parents:
diff changeset
56 sta >MPAK
boisy
parents:
diff changeset
57
boisy
parents:
diff changeset
58 ifeq IRQFLG ;If level 2, or version 2 of level 1
boisy
parents:
diff changeset
59 puls CC,PC ; restore entry CC
boisy
parents:
diff changeset
60 else
boisy
parents:
diff changeset
61 rts ; exit with interrupts disabled
boisy
parents:
diff changeset
62 endc
boisy
parents:
diff changeset
63
boisy
parents:
diff changeset
64 * Utility to save old slot
boisy
parents:
diff changeset
65 * Preserves B:X
boisy
parents:
diff changeset
66
boisy
parents:
diff changeset
67 SavSlt lda >MPAK
boisy
parents:
diff changeset
68 sta OldSlt,U
boisy
parents:
diff changeset
69 rts
boisy
parents:
diff changeset
70
boisy
parents:
diff changeset
71 *
boisy
parents:
diff changeset
72 * Restore original slot SPARESEL in multi-PAK.
boisy
parents:
diff changeset
73 *
boisy
parents:
diff changeset
74 * Enter w/ Reg-U -> static storage
boisy
parents:
diff changeset
75 *
boisy
parents:
diff changeset
76 * This routine preserves carry and B, since it is called
boisy
parents:
diff changeset
77 * before returning an error code.
boisy
parents:
diff changeset
78 *
boisy
parents:
diff changeset
79 * The active ROM slot and CART interrupt is also preserved.
boisy
parents:
diff changeset
80 *
boisy
parents:
diff changeset
81 * This routine is always called with interrupts disabled.
boisy
parents:
diff changeset
82 * (or with interrupts enabled and SLOT4 selected already)
boisy
parents:
diff changeset
83 * It always enables interrupts.
boisy
parents:
diff changeset
84 *
boisy
parents:
diff changeset
85 * Note that this routine does *NOT* clear the DMA semaphore
boisy
parents:
diff changeset
86 * unless entered at Release. This is only done once, at
boisy
parents:
diff changeset
87 * the very end of each command.
boisy
parents:
diff changeset
88 *
boisy
parents:
diff changeset
89 Release orcc #$50 ;Force no interrupts during updates
boisy
parents:
diff changeset
90
boisy
parents:
diff changeset
91 lda #0 ;preserve carry
boisy
parents:
diff changeset
92 * sta >D.DMAReq ;clear "DMA in use" semaphore
boisy
parents:
diff changeset
93 sta >DMASEM ;Zero OS9 level-dependent semaphore
boisy
parents:
diff changeset
94
boisy
parents:
diff changeset
95 SLOT4 orcc #$50 ;Force no interrupts during update
boisy
parents:
diff changeset
96
boisy
parents:
diff changeset
97 lda OLDSLT,U ;Recover old slot
boisy
parents:
diff changeset
98 sta >MPAK
boisy
parents:
diff changeset
99 lda #0 ;Preserve carry
boisy
parents:
diff changeset
100 sta V.WAKE,U ;Free anyone waiting on us.
boisy
parents:
diff changeset
101
boisy
parents:
diff changeset
102 andcc #$AF ;Enable interrupts
boisy
parents:
diff changeset
103 rts
boisy
parents:
diff changeset
104
boisy
parents:
diff changeset
105 *
boisy
parents:
diff changeset
106 * Wait for end of other processes disk I/O. This is
boisy
parents:
diff changeset
107 * indicated by semaphore $6A = 0. Grab semaphore
boisy
parents:
diff changeset
108 * as soon as it frees up.
boisy
parents:
diff changeset
109 *
boisy
parents:
diff changeset
110 * Assumes slot 3 is selected at entry, and interrupts
boisy
parents:
diff changeset
111 * are enabled.
boisy
parents:
diff changeset
112 *
boisy
parents:
diff changeset
113 * Always exits with slot 3 selected and interrupts disabled.
boisy
parents:
diff changeset
114 *
boisy
parents:
diff changeset
115 Semfor pshs U,X,Y,B,A,CC
boisy
parents:
diff changeset
116
boisy
parents:
diff changeset
117 * Wait for semaphore loop . . .
boisy
parents:
diff changeset
118 Sem0 orcc #$50 ;No interrupts!
boisy
parents:
diff changeset
119
boisy
parents:
diff changeset
120 tst >DMASEM ;Check OS9 level-dependent semaphore
boisy
parents:
diff changeset
121 * tst >D.DMAReq ;Check semaphore
boisy
parents:
diff changeset
122 bne W6.SLP
boisy
parents:
diff changeset
123
boisy
parents:
diff changeset
124 * Semaphore is free. Grab it.
boisy
parents:
diff changeset
125
boisy
parents:
diff changeset
126 dec >DMASEM ;Grab OS9 level-dependent semaphore
boisy
parents:
diff changeset
127 * dec >D.DMAReq ;Grab semaphore!
boisy
parents:
diff changeset
128 puls CC,A,B,Y,X,U ;restore interrupts, etc
boisy
parents:
diff changeset
129 bra Slot3 ; and select hard disk controller
boisy
parents:
diff changeset
130
boisy
parents:
diff changeset
131 *
boisy
parents:
diff changeset
132 * Routine to waste time during disk seeks, etc.
boisy
parents:
diff changeset
133 *
boisy
parents:
diff changeset
134 * On systems that support D.DMAReq, we set the slot to 4 and
boisy
parents:
diff changeset
135 * give up the processor. Otherwise, we return immediately.
boisy
parents:
diff changeset
136 *
boisy
parents:
diff changeset
137 Snooze pshs U,Y,X,D
boisy
parents:
diff changeset
138
boisy
parents:
diff changeset
139 ifeq IRQFLG ;If D.DMAReq,
boisy
parents:
diff changeset
140 bsr TikNap ; surrender slot and processor
boisy
parents:
diff changeset
141 bsr Slot3 ; map controller in again
boisy
parents:
diff changeset
142 endc
boisy
parents:
diff changeset
143
boisy
parents:
diff changeset
144 puls D,X,Y,U,PC
boisy
parents:
diff changeset
145
boisy
parents:
diff changeset
146 * Semaphore is busy. Sleep a bit.
boisy
parents:
diff changeset
147 W6.SLP bsr TikNap ;Surrender the processor
boisy
parents:
diff changeset
148 bra Sem0
boisy
parents:
diff changeset
149
boisy
parents:
diff changeset
150 *
boisy
parents:
diff changeset
151 * Force slot 4, enable interrupts,
boisy
parents:
diff changeset
152 * Sleep for the rest of this tick.
boisy
parents:
diff changeset
153 *
boisy
parents:
diff changeset
154 TikNap pshs X ;Save entry X
boisy
parents:
diff changeset
155 bsr Slot4 ;Select slot 4, enable interrupts
boisy
parents:
diff changeset
156
boisy
parents:
diff changeset
157 ifne (XLEVEL-1) ;If Level 2,
boisy
parents:
diff changeset
158 ldx <D.SYSPRC
boisy
parents:
diff changeset
159 cmpx <DPROC
boisy
parents:
diff changeset
160 beq TikXit ;WORKAROUND -- IF LOADING GRFDRV, NO SLEEP!
boisy
parents:
diff changeset
161 endc
boisy
parents:
diff changeset
162
boisy
parents:
diff changeset
163 ldx #1
boisy
parents:
diff changeset
164 OS9 F$Sleep ;Give up the rest of this tick
boisy
parents:
diff changeset
165
boisy
parents:
diff changeset
166 TikXit puls X,PC
boisy
parents:
diff changeset
167
boisy
parents:
diff changeset
168 page
boisy
parents:
diff changeset
169 *
boisy
parents:
diff changeset
170 * Perform a SEEK command
boisy
parents:
diff changeset
171 *
boisy
parents:
diff changeset
172 SEEK lda #WX$SIK ;Construct "SEEK" command
boisy
parents:
diff changeset
173 lbsr CmExec
boisy
parents:
diff changeset
174 rts
boisy
parents:
diff changeset
175
boisy
parents:
diff changeset
176 *
boisy
parents:
diff changeset
177 * Seek to track 0
boisy
parents:
diff changeset
178 *
boisy
parents:
diff changeset
179 SEEKT0 tst PD.STP,Y
boisy
parents:
diff changeset
180 bpl ST0A
boisy
parents:
diff changeset
181
boisy
parents:
diff changeset
182 * Here for drives that don't need recalibration
boisy
parents:
diff changeset
183 * Just return immediately.
boisy
parents:
diff changeset
184
boisy
parents:
diff changeset
185 clrb
boisy
parents:
diff changeset
186 rts
boisy
parents:
diff changeset
187
boisy
parents:
diff changeset
188 * Here for drives that need it
boisy
parents:
diff changeset
189
boisy
parents:
diff changeset
190 ST0A lda #WX$TK0 ;Create "RECALIBRATE" command
boisy
parents:
diff changeset
191 lbsr CmExec
boisy
parents:
diff changeset
192 bcs ST0XIT
boisy
parents:
diff changeset
193
boisy
parents:
diff changeset
194 ifne (Drives-1)
boisy
parents:
diff changeset
195 ldx actdrv,u ;Clear track number in active drive table
boisy
parents:
diff changeset
196 clr V.TRAK,x
boisy
parents:
diff changeset
197 clr V.TRAK+1,x
boisy
parents:
diff changeset
198 else
boisy
parents:
diff changeset
199 clr DRVTBL+V.TRAK,U
boisy
parents:
diff changeset
200 clr DRVTBL+V.TRAK+1,U
boisy
parents:
diff changeset
201 endc
boisy
parents:
diff changeset
202
boisy
parents:
diff changeset
203 ST0XIT rts
boisy
parents:
diff changeset
204
boisy
parents:
diff changeset
205 *
boisy
parents:
diff changeset
206 * end of hdutil3.src
boisy
parents:
diff changeset
207 *