annotate level1/modules/boot_ide.asm @ 3063:c0bb75b72339

updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
author David Ladd <drencor-xeen@users.sf.net>
date Sun, 08 Feb 2015 17:44:00 -0600 (2015-02-08)
parents 17d43fd29ee2
children 594490949f0a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
1 ********************************************************************
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
2 * Boot - IDE Boot Module
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
3 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
4 * $Id$
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
5 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
7 * Comment
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
9 * ? 1994/06/25 Alan DeKok
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
10 * Diassembled.
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
11 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
12 * 6 1999/08/17 Paul T. Barton
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
13 * Redone for IDE.
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
14 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
15 * 7 2002/06/27 Boisy G. Pitre
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
16 * Added use of LSN bits 23-16.
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
17 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
18 * 7r1 2004/05/12 Boisy G. Pitre
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
19 * Optimized, made toG wait on !BUSY and DRDY, added slowdown POKE
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
20 * for Fujitsu 128MB CF (may be temporary)
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
21 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
22 * 8 2004/07/29 Boisy G. Pitre
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
23 * Now detects CHS/LBA mode to work with ALL IDE drives.
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
24 *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
25 * 9 2005/10/13 Boisy G. Pitre
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
26 * Support for fragmented bootfiles added.
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
27
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
28 NAM Boot
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
29 TTL IDE Boot Module
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
30
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
31 IFP1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
32 USE defsfile
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
33 USE ide.d
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
34 ENDC
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
35
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
36 tylg SET Systm+Objct
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
37 atrv SET ReEnt+rev
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
38 rev SET $00
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
39 edition SET 9
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
40
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
41 * Disassembled 94/06/25 11:37:47 by Alan DeKok
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
42 * ReDone by Paul T. Barton 99/08/17, for IDE
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
43
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
44 MOD eom,name,tylg,atrv,start,size
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
45
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
46 * on-stack static storage
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
47 ORG 0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
48 cyls RMB 2
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
49 sides RMB 1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
50 sects RMB 2
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
51 mode RMB 1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
52 seglist RMB 2 pointer to segment list
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
53 blockloc RMB 2 pointer to memory requested
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
54 blockimg RMB 2 duplicate of the above
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
55 bootloc RMB 3 sector pointer; not byte pointer
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
56 bootsize RMB 2 size in bytes
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
57 LSN0Ptr RMB 2 LSN0 pointer (used by boot_common.asm)
3063
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
58 IFDEF DEBLOCK
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
59 HalfSect RMB 1
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
60 ENDC
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
61 size EQU .
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
62
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
63 name FCS /Boot/
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
64 FCB edition
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
65
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
66 * Common booter-required defines
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
67 LSN24BIT EQU 1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
68 FLOPPY EQU 0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
69
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
70 USE boot_common.asm
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
71
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
72 * HWInit - Initialize the device
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
73 * Entry: Y = hardware address
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
74 * Exit: Carry Clear = OK, Set = Error
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
75 * B = error (Carry Set)
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
76 HWInit ldb Address+2,pcr
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
77 bne slave@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
78 lda #%10100000
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
79 FCB $8C
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
80 slave@ lda #%10110000
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
81 sta mode,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
82 stb DevHead,y select device
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
83 a@ tst Status,y wait for BSY to clear
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
84 bmi a@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
85 lda #$EC
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
86 sta Command,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
87 b@ tst Status,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
88 bmi b@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
89 * Harvest C/H/S values.
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
90 ldb DataReg,y ignore bytes 0-1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
91 ldb DataReg,y bytes 2-3 = no. of cylinders
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
92 lda Latch,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
93 std cyls,u save cylinders in our private static area
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
94 ldb DataReg,y ignore bytes 4-5
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
95 ldb DataReg,y bytes 6-7 = no. of heads
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
96 stb sides,u save sides on stack (B)
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
97 ldb DataReg,y ignore bytes 8-9
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
98 ldb DataReg,y ignore bytes 10-11
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
99 ldb DataReg,y bytes 12-13 = no. of sectors/track
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
100 lda Latch,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
101 std sects,u save sectors/track on stack (Y)
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
102 * Throw away the next 42 (48-7) words
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
103 ldb #43
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
104 l@ tst DataReg,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
105 lda Latch,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
106 decb
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
107 bne l@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
108 * A holds byte with LBA bit
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
109 anda #%00000010 LBA drive?
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
110 beq nope@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
111 ldb mode,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
112 orb #%01000000
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
113 stb mode,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
114 nope@ ldb #256-50
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
115 o@ tst DataReg,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
116 decb
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
117 bne o@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
118 HWTerm clrb
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
119 rts
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
120
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
121 * HWRead - Read a 256 byte sector from the device
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
122 * Entry: Y = hardware address
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
123 * B = bits 23-16 of LSN
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
124 * X = bits 15-0 of LSN
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
125 * blockloc,u = ptr to 256 byte sector
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
126 * Exit: X = ptr to data (i.e. ptr in blockloc,u)
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
127 HWRead
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
128 pshs x,b
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
129 b@ tst Status,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
130 bmi b@ if =1 then loop
3063
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
131 IFDEF DEBLOCK
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
132 clra clear A so we can hold half sector flag
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
133 lsr ,s ok shift the 3 bytes on stack that
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
134 ror 1,s hold LSN to the right to create a
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
135 ror 2,s divide by 2. Then put last bit in
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
136 rola A for use as the half sector flag
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
137 sta HalfSect,u then store the flag on the stack
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
138 ENDC
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
139 lda mode,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
140 sta DevHead,y 0L0d/0hhh device=CHS
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
141 r@ ldb Status,y is IDE ready for commands?
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
142 andb #BusyBit+DrdyBit ready ?
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
143 cmpb #DrdyBit
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
144 bne r@ loop until Drdy=1 and Busy=0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
145 ldb #$01 only one at a time
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
146 stb SectCnt,y only one at a time
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
147 anda #%01000000
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
148 beq chs@ branch if mode
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
149 lda ,s get bits 23-16
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
150 sta CylHigh,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
151 ldd 1,s get bits 15-0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
152 stb SectNum,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
153 sta CylLow,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
154 bra DoCmd
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
155 chs@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
156 * Compute proper C:H:S value
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
157 lda sides,u get device's head
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
158 ldb sects+1,u and sector
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
159 mul multiply H*S
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
160 * Note, there is a chance here that if the product is zero, we could loop forever
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
161 * beq ZeroProd
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
162 pshs d save product of H*S
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
163 ldd 1+2,s get bits 15-0 of LSN
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
164 ldx #-1 start Y at -1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
165 inc 0+2,s increment physical sector
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
166 * Here we are doing physLSN/(H*S) to get cylinder for physLSN
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
167 a@ leax 1,x increment count to compensate
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
168 subd ,s subtract (H*S) from physLSN
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
169 bhs a@ if D>=0 then continue
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
170 dec 0+2,s decrement phys sector bits 23-16
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
171 bne a@ if not zero, continue divide
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
172 addd ,s++ add in (H*S) to make non-negative
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
173 pshs d X now holds cylinder, save D on stack
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
174 tfr x,d
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
175 exg a,b swap
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
176 std CylLow,y store computed cylinder in HW
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
177 puls d restore saved cylinder
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
178 * Now we will compute the sector/head value
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
179 ldx #-1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
180 c@ leax 1,x
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
181 subb sects+1,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
182 sbca #0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
183 bcc c@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
184 addb sects+1,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
185 incb add 1 to B, which is sector
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
186 stb SectNum,y store computed sector in HW
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
187 tfr x,d
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
188 orb DevHead,y OR in with value written earlier
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
189 stb DevHead,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
190 DoCmd lda #S$READ read one sector
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
191 sta Command,y finish process
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
192
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
193 Blk2 lda Status,y is IDE ready to send?
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
194 anda #DrqBit DRQ, data request
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
195 beq Blk2 loop while DRQ =0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
196
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
197 ldx blockloc,u
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
198 clr ,s
3063
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
199 IFDEF DEBLOCK
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
200 lda HalfSect,u load half sector flag
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
201 cmpa #$01 check to see which routine we
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
202 beq Blk2Lp need and branch to it.
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
203 ENDC
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
204 BlkLp
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
205 lda DataReg,y A <- IDE
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
206 ldb Latch,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
207 std ,x++ into RAM
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
208 inc ,s
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
209 bpl BlkLp go get the rest
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
210 b@ lda DataReg,y read remaining 256 bytes
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
211 dec ,s
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
212 bne b@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
213
3063
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
214 BlkEnx
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
215 leax -256,x
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
216 stx 1,s
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
217 lda Status,y check for error-bit
3063
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
218 clrb
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
219 puls b,x,pc
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
220
3063
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
221 IFDEF DEBLOCK
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
222 Blk2Lp
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
223 lda DataReg,y A <- IDE
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
224 inc ,s Here we toss out the
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
225 bpl Blk2Lp first 256 bytes of the sector
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
226 clr ,s
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
227 b2@
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
228 lda DataReg,y Now we read the second
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
229 ldb Latch,y half of the sector and put
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
230 std ,x++ into RAM
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
231 inc ,s
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
232 bpl b2@ go get the rest
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
233 bra BlkEnx
c0bb75b72339 updated boot_ide.asm with deblocking code to be built with -DDEBLOCK
David Ladd <drencor-xeen@users.sf.net>
parents: 2590
diff changeset
234 ENDC
2590
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
235
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
236 * ------------------------------------------
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
237
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
238 *Init
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
239 * pshs d,y
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
240 * ldy <Address,pcr
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
241 * bsr ChkBusy could be spinning up...
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
242 * lda #Diagnos hits all drives
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
243 * sta Command,y ./
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
244 * bsr ChkBusy wait 'til both done
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
245 * clrb no errors
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
246 * puls d,y,pc
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
247
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
248 * Entry: A = number to show
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
249 * Destroys D
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
250 *Num
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
251 * tfr a,b
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
252 * lsra
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
253 * lsra
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
254 * lsra
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
255 * lsra
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
256 * bsr x@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
257 * andb #$0F
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
258 * tfr b,a
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
259 *x@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
260 * adda #'0
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
261 * cmpa #'9
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
262 * ble s@
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
263 * adda #$7
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
264 *s@ jsr <D.BtBug
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
265 * rts
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
266
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
267 IFGT Level-1
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
268 Pad FILL $39,$1D0-3-2-1-*
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
269 ENDC
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
270
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
271 Address FDB SDAddr
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
272 WhchDriv FCB 0 Drive to use (0 = master, 1 = slave)
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
273
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
274
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
275 EMOD
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
276 eom EQU *
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
277 END
17d43fd29ee2 Integration of SuperDriver
boisy
parents:
diff changeset
278