…Show last 280 lines
61clear_loc_1MB:
62 mov es:[ebx], eax
63 add ebx, 4
64 loop clear_loc_1MB, ecx
65 mov al, 0ABh
66 out 84h, al
67 mov ebx, 180000h
68 mov ecx, edx
69 shl ecx, 2
70 mov al, 0FFh
71
72validate_cache_ffh:
73 mov es:[ebx], al
74 cmp es:[ebx], al
75 jnz no_cache_detected
76 inc ebx
77 loop validate_cache_ffh, ecx
78 mov al, 0A1h
79 out 84h, al
80 mov ebx, 180000h
81 mov eax, ebx
82 mov ecx, edx
83
84fill_range_180000h:
85 mov es:[ebx], eax
86 add ebx, 4
87 mov eax, ebx
88 loop fill_range_180000h, ecx
89 mov al, 0A2h
90 out 84h, al
91 mov ebx, 180000h
92 mov ecx, edx
93 mov edi, ebx
94
95validate_cache_180000h:
96 mov eax, es:[ebx]
97 cmp eax, edi
98 jnz no_cache_detected
99 add ebx, 4
100 add edi, 4
101 loop validate_cache_180000h, ecx
102 mov al, 0A3h
103 out 84h, al
104 mov ebx, 180000h
105 mov ecx, edx
106 shl ecx, 2
107 mov al, 55h
108
109fill_range_55h:
110 mov es:[ebx], al
111 inc ebx
112 loop fill_range_55h, ecx
113 mov al, 0A4h
114 out 84h, al
115 mov ebx, 180000h
116 mov ecx, edx
117 shl ecx, 2
118
119validate_cache_55h:
120 mov al, es:[ebx]
121 cmp al, 55h
122 jnz short no_cache_detected
123 inc ebx
124 loop validate_cache_55h, ecx
125 mov al, 0A5h
126 out 84h, al
127 mov ebx, 180000h
128 mov ecx, edx
129 shl ecx, 2
130 mov al, 0AAh
131
132fill_range_AAh:
133 mov es:[ebx], al
134 inc ebx
135 loop fill_range_AAh, ecx
136 mov al, 0A6h
137 out 84h, al
138 mov ebx, 180000h
139 mov ecx, edx
140 shl ecx, 2
141
142validate_cache_AAh:
143 mov al, es:[ebx]
144 cmp al, 0AAh
145 jnz short no_cache_detected
146 inc ebx
147 loop validate_cache_AAh, ecx
148
149 mov ebx, 262144
150 mov cl, 110b
151
152validated_cache:
153
154 jmp 0x14AE
155
156no_cache_detected:
157 jmp 0x148D
158
159 align 2
160
161write_cfg_by_idx:
162 xchg ah, al
163 out 0ECh, al
164 xchg ah, al
165 out 0EDh, al
166 retn
167
168read_config_by_idx:
169 out 0ECh, al
170 in al, 0EDh
171 retn
172
173unprotect_config_registers:
174 out 0FBh, al
175 retn
176
177protect_config_registers:
178 out 0F9h, al
179 retn
180
181xtide_rom_read_slot_write_system:
182 push dx
183 push ax
184 mov al, 01000000b
185 mov ah, 0Fh
186 call write_cfg_by_idx
187 wbinvd
188 pop ax
189 pop dx
190 retn
191
192xtide_rom_ro:
193 mov al, 10110000b
194 mov ah, 0Fh
195 call write_cfg_by_idx
196 wbinvd
197 retn
198
199xtide_rom_rw:
200 mov al, 11000000b
201 mov ah, 0Fh
202 call write_cfg_by_idx
203 mov ax, 0CC00h
204 mov es, ax
205 xor di, di
206 xor ax, ax
207 mov cx, 8192
208 rep stosw ; clear video ram
209 in al, 61h ; PC/XT PPI port B bits:
210 ; 0: Tmr 2 gate ---? OR 03H=spkr ON
211 ; 1: Tmr 2 data -+ AND 0fcH=spkr OFF
212 ; 3: 1=read high switches
213 ; 4: 0=enable RAM parity checking
214 ; 5: 0=enable I/O channel check
215 ; 6: 0=hold keyboard clock low
216 ; 7: 0=enable kbrd
217 or al, 1100b
218 out 61h, al ; PC/XT PPI port B bits:
219 ; 0: Tmr 2 gate ---? OR 03H=spkr ON
220 ; 1: Tmr 2 data -+ AND 0fcH=spkr OFF
221 ; 3: 1=read high switches
222 ; 4: 0=enable RAM parity checking
223 ; 5: 0=enable I/O channel check
224 ; 6: 0=hold keyboard clock low
225 ; 7: 0=enable kbrd
226 and al, 11110011b
227 out 61h, al ; PC/XT PPI port B bits:
228 ; 0: Tmr 2 gate ---? OR 03H=spkr ON
229 ; 1: Tmr 2 data -+ AND 0fcH=spkr OFF
230 ; 3: 1=read high switches
231 ; 4: 0=enable RAM parity checking
232 ; 5: 0=enable I/O channel check
233 ; 6: 0=hold keyboard clock low
234 ; 7: 0=enable kbrd
235 retn
236
237has_cpuid:
238 pushfd
239 pop eax
240 mov ecx, eax
241 xor eax, 200000h
242 push eax
243 popfd
244 pushfd
245 pop eax
246 and eax, 200000h
247 and ecx, 200000h
248 cmp eax, ecx
249 jz loc_F2CC9
250 xor al, al
251 jmp short locret_F2CCB
252
253loc_F2CC9:
254 or al, 0FFh
255
256locret_F2CCB:
257 retn
258
259xtide_copy_rom_enable_shadow:
260 call unprotect_config_registers
261 call xtide_rom_rw
262
263 ; unknown VL82C483 index register (this seems to enable slot read/system writes)
264 mov al, 53h
265 out 0ECh, al
266 in al, 0EDh
267 and al, 7Fh
268 xchg ah, al
269 mov al, 53h
270 out 0ECh, al
271 xchg ah, al
272 out 0EDh, al
273
274 call xtide_rom_read_slot_write_system
275 mov ax, 0CC00h
276 mov ds, ax
277 xor si, si
278 mov ax, 0CC00h
279 mov es, ax
280 xor di, di
281 mov cx, 2000h
282 rep movsw
283
284 call has_cpuid
285 jnz short loc_F10B8
286
287 ; unknown VL82C483 index register (this seems to disable slot read/system writes)
288 mov al, 53h
289 out 0ECh, al
290 in al, 0EDh
291 or al, 80h
292 xchg ah, al
293 mov al, 53h
294 out 0ECh, al
295 xchg ah, al
296 out 0EDh, al
297
298loc_F10B8:
299 call xtide_rom_ro
300
301 call protect_config_registers
302 retn
303
304xtide_copy_rom:
305 push bp
306 push ds
307 push es
308 push ax
309 push bx
310 push cx
311 push dx
312 push si
313 push di
314 mov al, 0E0h
315 out 84h, al
316 cld
317 mov ax, 0CC00h
318 mov ds, ax
319 mov ax, 0AA55h
320 cmp ax, ds:0
321 jnz short loc_F807B
322 call xtide_copy_rom_enable_shadow
323
324loc_F807B:
325 pop di
326 pop si
327 pop dx
328 pop cx
329 pop bx
330 pop ax
331 pop es
332 pop ds
333 pop bp
334 retn
335
336section .data
337 ; program data
338
339section .bss
340 ; uninitialized data