Skip to content

Commit fec4152

Browse files
committed
Initial commit
0 parents  commit fec4152

File tree

6 files changed

+282
-0
lines changed

6 files changed

+282
-0
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build OBJ file
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: karcherm/action-install-jw@v1.0
17+
with:
18+
jwasm: true
19+
- name: Assemble the patch
20+
run: jwasm -Zm -Fo274x-211.obj 274x-211.asm
21+
- uses: actions/upload-artifact@v2
22+
with:
23+
name: scsi_edd
24+
path: |
25+
274x-211.obj
26+
bios16k.map

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.obj
2+
*.lst
3+
*.bin

274x-211.asm

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
; Patch for Adaptec's 274x BIOS, Version 2.11 to add (rudimentary) EDD support.
2+
; SHA1 of expected input file: A0EC9AFE433549BB384E76A4167C2CB14BFE3FDA
3+
4+
; Copyright (C) 2021 Michael Karcher (the patch, not the original BIOS!)
5+
; This patch may be used and distributed according to the MIT License.
6+
7+
.286
8+
9+
BIOSFrame STRUC
10+
we_dont_care_1 db 4 dup (?)
11+
VDSFlags db ?
12+
we_dont_care_2 db 11 dup (?)
13+
CDBlen db ?
14+
we_dont_care_3 db 7 dup (?)
15+
CDBdata db 12 dup (?)
16+
we_dont_care_4 db 4 dup (?)
17+
TransferLenLow dw ?
18+
TransferLenHigh dw ?
19+
we_dont_care_5 db 8 dup (?)
20+
BIOSFlags dw ?
21+
we_dont_care_6 db 6 dup (?)
22+
CallerAX dw ?
23+
CallerBX dw ?
24+
CallerCX dw ?
25+
CallerDX dw ?
26+
CallerSI dw ?
27+
CallerDI dw ?
28+
CallerDS dw ?
29+
CallerES dw ?
30+
BIOSFrame ENDS
31+
32+
IsNoData = 8 ; Flag for execution unit that this is a "no data" command
33+
BF_IgnoreSeek = 80h
34+
35+
MAIN SEGMENT
36+
assume cs:MAIN
37+
38+
org 0BF4h
39+
ResetLocalState LABEL NEAR
40+
org 0C28h
41+
SetTarget LABEL NEAR
42+
org 0DE1h
43+
ExecuteCommand LABEL NEAR
44+
org 0E9Fh
45+
SetDataAddress LABEL NEAR
46+
47+
org 13ECh
48+
Func_Unsupported LABEL NEAR
49+
org 13EEh
50+
I13FinishWithAH LABEL NEAR
51+
52+
org 16F4h
53+
Func09_AlwaysOK LABEL NEAR
54+
55+
org 1224h + 12h * 2
56+
; remap functions 12..14 ("always OK") to function 09 ("always OK")
57+
; this frees up 13E4..13E8
58+
dw OFFSET Func09_AlwaysOK
59+
dw OFFSET Func09_AlwaysOK
60+
dw OFFSET Func09_AlwaysOK
61+
62+
org 1224h
63+
Int13_Dispatch LABEL WORD
64+
65+
org 13BCh
66+
mov al, BYTE PTR [bp+CallerAX+1] ; originaly whole word to AX
67+
;mov bx, [bp+CallerBX] ; superflous, BX is already set
68+
mov cx, [bp+CallerCX]
69+
mov dx, [bp+CallerDX]
70+
push 40h
71+
pop ds
72+
cbw
73+
mov di, ax
74+
shl di, 1
75+
cmp al, 15h
76+
ja short MaybeI13E
77+
mov ax, [bp+CallerAX]
78+
jmp cs:[di + Int13_Dispatch]
79+
MaybeI13E:
80+
sub al, 41h
81+
cmp al, 7
82+
ja Func_Unsupported
83+
mov es, [bp+CallerDS]
84+
jmp cs:[di - 41h*2 + Int13E_Dispatch]
85+
86+
org 0B4Bh
87+
Int13E_Dispatch LABEL WORD
88+
dw OFFSET I13E_checkpresence ; 41h
89+
dw OFFSET I13E_read ; 42h
90+
dw OFFSET I13E_write ; 43h
91+
dw OFFSET I13E_verify ; 44h
92+
dw OFFSET Func_Unsupported ; 45h (lock/unlock)
93+
dw OFFSET Func_Unsupported ; 46h (eject)
94+
dw OFFSET I13E_seek ; 47h
95+
dw OFFSET I13E_params ; 48h
96+
I13E_checkpresence:
97+
mov [bp+CallerBX], 0AA55h ; extensions present
98+
mov byte ptr [bp+CallerAX + 1], 01h ; version 1.x
99+
mov [bp+CallerCX], 1 ; support LBA disk calls only
100+
jmp Func09_AlwaysOK
101+
102+
I13E_params:
103+
mov di, si
104+
mov ax, 1Ah
105+
cmp es:[word ptr di], ax
106+
jnb go_on
107+
jmp Func_Unsupported
108+
go_on:
109+
stosw
110+
mov ax, 1 ; No 64K DMA limit, no CHS info
111+
stosw
112+
dec ax
113+
mov cx, 6
114+
rep stosw ; clear CHS fields (not reporting them)
115+
push es
116+
push di
117+
call ResetLocalState
118+
call SetTarget
119+
mov [bp+CDBdata], 25h ; SCSI read capacity
120+
mov [bp+CDBlen], 0Ah
121+
mov [bp+TransferLenLow], 8
122+
mov [bp+TransferLenHigh], 0
123+
and [bp+VDSFlags], not IsNoData
124+
pop bx ; address of LBA count.
125+
; if the command succeeds, the low 32 bits are set to the
126+
; capacity of the drive (-1), the high 32 bits are the sector size.
127+
; it's big endian, though :(
128+
push bx
129+
call SetDataAddress
130+
call ExecuteCommand
131+
pop di
132+
pop es
133+
push ax
134+
mov ax, es:[di]
135+
xchg ah, al
136+
xchg ax, es:[di+2]
137+
xchg ah, al
138+
add ax, 1 ; from max_lba to sector count
139+
mov es:[di], ax
140+
adc es:[word ptr di+2], 0
141+
add di, 4
142+
143+
xor ax, ax
144+
stosw ; high 32 bit of max LBA
145+
stosw
146+
mov ax, 200h ; sector size
147+
stosw
148+
pop ax
149+
jmp I13FinishWithAH
150+
151+
org 184Ah
152+
I13E_common:
153+
sbb dx,dx
154+
call ResetLocalState
155+
or [bp+VDSFlags], ch
156+
mov [bp+CDBdata], cl
157+
mov [bp+CDBlen], 0Ah
158+
mov ax, es:[si+2]
159+
and dx, ax
160+
xchg dh, dl
161+
mov word ptr [bp+CDBdata + 7], dx ; length to target
162+
add ax, ax
163+
mov word ptr [bp+TransferLenLow + 1], ax ; transfer length
164+
; set LBA (bswapping it)
165+
mov ax, es:[si+8]
166+
xchg ah, al
167+
mov word ptr [bp+CDBdata + 4], ax
168+
mov ax, es:[si+10]
169+
xchg ah, al
170+
mov word ptr [bp+CDBdata + 2], ax
171+
test [bp+VDSFlags], IsNoData
172+
jnz no_data
173+
les bx, es:[si+4]
174+
call SetDataAddress
175+
no_data:
176+
call ExecuteCommand
177+
cmp ah, 1 ; unsupported command
178+
jne usual_case
179+
test [bp+VDSFlags], IsNoData
180+
jz usual_case
181+
return_ok:
182+
mov ah, 0 ; non-data command: verify or seek; deemed optional
183+
; remap "unsupported" to OK
184+
usual_case:
185+
jmp I13FinishWithAH
186+
187+
188+
I13E_read:
189+
mov cx, 0028h
190+
stc
191+
jmp I13E_common
192+
I13E_write:
193+
mov cx, 002Ah
194+
stc
195+
jmp I13E_common
196+
I13E_verify:
197+
mov cx, 082Fh
198+
stc
199+
jmp I13E_common
200+
I13E_seek:
201+
test byte ptr [bp+BIOSFlags], BF_IgnoreSeek ; TEST always clears CF
202+
jnz return_ok
203+
mov cx, 082Bh
204+
jmp I13E_common
205+
206+
org 18D8h
207+
db "EDD 1.0"
208+
209+
MAIN ENDS
210+
END

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Michael Karcher
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Int13 Extension support for Adaptec BIOSes
2+
==========================================
3+
4+
How to use it
5+
-------------
6+
7+
This repository contains patches for Adaptec SCSI BIOSes (currently only the 2740, more to come) 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.
8+
9+
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.
10+
11+
To apply an object file as patch, my tool [omfpatch|https://github.com/karcherm/omfpatch] can be used. [Release 1.1|https://github.com/karcherm/omfpatch/releases/tag/v1.1] is known to work with this patch. You can choose to download either the DOS or the Win32 version of omfpatch depending on the system you want to use to apply the patch. 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`.
12+
13+
You can run `omfpatch 274x-211.bin bios16k.map 274x-211.obj` to create a patched BIOS image.
14+
15+
The patched BIOS identifies itself as "2.11 EDD 1.0" instead of just "2.11 Release" to indicate the *extended disk drive* specification.
16+
17+
Disclaimer
18+
----------
19+
20+
If you patch your BIOS and something goes wrong, the computer may become unbootable. It is recommended that you have a way to recover your BIOS, like an external flasher connected to a different computer. Make a backup of your BIOS before your install a patched BIOS.

bios16k.map

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MAIN 0 0 0x3FFF
2+
!CHKSUM SUM8 0 0x3FFF 0x3FFF

0 commit comments

Comments
 (0)