📄 xdma.lst
字号:
1 ;
2 ; XDMA.ASM Written 15-Feb-2006 by Jack R. Ellis.
3 ;
4 ; XDMA is free software. You can redistribute and/or modify it, under
5 ; the terms of the GNU General Public License (hereafter called GPL) as
6 ; published by the Free Software Foundation, either version 2 of GPL or
7 ; any later versions, at your option. XDMA is distributed in the hope
8 ; that it will be useful, but WITHOUT ANY WARRANTY and without even the
9 ; implied warranties of MERCHANTABILITY nor of FITNESS FOR A PARTICULAR
10 ; PURPOSE! See the GPL for details. You should have received a copy
11 ; of the GPL with your XDMA files. If not, write to the Free Software
12 ; Foundation Inc., 59 Temple Place Ste. 330, Boston, MA 02111-1307 USA.
13 ; http://www.gnu.org/licenses/
14 ;
15 ; This is a DOS driver for UltraDMA hard-disks on PC motherboards using
16 ; a VIA VT8235 or similar chipset. On loading, the driver finds which
17 ; IDE drives are UltraDMA hard-disks and will run all such disks. Any
18 ; UltraDMA disks may be used. LBA and CHS mode requests are accepted.
19 ; "Read/Write Extended" DMA commands are issued for disk addresses over
20 ; 28 bits and require ATA-6 or newer hard-disks. Disk addresses of 28
21 ; bits or less use normal DMA commands. The driver handles BIOS Int13
22 ; read or write requests only. Other Int13 requests (including seeks)
23 ; and I-O requests having bad parameters are "passed" back to the BIOS.
24 ; If an input buffer is not 32-bit aligned, crosses a 64K DMA boundary,
25 ; or fails VDS "lock", data will go through an XMS memory buffer, using
26 ; UltraDMA to/from the buffer. HIMEM.SYS or a similar XMS manager and
27 ; 128K of XMS memory are required for use. XDMA offers output overlap
28 ; which buffers ALL output and does NOT await output end, so user tasks
29 ; may "overlap" DMA! On output errors or if a 400-msec timer expires,
30 ; an error message is displayed. Overlap must be enabled using the /O
31 ; switch (see below). Overlap requires that each IDE channel must NOT
32 ; run an UltraDMA disk and a non-UltraDMA or ATAPI drive (CD-ROM etc.)!
33 ; Other drivers are unaware XDMA leaves output "running" and could post
34 ; controller-busy ERRORS! NOTE: The XCDROM driver DOES support using
35 ; an UltraDMA disk and a CD-ROM drive on the same IDE channel!
36 ;
37 ; XDMA switch options are as follows:
38 ;
39 ; /O Enables output overlap.
40 ;
41 ; /L Limits DMA to "low memory" below 640K. /L is REQUIRED to use
42 ; UMBPCI or any similar driver whose upper-memory areas do not
43 ; allow DMA. If /L is used, the driver must be in LOW memory
44 ; so DMA command-lists are fetched properly, or driver loading
45 ; will ABORT! /L causes I-O requests past 640K to go through
46 ; the driver's XMS buffer.
47 ;
48 ; /Q Suppresses the "beep" on output-overlap errors ("quiet" mode).
49 ;
50 ; For each switch, a dash may replace the slash, and lower-case letters
51 ; may be used.
52 ;
53 ; On exit from successful I-O requests, the AH-register is zero and the
54 ; carry flag is reset. If an error occurs, the carry flag is SET, and
55 ; the AH-register has one of the following codes:
56 ;
57 ; Code 08h - DMA timed out.
58 ; 0Fh - DMA error.
59 ; 20h - Controller busy before I-O.
60 ; 21h - Controller busy after I-O.
61 ; AAh - Disk not ready before I-O.
62 ; ABh - Disk not ready after I-O.
63 ; CCh - Disk FAULT before I-O.
64 ; CDh - Disk FAULT after I-O.
65 ; E0h - Hard error at I-O end.
66 ; FFh - XMS memory error.
67 ;
68 ; When output overlap is enabled, run-time output errors will cause the
69 ; following message to display, accompanied by a short "beep" sound:
70 ;
71 ; XDMA Error eeh, Disk=d LBA=aaaaaaaaaaaah!
72 ;
73 ; where eeh is one of the error codes shown above, d is the disk number
74 ; (0 if primary-master, 1 if primary-slave, 2 if secondary-master, or 3
75 ; if secondary-slave) and aaaaaaaaaaaah shows the starting disk address
76 ; expressed as a 12-digit "logical block address" (LBA).
77 ;
78 ;
79 ; Revision History:
80 ; ----------------
81 ; V3.3 15-Feb-06 JRE Deleted /B /M /N /S switches. XDMAJR dis-
82 ; continued (XDMA is now under 2.5K bytes).
83 ; V3.2 31-Jan-06 JRE Deleted init "Set Mode" commands to prevent
84 ; conflicts. NO run-time changes.
85 ; V3.1 26-Dec-05 JRE XDMA with overlap is now named "XDMA1$", so
86 ; other drivers can call "OCheck". Minor
87 ; XDMA/XDMAJR updates. NO size changes.
88 ; V3.0 15-Dec-05 JRE XDMA/XDMAJR now set "XDMA_$" names (overlap
89 ; XDMA sets "XDMA$$") to confirm controller
90 ; address valid.
91 ; V2.9 14-Dec-05 JRE XDMA output overlap "re-entry" logic fixed.
92 ; No change to non-overlap XDMA nor XDMAJR.
93 ; V2.8 27-Nov-05 JRE XDMA and XDMAJR "Internationalized"! Init
94 ; messages are now a separate file; default
95 ; is XDMAMSGS.ENG, which has full details.
96 ; V2.7 24-Nov-05 JRE XDMA output-overlap posts IDE channel busy/
97 ; overlap flags, so overlap WILL work using
98 ; other IDE drivers that test XDMA's flags!
99 ; NO changes to XDMAJR or non-overlap XDMA.
100 ; V2.6 17-Nov-05 JRE XDMA/XDMAJR now have a /N switch to request
101 ; NO local-stack. XDMA.ASM now assembles
102 ; EITHER driver! DRQ-timeout replaced by
103 ; DMA-timeout code in error handling logic.
104 ; V2.5 10-Nov-05 JRE Re-added /B /S and "DMA only" mode to XDMA.
105 ; Re-added /S to XDMAJR. But for no read
106 ; tests XDMA/XDMAJR now equal UDMA2/UDMA2S!
107 ; V2.4 5-Nov-05 JRE README.TXT updated with "advisory" RULES on
108 ; UMBPCI use. Minor XDMA/XDMAJR changes.
109 ; V2.3 2-Nov-05 JRE Many XDMA/XDMAJR improvements (see README).
110 ; XDMAJR upgraded with all but overlap.
111 ; V2.2 23-Oct-05 JRE Fixed stack-switching error in XDMA/XDMAJR.
112 ; V2.1 21-Oct-05 JRE Fixed XDMA /M error. No changes to XDMAJR.
113 ; V2.0 15-Oct-05 JRE XDMA smaller, re-added XDMAJR disk "names".
114 ; V1.9 10-Oct-05 JRE Fixed XDMAJR "no-disks" error. Other minor
115 ; items to improve subroutine reliability.
116 ; V1.8 2-Oct-05 JRE Re-added 80386+ check, fixed EDD disk scan.
117 ; V1.7 24-Sep-05 JRE Re-added "hardware only" disk scan in XDMA,
118 ; for IBM ThinkPad etc.; no XDMAJR changes.
119 ; V1.6 15-Sep-05 JRE NASM sources; fixed XDMAJR LBA-mode errors.
120 ; V1.5 22-Aug-05 JRE Added small/simple XDMAJR; no XDMA changes.
121 ; V1.4 18-Aug-05 JRE Fixed ES-reg. error, minimized "init" code.
122 ; V1.3 3-Aug-05 JRE Added David Muller's ALi class-code and 30-
123 ; byte EDD BIOS changes. THANK YOU, David!
124 ; V1.2 30-Jun-05 JRE Fixed "forward code-modification" errors.
125 ; V1.1 18-Jun-05 JRE Simpler README file; added version number.
126 ; V1.0 15-Jun-05 JRE Original issue.
127 ;
128 ;
129 ; General Program Equations.
130 ;
131 %define VER ' V3.3, 2-15-2006'
132 BSTACK equ 304 ;"Basic" driver local-stack length.
133 OSTACK equ 348 ;Overlap driver local-stack length.
134 RDYTO equ 008h ;389-msec minimum I-O timeout.
135 BIOSTMR equ 0046Ch ;BIOS "tick" timer address.
136 HDISKS equ 00475h ;BIOS hard-disk count address.
137 VDSFLAG equ 0047Bh ;BIOS "Virtual DMA" flag address.
138 CR equ 00Dh ;ASCII carriage-return.
139 LF equ 00Ah ;ASCII line-feed.
140 ;
141 ; Driver Return Codes.
142 ;
143 DMATIMO equ 0E8h ;DMA timeout code, 008h at exit.
144 DMAERR equ 0EFh ;DMA error code, 00Fh at exit.
145 CTLRERR equ 000h ;Ctlr. busy code, 020h/021h at exit.
146 DISKERR equ 08Ah ;Disk-busy code, 0AAh/0ABh at exit.
147 FAULTED equ 0ACh ;Disk FAULT code, 0CCh/0CDh at exit.
148 HARDERR equ 0BFh ;Hard-error code, 0E0H at exit.
149 XMSERR equ 0FFh ;XMS memory-error code.
150 ;
151 ; IDE Controller Register Definitions.
152 ;
153 CDATA equ 001F0h ;Data port.
154 CSECCT equ CDATA+2 ;I-O sector count.
155 CDSEL equ CDATA+6 ;Disk-select and upper LBA.
156 CCMD equ CDATA+7 ;Command register.
157 CSTAT equ CDATA+7 ;Primary status register.
158 CSTAT2 equ CDATA+206h ;Alternate status register.
159 ;
160 ; Controller Status and Command Definitions.
161 ;
162 BSY equ 080h ;IDE controller is busy.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -