Skip to content

Commit 406005c

Browse files
committed
Add patch for ASPI7DOS.SYS
1 parent 886fe7c commit 406005c

File tree

4 files changed

+278
-1
lines changed

4 files changed

+278
-1
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ jobs:
2020
run: |
2121
jwasm -Zm -Fo274x-211.obj 274x-211.asm
2222
jwasm -Zm -Fo284x-101.obj 284x-101.asm
23+
jwasm -Zm -Foa7-142.obj a7-142.asm
2324
- uses: actions/upload-artifact@v2
2425
with:
2526
name: scsi_edd
2627
path: |
2728
274x-211.obj
2829
284x-101.obj
30+
a7-142.obj
2931
bios16k.map
3032
bios1632.map
33+
a7-142.map

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Int13 Extension support for Adaptec BIOSes
44
How to use it
55
-------------
66

7-
This repository contains patches for Adaptec SCSI BIOSes (currently for the 2740 and 2840) to support the Phoenix/Microsoft Int13 extensions used to access hard disks above 8GB in LBA mode. To avoid potential copyright problems, this repository does not contain the actual Adaptec BIOSes. Instead, this repository contains an assembler source code file that generates an object file that contains only the locations that need to be overwritten to add Int 13 extension support to the respective BIOS images.
7+
This repository contains patches for Adaptec SCSI BIOSes and ASPI drivers (currently for the 2740 and 2840) to support the Phoenix/Microsoft Int13 extensions used to access hard disks above 8GB in LBA mode. To avoid potential copyright problems, this repository does not contain the actual Adaptec code. Instead, this repository contains an assembler source code file that generates an object file that contains only the locations that need to be overwritten to add Int 13 extension support to the respective files.
88

99
To apply the patch, you need the assembled form of the patch, which can be generated using MASM or a compatible assembler like Borland's TASM or JWASM. This patch has been tested to assemble correctly on both TASM and JWASM, even though TASM produces a different output because TASM defaults to single-pass mode and the patch contains a non-annotated short forward jump. Both assembled versions are functionally identical. You can also just download the latest GitHub release which includes an assembled object file.
1010

@@ -17,6 +17,12 @@ Controller | Version | patch object | map file | ROM chip size
1717
AHA-274x | 2.11 | 274x-211.obj | bios16k.map | 32KB (256kBit)
1818
AHA-284x | 1.01 | 284x-101.obj | bios1632.map | 64KB (512kBit)
1919

20+
Furthermore, a patch for the following ASPI driver is included
21+
22+
Driver | Version | patch object | map file | file size
23+
-------------|---------|--------------|------------|------------
24+
ASPI7DOS.SYS | 1.42 | a7-142.obj | a7-142.map | 36160 bytes
25+
2026
Note that the latest 274x BIOS (2.11) seems to not be available for download from the Adaptec / MicroSemi. Their page has version 2.10. This patch *does not apply to version 2.10*. You can obtain the ROM image by reading it from an controller that has the latest version. The ROM chip is an OTP chip labelled `549306-00 D BIOS 7D00 (c) 1993`.
2127

2228
You can run `omfpatch 274x-211.bin bios16k.map 274x-211.obj` to create a patched BIOS image for the 2740.

