source: hacks/xtide/xtidebios-patch.diff@ 98

Last change on this file since 98 was 74, checked in by bird, 10 years ago

xtide util hacking, included bios patch.

File size: 9.1 KB
RevLine 
[74]1Index: Src/Device/IDE/IdePioBlock.asm
2===================================================================
3--- Src/Device/IDE/IdePioBlock.asm (revision 588)
4+++ Src/Device/IDE/IdePioBlock.asm (working copy)
5@@ -76,6 +76,36 @@
6 rep insb
7 ret
8 %else ; 808x
9+ %ifdef USE_BIRD ; insane bird rollout
10+ push bx
11+.NextSector:
12+ pushf
13+ cli
14+ %if 0 ;; @todo 8086+ only, anyone at all? - does not seem to work...
15+ ; (nominal ticks / expected instruction fetch ticks / -<instr bytes consumed> +<added>
16+ ; 8088 - iAPX88 BOOK (Intel Order No. 210200-002)
17+ %rep 256 ; 8086 - iAPX 86,88 User Manual (Intel Order No. 210201-001), TASM Quick Ref v4
18+ in al, dx ; 8/+4/-1+1 8/+4/-1+2 1 byte Note! 8086 will only be empty half of the time here, but too
19+ xchg bx, ax ; 3/+1/-1+1 3/+1/-1+2 1 byte tired to calculate that now. Probably this comes out as
20+ in al, dx ; 8/+4/-1+1 8/--/-1 1 byte a 0 or 1 cycle win in reality...
21+ xchg bx, ax ; 3/+1/-1+1 3/+1/-1+2 1 byte
22+ mov ah, bl ; 2/+6/-2+2 2/+2/-2+2 2 bytes
23+ stosw ; 15/+4/-1+1 11/--/-1 1 byte
24+ %endrep ; sum 39/+20 =59 35/+12=47 7 bytes
25+ ; save -1/ -7 3/ -1 -3 bytes
26+ %else
27+ %rep 512
28+ in al, dx ; 8/+4/-1+1 8/+4/-1+2 1 byte
29+ stosb ; 11/+4/-1+4 11/--/-1 1 byte
30+ %endrep ; sum 19/+8 =26 19/+4=23 2 bytes
31+ %endif ; x2 38/+16 =52 38/+8=46 4 bytes
32+ popf
33+ dec cx
34+ jnz .NextSector
35+ pop bx
36+ ret
37+
38+ %else ; !USE_BIRD
39 UNROLL_SECTORS_IN_CX_TO_OWORDS
40 ALIGN JUMP_ALIGN
41 .ReadNextOword:
42@@ -85,6 +115,7 @@
43 %endrep
44 loop .ReadNextOword
45 ret
46+ %endif ; !USE_BIRD
47 %endif
48
49 %endif ; MODULE_8BIT_IDE
50@@ -112,6 +143,20 @@
51 ret
52
53 %else ; 808x
54+ %ifdef USE_BIRD ; insane bird rollout.
55+.NextSector:
56+ pushf
57+ cli
58+ %rep 256 ; WORDs
59+ in ax, dx ; Read WORD
60+ stosw ; Store WORD to [ES:DI]
61+ %endrep
62+ popf
63+ dec cx
64+ jnz .NextSector
65+ ret
66+
67+ %else ; !USE_BIRD
68 UNROLL_SECTORS_IN_CX_TO_OWORDS
69 ALIGN JUMP_ALIGN
70 .ReadNextOword:
71@@ -121,6 +166,7 @@
72 %endrep
73 loop .ReadNextOword
74 ret
75+ %endif ; !USE_BIRD
76 %endif
77
78
79@@ -220,6 +266,37 @@
80 ret
81
82 %else ; 808x
83+ %ifdef USE_BIRD ; crazy bird loop unrolling
84+ push ds
85+ push es
86+ pop ds
87+
88+.NextSector:
89+ pushf
90+ cli
91+ %if 1
92+ ; 8088 - iAPX88 BOOK (Intel Order No. 210200-002)
93+ %rep 256 ; 8086 - iAPX 86,88 User Manual (Intel Order No. 210201-001), TASM Quick Ref v4
94+ lodsw ; 16/+4/-1+1 12/+4|--/-1+2|+0 1 byte - Note! 8086 doesn't need instr fetch half of the time.
95+ out dx, al ; 8/+4/-1+1 8/-- /-1 1 byte
96+ mov al, ah ; 2/+10/-2+3 2/+6 /-2+4 2 bytes
97+ out dx, al ; 8/--/-1 8/-- /-1 1 byte
98+ %endrep ; sum 34/+18=52 30/+10|+6=40|36~=38 5 bytes
99+ ; save 6/ 4 10/ 8|12~=10 -1 byte
100+ %else
101+ %rep 512
102+ lodsb ; 12/+4/-1+1 12/+4/-1+2 1 byte
103+ out dx, al ; 8/+4/-1+1 8/--/-1 1 byte
104+ %endrep ; sum 20/+8 =28 20/+4 =24 2 bytes
105+ %endif ; x2 40/+16 =56 40/+8 =48 4 bytes
106+ popf
107+ dec cx
108+ jnz .NextSector
109+
110+ pop ds
111+ ret
112+
113+ %else ; !USE_BIRD
114 UNROLL_SECTORS_IN_CX_TO_QWORDS
115 push ds
116 push es
117@@ -233,6 +310,7 @@
118 loop .WriteNextQword
119 pop ds
120 ret
121+ %endif ; !USE_BIRD
122 %endif
123
124 %endif ; MODULE_8BIT_IDE
125@@ -259,6 +337,28 @@
126 ret
127
128 %else ; 808x
129+ %ifdef USE_BIRD ; crazy bird loop unrolling
130+ push bx
131+ push ds
132+ push es
133+ pop ds
134+
135+.NextSector:
136+ pushf
137+ cli
138+ %rep 256 ; WORDs
139+ lodsw ; Load WORD from [DS:SI]
140+ out dx, ax ; Write WORD
141+ %endrep
142+ popf
143+ dec cx
144+ jnz .NextSector
145+
146+ pop ds
147+ pop bx
148+ ret
149+
150+ %else ; !USE_BIRD
151 UNROLL_SECTORS_IN_CX_TO_QWORDS
152 push ds
153 push es
154@@ -272,6 +372,7 @@
155 loop .WriteNextQword
156 pop ds
157 ret
158+ %endif ; !USE_BIRD
159 %endif
160
161 ;--------------------------------------------------------------------
162Index: Src/Handlers/Int13h/AH9h_HInit.asm
163===================================================================
164--- Src/Handlers/Int13h/AH9h_HInit.asm (revision 588)
165+++ Src/Handlers/Int13h/AH9h_HInit.asm (working copy)
166@@ -175,6 +175,18 @@
167 .SupportedBlockSizeFound:
168
169
170+%if 0 ; bird
171+;;; InitializePioMode - disable IORDY and use default mode.
172+%if 0
173+ mov dl, PIO_DEFAULT_MODE_DISABLE_IORDY
174+%else
175+ mov dl, PIO_FLOW_CONTROL_MODE_xxx | 0
176+%endif
177+ mov si, FEATURE_SET_TRANSFER_MODE
178+ call AH23h_SetControllerFeatures
179+ STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_PIO_MODE
180+
181+%else ; !bird
182 %ifdef MODULE_ADVANCED_ATA
183 ;;; InitializePioMode
184 ; Initialize fastest supported PIO mode
185@@ -190,7 +202,9 @@
186 mov si, FEATURE_SET_TRANSFER_MODE
187 call AH23h_SetControllerFeatures
188 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_PIO_MODE
189+
190 %endif ; MODULE_ADVANCED_ATA
191+%endif ; !bird
192
193
194 %ifdef MODULE_POWER_MANAGEMENT
195Index: Src/Initialization/DetectDrives.asm
196===================================================================
197--- Src/Initialization/DetectDrives.asm (revision 588)
198+++ Src/Initialization/DetectDrives.asm (working copy)
199@@ -241,4 +241,29 @@
200 call CreateDPT_FromAtaInformation
201 jc SHORT DetectDrives_DriveNotFound
202 call DriveDetectInfo_CreateForHardDisk
203+%ifdef USE_BIRD
204+ call DetectPrint_DriveNameFromDrvDetectInfoInESBX
205+ call TestBufferXfers
206+ ret
207+%else ; !USE_BIRD
208 jmp SHORT DetectPrint_DriveNameFromDrvDetectInfoInESBX
209+%endif ; !USE_BIRD
210+
211+
212+%ifdef USE_BIRD
213+;--------------------------------------------------------------------
214+; TestBufferXfers
215+; Parameters:
216+; Returns:
217+; Nothing
218+; Corrupts registers:
219+;--------------------------------------------------------------------
220+TestBufferXfers:
221+ ;; @todo later. The idea is to write to the sector buffer, then read back
222+ ;; what we just wrote and check that the data is as expected. This would
223+ ;; help detect problems with the PIO Data Write, and in NO_ATAID_VALIDATION
224+ ;; mode, also with PIO Data Read. Preventing the user from totally screwing
225+ ;; up his CF card in the former case.
226+ ret
227+%endif
228+
229Index: makefile
230===================================================================
231--- makefile (revision 588)
232+++ makefile (working copy)
233@@ -40,6 +40,8 @@
234 # USE_386 Use instructions supported by 386 and later (defines USE_286) #
235 # USE_AT Use features supported on AT and later systems (not available on XT) #
236 # USE_UNDOC_INTEL Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s #
237+# USE_BIRD Bird stuff #
238+# USE_BIRD_8086 Use code sequences favoring 8086+ over 8088. #
239 # #
240 # ** AT Builds only (when USE_AT is defined) #
241 # *** Use this only when certain known good drives are not being detected (eg WD Caviars) #
242@@ -102,12 +104,13 @@
243 #################################################################
244 # Assembler preprocessor defines. #
245 #################################################################
246-DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER NO_ATAID_VALIDATION
247+#DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER NO_ATAID_VALIDATION
248+DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER
249 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
250
251-DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
252+DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED USE_BIRD USE_BIRD_8086
253 DEFINES_XTPLUS = $(DEFINES_XT) USE_186
254-DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA MODULE_COMPATIBLE_TABLES
255+DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA MODULE_COMPATIBLE_TABLES USE_BIRD USE_BIRD_8086
256
257 DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
258 DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
259@@ -126,6 +129,7 @@
260
261 # Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
262 BIOS_SIZE = 8192 # For BIOS header (use even multiplier!)
263+BIOS_SIZE = 12288 # For BIOS header (use even multiplier!)
264 ROMSIZE = $(BIOS_SIZE) # Size of binary to build when building with make checksum
265 BIOS_SIZE_LARGE = 12288
266 ROMSIZE_LARGE = $(BIOS_SIZE_LARGE)
Note: See TracBrowser for help on using the repository browser.