a7-142.asm

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
; Patch for ASPI7DOS.SYS, Version 1.42
2+
3+
; Copyright (C) 2021 Michael Karcher (the patch, not the ASPI driver itself)
4+
; This patch may be used and distributed according to the MIT License.
5+
6+
.386 ; ASPI7DOS already contains 386 stuff, so allow it for the patch, too
7+
8+
BIOSDriveInfo STRUC
9+
BD_IsMyDrive db ?
10+
BD_TargetID db ?
11+
BD_BusID db ?
12+
BD_GeometryCX dw ?
13+
BD_MaxLBA dd ?
14+
BD_drive_type db ?
15+
BD_GeometryDH db ?
16+
BIOSDriveInfo ENDS
17+
18+
ASPI_CDBRequest STRUC
19+
ASPI_FunctionNr db ?
20+
ASPI_StatusCode db ?
21+
ASPI_HbaID db ?
22+
ASPI_ReqFlags db ?
23+
ASPI_Rsvd dd ?
24+
ASPI_TargetID db ?
25+
ASPI_Lun db ?
26+
ASPI_DataLen dd ?
27+
ASPI_SenseLen db ?
28+
ASPI_DataBufferPtr dd ?
29+
ASPI_NextReq dd ?
30+
ASPI_cdblen db ?
31+
ASPI_HaStatus db ?
32+
ASPI_DevStatus db ?
33+
ASPI_PostFunction dd ?
34+
ASPI_PostDS dw ?
35+
ASPI_SRBPtr dd ?
36+
ASPI_Rsvd2 dw ?
37+
ASPI_SRBPhysical dd ?
38+
ASPI_Rsvd3 db 22 dup (?)
39+
ASPI_CDBdata db 10 dup (?)
40+
ASPI_CDBRequest ENDS
41+
42+
EDDData STRUC
43+
EDDData_rqsize dw ?
44+
EDDData_count dw ?
45+
EDDData_ptr dd ?
46+
EDDData_LBAlow dd ?
47+
EDDData_LBAhigh dd ?
48+
EDDData ENDS
49+
50+
CallerES = 2
51+
CallerDS = 4
52+
CallerDI = 6
53+
CallerSI = 8
54+
CallerDX = 10
55+
CallerCX = 12
56+
CallerBX = 14
57+
58+
DRIVER SEGMENT USE16
59+
assume cs:DRIVER
60+
org 48FAh
61+
I13R_CurrentDrive LABEL WORD
62+
org 48FDh
63+
I13R_Flags LABEL BYTE
64+
org 4900h
65+
I13R_ASPICall LABEL ASPI_CDBRequest
66+
org 4ACAh
67+
I13_9_OK LABEL NEAR
68+
org 4BABh
69+
I13_Unhandled LABEL NEAR
70+
org 4BB0h
71+
I13_OutWithAHAndCarry LABEL NEAR
72+
org 4C10h
73+
I13R_ExecuteRequest LABEL NEAR
74+
org 4C81h
75+
I13R_DoneCallback LABEL NEAR
76+
org 4CEBh
77+
I13R_SetStatus LABEL NEAR
78+
79+
; branch out before clobbering SI and DS
80+
org 4994h
81+
cmp ah, 20h
82+
jbe SHORT I13_Classic
83+
jmp MaybeI13E
84+
I13_Classic:
85+
mov si, cs
86+
mov ds, si
87+
88+
org 458Ah
89+
; Big hole. It seems Adaptec reserved space for 88 BIOSDriveInfo
90+
; structures instead of just 8 BIOSDriveInfo structures. So there
91+
; are 80 superflous structures, i.e. 880 bytes.
92+
Int13E_Dispatch LABEL WORD
93+
dw OFFSET I13E_checkpresence ; 41h
94+
dw OFFSET I13E_read ; 42h
95+
dw OFFSET I13E_write ; 43h
96+
dw OFFSET I13E_verify ; 44h
97+
dw OFFSET I13_Unhandled ; 45h (lock/unlock)
98+
dw OFFSET I13_Unhandled ; 46h (eject)
99+
dw OFFSET I13E_seek ; 47h
100+
dw OFFSET I13E_params ; 48h
101+
102+
MaybeI13E:
103+
sub ah, 41h
104+
cmp ah, 7
105+
ja I13_Unhandled
106+
push ax
107+
mov al,ah
108+
mov ah,0
109+
add ax,ax
110+
mov di,ax
111+
pop ax
112+
jmp cs:[di + Int13E_Dispatch]
113+
114+
I13E_checkpresence:
115+
push bp
116+
mov bp, sp
117+
mov word ptr [bp+CallerBX], 0AA55h ; extensions present
118+
mov ah, 01h ; version 1.x
119+
mov word ptr [bp+CallerCX], 1 ; support LBA disk calls only
120+
pop bp
121+
jmp I13_OutWithAHandCarry
122+
123+
I13E_params:
124+
mov di, si
125+
push ds
126+
pop es
127+
mov ax, 1Ah
128+
cmp word ptr [di], ax
129+
jnb go_on
130+
jmp I13_Unhandled
131+
go_on:
132+
stosw
133+
mov ax, 1 ; No 64K DMA limit, no CHS info
134+
stosw
135+
dec ax
136+
mov cx, 6
137+
rep stosw ; clear CHS fields (not reporting them)
138+
139+
push eax
140+
mov eax,0
141+
mov dl,8
142+
mov cx,ax
143+
mov bx,925h
144+
push es
145+
push di
146+
clc
147+
call MyCDBExecute
148+
pop di
149+
pop es
150+
pop eax
151+
mov eax, es:[di]
152+
xchg ah,al
153+
rol eax,16
154+
xchg ah,al
155+
inc eax
156+
stosd
157+
158+
xor ax, ax
159+
stosw ; high 32 bit of max LBA
160+
stosw
161+
mov ax, 200h ; sector size
162+
stosw
163+
jmp I13_9_OK
164+
165+
I13E_read:
166+
mov bx, 928h
167+
jmp SHORT I13E_rwcommon
168+
I13E_write:
169+
mov bx, 112Ah
170+
I13E_rwcommon:
171+
stc
172+
push eax
173+
call I13E_core
174+
pop eax
175+
jmp I13_OutWithAHandCarry
176+
177+
I13E_verify:
178+
mov bx, 12Fh
179+
stc
180+
push eax
181+
call I13E_core
182+
pop eax
183+
kill_bad_fn:
184+
jnc SHORT verify_done
185+
cmp ah, 1
186+
jne SHORT verify_done
187+
; no fake verify yet.
188+
; verify might very well be above 64KB, so Adaptecs idea to
189+
; "read over the F000 segment" will fail
190+
is_ok:
191+
mov ah, 0
192+
clc
193+
verify_done:
194+
jmp I13_OutWithAHandCarry
195+
196+
I13E_seek:
197+
test [I13R_flags], 1 ; implies CLC
198+
jnz is_ok ; ignore seek
199+
mov bx, 12Bh
200+
push eax
201+
call I13E_core
202+
pop eax
203+
jmp kill_bad_fn ; MUST change this when fake verify gets
204+
; implemented
205+
206+
I13E_core PROC NEAR
207+
mov eax, [si+EDDData_LBAlow]
208+
mov dl, 0
209+
mov cx, word ptr [si+EDDData_Count]
210+
les di, [si+EDDData_Ptr]
211+
212+
MyCDBExecute LABEL NEAR
213+
push ds
214+
push si
215+
push cs
216+
pop ds
217+
ASSUME ds:DRIVER
218+
mov si, OFFSET I13R_ASPICall
219+
mov word ptr [si+ASPI_DataBufferPtr], di
220+
mov word ptr [si+ASPI_DataBufferPtr+2], es
221+
222+
sbb di, di ; CF set on entry: allow length
223+
and di, cx
224+
xchg di, cx
225+
add di, di ; sector count to 256-byte-count
226+
mov byte ptr [si+ASPI_DataLen], dl
227+
mov word ptr [si+ASPI_DataLen+1], di
228+
mov byte ptr [si+ASPI_DataLen+3], 0
229+
xchg ah,al
230+
ror eax,16
231+
xchg ah,al
232+
mov dword ptr [si+ASPI_CDBdata+2], eax
233+
xchg ch,cl
234+
mov word ptr [si+ASPI_CDBdata+7], cx
235+
mov [si+ASPI_FunctionNr], 2
236+
mov [si+ASPI_ReqFlags], bh
237+
mov [si+ASPI_CDBlen], 10
238+
mov [si+ASPI_SenseLen], 14
239+
mov [si+ASPI_CDBdata], bl
240+
mov [si+ASPI_CDBdata+1], 0
241+
mov [si+ASPI_CDBdata+6], 0
242+
mov [si+ASPI_CDBdata+9], 0
243+
mov word ptr [si+ASPI_PostFunction], OFFSET I13R_DoneCallback
244+
mov word ptr [si+ASPI_PostFunction+2], cs
245+
246+
mov bx, [I13R_CurrentDrive]
247+
mov al, [bx+BD_TargetID]
248+
mov [si+ASPI_TargetID], al
249+
mov al, [bx+BD_BusID]
250+
mov [si+ASPI_HbaID], al
251+
mov [si+ASPI_LUN], 0
252+
253+
call I13R_ExecuteRequest
254+
call I13R_SetStatus
255+
pop si
256+
pop ds
257+
ret
258+
I13E_core ENDP
259+
260+
org 53h
261+
;db "Version 1.42"
262+
db "V1.42+EDD1.0"
263+
org 4FB5h
264+
db "V1.42+EDD1.0"
265+
266+
DRIVER ENDS
267+
END

a7-142.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DRIVER 0 0 36160

0 commit comments

Comments
 (0)