c4261c4e2f6e7c3064901850c9d02b093d28babb
[reactos.git] / freeldr / bootsect / isoboot.asm
1
2 ; THIS FILE IS A MODIFIED VERSION OF ISOLINUX.ASM
3 ; MODIFICATION DONE BY MICHAEL K TER LOUW
4 ; LAST UPDATED 3-9-2002
5 ; SEE "COPYING" FOR INFORMATION ABOUT THE LICENSE THAT APPLIES TO THIS RELEASE
6
7
8
9 ; Note: The Makefile builds one version with DEBUG_MESSAGES automatically.
10 %define DEBUG_MESSAGES ; Uncomment to get debugging messages
11
12
13
14
15 ; ---------------------------------------------------------------------------
16 ; BEGIN THE BIOS/CODE/DATA SEGMENT
17 ; ---------------------------------------------------------------------------
18
19 absolute 0400h
20 serial_base resw 4 ; Base addresses for 4 serial ports
21 absolute 0413h
22 BIOS_fbm resw 1 ; Free Base Memory (kilobytes)
23 absolute 046Ch
24 BIOS_timer resw 1 ; Timer ticks
25 absolute 0472h
26 BIOS_magic resw 1 ; BIOS reset magic
27 absolute 0484h
28 BIOS_vidrows resb 1 ; Number of screen rows
29
30 ;
31 ; Memory below this point is reserved for the BIOS and the MBR
32 ;
33 absolute 1000h
34 trackbuf resb 8192 ; Track buffer goes here
35 trackbufsize equ $-trackbuf
36 ; trackbuf ends at 3000h
37
38 struc open_file_t
39 file_sector resd 1 ; Sector pointer (0 = structure free)
40 file_left resd 1 ; Number of sectors left
41 endstruc
42
43 struc dir_t
44 dir_lba resd 1 ; Directory start (LBA)
45 dir_len resd 1 ; Length in bytes
46 dir_clust resd 1 ; Length in clusters
47 endstruc
48
49
50 MAX_OPEN_LG2 equ 2 ; log2(Max number of open files)
51 MAX_OPEN equ (1 << MAX_OPEN_LG2)
52 SECTORSIZE_LG2 equ 11 ; 2048 bytes/sector (El Torito requirement)
53 SECTORSIZE equ (1 << SECTORSIZE_LG2)
54 CR equ 13 ; Carriage Return
55 LF equ 10 ; Line Feed
56
57
58
59 absolute 5000h ; Here we keep our BSS stuff
60
61 DriveNo resb 1 ; CD-ROM BIOS drive number
62 DiskError resb 1 ; Error code for disk I/O
63 RetryCount resb 1 ; Used for disk access retries
64 ISOFlags resb 1 ; Flags for ISO directory search
65 RootDir resb dir_t_size ; Root directory
66 CurDir resb dir_t_size ; Current directory
67 ISOFileName resb 64 ; ISO filename canonicalization buffer
68 ISOFileNameEnd equ $
69
70
71 alignb open_file_t_size
72 Files resb MAX_OPEN*open_file_t_size
73
74
75
76 section .text
77 org 7000h
78
79 start:
80 cli ; Disable interrupts
81 xor ax, ax ; ax = segment zero
82 mov ss, ax ; Initialize stack segment
83 mov sp, start ; Set up stack
84 mov ds, ax ; Initialize other segment registers
85 mov es, ax
86 mov fs, ax
87 mov gs, ax
88 sti ; Enable interrupts
89 cld ; Increment pointers
90
91 mov cx, 2048 >> 2 ; Copy the bootsector
92 mov si, 0x7C00 ; from 0000:7C00
93 mov di, 0x7000 ; to 0000:7000
94 rep movsd ; copy the program
95 jmp 0:relocate ; jump into relocated code
96
97 relocate:
98 ; Display the banner and copyright
99 mov si, isolinux_banner ; si points to hello message
100 call writestr ; display the message
101 %ifdef DEBUG_MESSAGES
102 mov si,copyright_str
103 call writestr
104 %endif
105
106
107 ; Save and display the boot drive number
108 mov [DriveNo], dl
109 %ifdef DEBUG_MESSAGES
110 mov si, startup_msg
111 call writemsg
112 mov al, dl
113 call writehex2
114 call crlf
115 %endif
116
117 ; Now figure out what we're actually doing
118 ; Note: use passed-in DL value rather than 7Fh because
119 ; at least some BIOSes will get the wrong value otherwise
120 mov ax, 4B01h ; Get disk emulation status
121 mov dl, [DriveNo]
122 mov si, spec_packet
123 int 13h
124 jc near spec_query_failed ; Shouldn't happen (BIOS bug)
125 mov dl, [DriveNo]
126 cmp [sp_drive], dl ; Should contain the drive number
127 jne near spec_query_failed
128
129 %ifdef DEBUG_MESSAGES
130 mov si, spec_ok_msg
131 call writemsg
132 mov al, byte [sp_drive]
133 call writehex2
134 call crlf
135 %endif
136
137 found_drive:
138 ; Get drive information
139 mov ah, 48h
140 mov dl, [DriveNo]
141 mov si, drive_params
142 int 13h
143 jnc params_ok
144
145 mov si, nosecsize_msg
146 call writemsg
147
148 params_ok:
149 ; Check for the sector size (should be 2048, but
150 ; some BIOSes apparently think we're 512-byte media)
151 ;
152 ; FIX: We need to check what the proper behaviour
153 ; is for getlinsec when the BIOS thinks the sector
154 ; size is 512!!! For that, we need such a BIOS, though...
155 %ifdef DEBUG_MESSAGES
156 mov si, secsize_msg
157 call writemsg
158 mov ax, [dp_secsize]
159 call writehex4
160 call crlf
161 %endif
162
163
164 ;
165 ; Clear Files structures
166 ;
167 mov di, Files
168 mov cx, (MAX_OPEN*open_file_t_size)/4
169 xor eax, eax
170 rep stosd
171
172 ;
173 ; Now, we need to sniff out the actual filesystem data structures.
174 ; mkisofs gave us a pointer to the primary volume descriptor
175 ; (which will be at 16 only for a single-session disk!); from the PVD
176 ; we should be able to find the rest of what we need to know.
177 ;
178 get_fs_structures:
179 mov eax, 16 ; Primary Volume Descriptor (sector 16)
180 mov bx, trackbuf
181 call getonesec
182
183 mov eax, [trackbuf+156+2]
184 mov [RootDir+dir_lba],eax
185 mov [CurDir+dir_lba],eax
186 %ifdef DEBUG_MESSAGES
187 mov si, rootloc_msg
188 call writemsg
189 call writehex8
190 call crlf
191 %endif
192
193 mov eax,[trackbuf+156+10]
194 mov [RootDir+dir_len],eax
195 mov [CurDir+dir_len],eax
196 %ifdef DEBUG_MESSAGES
197 mov si, rootlen_msg
198 call writemsg
199 call writehex8
200 call crlf
201 %endif
202 add eax,SECTORSIZE-1
203 shr eax,SECTORSIZE_LG2
204 mov [RootDir+dir_clust],eax
205 mov [CurDir+dir_clust],eax
206 %ifdef DEBUG_MESSAGES
207 mov si, rootsect_msg
208 call writemsg
209 call writehex8
210 call crlf
211 %endif
212
213 ; Look for the "X86" directory, and if found,
214 ; make it the current directory instead of the root
215 ; directory.
216 mov di,isolinux_dir
217 mov al,02h ; Search for a directory
218 call searchdir_iso
219 jnz .dir_found
220 mov si,no_dir_msg
221 call writemsg
222 jmp kaboom
223
224 .dir_found:
225 mov [CurDir+dir_len],eax
226 mov eax,[si+file_left]
227 mov [CurDir+dir_clust],eax
228 xor eax,eax ; Free this file pointer entry
229 xchg eax,[si+file_sector]
230 mov [CurDir+dir_lba],eax
231
232
233 mov di, isolinux_bin ; di points to Isolinux filename
234 call searchdir ; look for the file
235 jnz .isolinux_opened ; got the file
236 mov si, no_isolinux_msg ; si points to error message
237 call writemsg ; display the message
238 jmp kaboom ; fail boot
239
240 .isolinux_opened:
241 push si ; save file pointer
242
243 %ifdef DEBUG_MESSAGES
244 mov si, filelen_msg
245 call writemsg
246 call writehex8
247 call crlf
248 %endif
249
250 mov bx, 0x8000 ; bx = load address
251 pop si ; si = file pointer
252 mov cx, 0xFFFF ; load the whole file
253 call getfssec ; get the first sector
254 mov dl, [DriveNo] ; dl = boot drive
255 jmp 0:0x8000 ; jump into OSLoader
256
257
258
259
260 ;
261 ; searchdir:
262 ;
263 ; Open a file
264 ;
265 ; On entry:
266 ; DS:DI = filename
267 ; If successful:
268 ; ZF clear
269 ; SI = file pointer
270 ; DX:AX or EAX = file length in bytes
271 ; If unsuccessful
272 ; ZF set
273 ;
274
275 ;
276 ; searchdir_iso is a special entry point for ISOLINUX only. In addition
277 ; to the above, searchdir_iso passes a file flag mask in AL. This is useful
278 ; for searching for directories.
279 ;
280 alloc_failure:
281 xor ax,ax ; ZF <- 1
282 ret
283
284 searchdir:
285 xor al,al
286 searchdir_iso:
287 mov [ISOFlags],al
288 call allocate_file ; Temporary file structure for directory
289 jnz alloc_failure
290 push es
291 push ds
292 pop es ; ES = DS
293 mov si,CurDir
294 cmp byte [di],'\' ; If filename begins with slash
295 jne .not_rooted
296 inc di ; Skip leading slash
297 mov si,RootDir ; Reference root directory instead
298 .not_rooted:
299 mov eax,[si+dir_clust]
300 mov [bx+file_left],eax
301 mov eax,[si+dir_lba]
302 mov [bx+file_sector],eax
303 mov edx,[si+dir_len]
304
305 .look_for_slash:
306 mov ax,di
307 .scan:
308 mov cl,[di]
309 inc di
310 and cl,cl
311 jz .isfile
312 cmp cl,'\'
313 jne .scan
314 mov [di-1],byte 0 ; Terminate at directory name
315 mov cl,02h ; Search for directory
316 xchg cl,[ISOFlags]
317 push di
318 push cx
319 push word .resume ; Where to "return" to
320 push es
321 .isfile:
322 xchg ax,di
323
324 .getsome:
325 ; Get a chunk of the directory
326 mov si,trackbuf
327 pushad
328 xchg bx,si
329 mov cx,1 ; load one sector
330 call getfssec
331 popad
332
333 .compare:
334 movzx eax, byte [si] ; Length of directory entry
335 cmp al, 33
336 jb .next_sector
337 mov cl, [si+25]
338 xor cl, [ISOFlags]
339 test cl, byte 8Eh ; Unwanted file attributes!
340 jnz .not_file
341 pusha
342 movzx cx, byte [si+32] ; File identifier length
343 add si, byte 33 ; File identifier offset
344 call iso_compare_names
345 popa
346 je .success
347 .not_file:
348 sub edx, eax ; Decrease bytes left
349 jbe .failure
350 add si, ax ; Advance pointer
351
352 .check_overrun:
353 ; Did we finish the buffer?
354 cmp si, trackbuf+trackbufsize
355 jb .compare ; No, keep going
356
357 jmp short .getsome ; Get some more directory
358
359 .next_sector:
360 ; Advance to the beginning of next sector
361 lea ax, [si+SECTORSIZE-1]
362 and ax, ~(SECTORSIZE-1)
363 sub ax, si
364 jmp short .not_file ; We still need to do length checks
365
366 .failure:
367 %ifdef DEBUG_MESSAGES
368 mov si, findfail_msg
369 call writemsg
370 call crlf
371 %endif
372 xor eax, eax ; ZF = 1
373 mov [bx+file_sector], eax
374 pop es
375 ret
376
377 .success:
378 mov eax, [si+2] ; Location of extent
379 mov [bx+file_sector], eax
380 mov eax, [si+10] ; Data length
381 push eax
382 add eax, SECTORSIZE-1
383 shr eax, SECTORSIZE_LG2
384 mov [bx+file_left], eax
385 pop eax
386 mov edx, eax
387 shr edx, 16
388 and bx, bx ; ZF = 0
389 mov si, bx
390 pop es
391 ret
392
393 .resume:
394 ; We get here if we were only doing part of a lookup
395 ; This relies on the fact that .success returns bx == si
396 xchg edx, eax ; Directory length in edx
397 pop cx ; Old ISOFlags
398 pop di ; Next filename pointer
399
400 mov byte [di-1], '\' ; restore the backslash in the filename
401
402 mov [ISOFlags], cl ; Restore the flags
403 jz .failure ; Did we fail? If so fail for real!
404 jmp .look_for_slash ; Otherwise, next level
405
406 ;
407 ; allocate_file: Allocate a file structure
408 ;
409 ; If successful:
410 ; ZF set
411 ; BX = file pointer
412 ; In unsuccessful:
413 ; ZF clear
414 ;
415 allocate_file:
416 push cx
417 mov bx, Files
418 mov cx, MAX_OPEN
419 .check:
420 cmp dword [bx], byte 0
421 je .found
422 add bx, open_file_t_size ; ZF = 0
423 loop .check
424 ; ZF = 0 if we fell out of the loop
425 .found:
426 pop cx
427 ret
428
429 ;
430 ; iso_compare_names:
431 ; Compare the names DS:SI and DS:DI and report if they are
432 ; equal from an ISO 9660 perspective. SI is the name from
433 ; the filesystem; CX indicates its length, and ';' terminates.
434 ; DI is expected to end with a null.
435 ;
436 ; Note: clobbers AX, CX, SI, DI; assumes DS == ES == base segment
437 ;
438 iso_compare_names:
439 ; First, terminate and canonicalize input filename
440 push di
441 mov di, ISOFileName
442 .canon_loop:
443 jcxz .canon_end
444 lodsb
445 dec cx
446 cmp al, ';'
447 je .canon_end
448 and al, al
449 je .canon_end
450 stosb
451 cmp di, ISOFileNameEnd-1 ; Guard against buffer overrun
452 jb .canon_loop
453 .canon_end:
454 cmp di, ISOFileName
455 jbe .canon_done
456 cmp byte [di-1], '.' ; Remove terminal dots
457 jne .canon_done
458 dec di
459 jmp short .canon_end
460 .canon_done:
461 mov [di], byte 0 ; Null-terminate string
462 pop di
463 mov si, ISOFileName
464 .compare:
465 lodsb
466 mov ah, [di]
467 inc di
468 and ax, ax
469 jz .success ; End of string for both
470 and al, al ; Is either one end of string?
471 jz .failure ; If so, failure
472 and ah, ah
473 jz .failure
474 or ax, 2020h ; Convert to lower case
475 cmp al, ah
476 je .compare
477 .failure:
478 and ax, ax ; ZF = 0 (at least one will be nonzero)
479 .success:
480 ret
481
482
483
484
485
486
487
488 ;
489 ; getfssec: Get multiple clusters from a file, given the file pointer.
490 ;
491 ; On entry:
492 ; ES:BX -> Buffer
493 ; SI -> File pointer
494 ; CX -> Cluster count; 0FFFFh = until end of file
495 ; On exit:
496 ; SI -> File pointer (or 0 on EOF)
497 ; CF = 1 -> Hit EOF
498 ;
499 getfssec:
500 cmp cx, [si+file_left]
501 jna .ok_size
502 mov cx, [si+file_left]
503
504 .ok_size:
505 mov bp, cx
506 push cx
507 push si
508 mov eax, [si+file_sector]
509 call getlinsec
510 xor ecx, ecx
511 pop si
512 pop cx
513
514 add [si+file_sector], ecx
515 sub [si+file_left], ecx
516 ja .not_eof ; CF = 0
517
518 xor ecx, ecx
519 mov [si+file_sector], ecx ; Mark as unused
520 xor si,si
521 stc
522
523 .not_eof:
524 ret
525
526
527
528 ; INT 13h, AX=4B01h, DL=<passed in value> failed.
529 ; Try to scan the entire 80h-FFh from the end.
530 spec_query_failed:
531 mov si,spec_err_msg
532 call writemsg
533
534 mov dl, 0FFh
535 .test_loop:
536 pusha
537 mov ax, 4B01h
538 mov si, spec_packet
539 mov byte [si], 13 ; Size of buffer
540 int 13h
541 popa
542 jc .still_broken
543
544 mov si, maybe_msg
545 call writemsg
546 mov al, dl
547 call writehex2
548 call crlf
549
550 cmp byte [sp_drive], dl
551 jne .maybe_broken
552
553 ; Okay, good enough...
554 mov si, alright_msg
555 call writemsg
556 mov [DriveNo], dl
557 .found_drive:
558 jmp found_drive
559
560 ; Award BIOS 4.51 apparently passes garbage in sp_drive,
561 ; but if this was the drive number originally passed in
562 ; DL then consider it "good enough"
563 .maybe_broken:
564 cmp byte [DriveNo], dl
565 je .found_drive
566
567 .still_broken: dec dx
568 cmp dl, 80h
569 jnb .test_loop
570
571 fatal_error:
572 mov si, nothing_msg
573 call writemsg
574
575 .norge:
576 jmp short .norge
577
578
579
580 ; Information message (DS:SI) output
581 ; Prefix with "isolinux: "
582 ;
583 writemsg:
584 push ax
585 push si
586 mov si, isolinux_str
587 call writestr
588 pop si
589 call writestr
590 pop ax
591 ret
592
593 ;
594 ; crlf: Print a newline
595 ;
596 crlf:
597 mov si, crlf_msg
598 ; Fall through
599
600 ;
601 ; writestr: write a null-terminated string to the console, saving
602 ; registers on entry.
603 ;
604 writestr:
605 pushfd
606 pushad
607 .top:
608 lodsb
609 and al, al
610 jz .end
611 call writechr
612 jmp short .top
613 .end:
614 popad
615 popfd
616 ret
617
618
619 ;
620 ; writehex[248]: Write a hex number in (AL, AX, EAX) to the console
621 ;
622 writehex2:
623 pushfd
624 pushad
625 shl eax, 24
626 mov cx, 2
627 jmp short writehex_common
628 writehex4:
629 pushfd
630 pushad
631 shl eax, 16
632 mov cx, 4
633 jmp short writehex_common
634 writehex8:
635 pushfd
636 pushad
637 mov cx, 8
638 writehex_common:
639 .loop:
640 rol eax, 4
641 push eax
642 and al, 0Fh
643 cmp al, 10
644 jae .high
645 .low:
646 add al, '0'
647 jmp short .ischar
648 .high:
649 add al, 'A'-10
650 .ischar:
651 call writechr
652 pop eax
653 loop .loop
654 popad
655 popfd
656 ret
657
658 ;
659 ; Write a character to the screen. There is a more "sophisticated"
660 ; version of this in the subsequent code, so we patch the pointer
661 ; when appropriate.
662 ;
663
664 writechr:
665 pushfd
666 pushad
667 mov ah, 0Eh
668 xor bx, bx
669 int 10h
670 popad
671 popfd
672 ret
673
674 ;
675 ; Get one sector. Convenience entry point.
676 ;
677 getonesec:
678 mov bp, 1
679 ; Fall through to getlinsec
680
681 ;
682 ; Get linear sectors - EBIOS LBA addressing, 2048-byte sectors.
683 ;
684 ; Note that we can't always do this as a single request, because at least
685 ; Phoenix BIOSes has a 127-sector limit. To be on the safe side, stick
686 ; to 32 sectors (64K) per request.
687 ;
688 ; Input:
689 ; EAX - Linear sector number
690 ; ES:BX - Target buffer
691 ; BP - Sector count
692 ;
693 getlinsec:
694 mov si,dapa ; Load up the DAPA
695 mov [si+4],bx
696 mov bx,es
697 mov [si+6],bx
698 mov [si+8],eax
699 .loop:
700 push bp ; Sectors left
701 cmp bp,byte 32
702 jbe .bp_ok
703 mov bp,32
704 .bp_ok:
705 mov [si+2],bp
706 push si
707 mov dl,[DriveNo]
708 mov ah,42h ; Extended Read
709 call xint13
710 pop si
711 pop bp
712 movzx eax,word [si+2] ; Sectors we read
713 add [si+8],eax ; Advance sector pointer
714 sub bp,ax ; Sectors left
715 shl ax,SECTORSIZE_LG2-4 ; 2048-byte sectors -> segment
716 add [si+6],ax ; Advance buffer pointer
717 and bp,bp
718 jnz .loop
719 mov eax,[si+8] ; Next sector
720 ret
721
722 ; INT 13h with retry
723 xint13:
724 mov byte [RetryCount], 6
725 .try:
726 pushad
727 int 13h
728 jc .error
729 add sp, byte 8*4 ; Clean up stack
730 ret
731 .error:
732 mov [DiskError], ah ; Save error code
733 popad
734 dec byte [RetryCount]
735 jnz .try
736
737 .real_error:
738 mov si, diskerr_msg
739 call writemsg
740 mov al, [DiskError]
741 call writehex2
742 mov si, ondrive_str
743 call writestr
744 mov al, dl
745 call writehex2
746 call crlf
747 ; Fall through to kaboom
748
749 ;
750 ; kaboom: write a message and bail out. Wait for a user keypress,
751 ; then do a hard reboot.
752 ;
753 kaboom:
754 mov ax, cs
755 mov ds, ax
756 mov es, ax
757 mov fs, ax
758 mov gs, ax
759 sti
760 mov si, err_bootfailed
761 call writestr
762 call getchar
763 cli
764 mov word [BIOS_magic], 0 ; Cold reboot
765 jmp 0F000h:0FFF0h ; Reset vector address
766
767 getchar:
768 .again:
769 mov ah, 1 ; Poll keyboard
770 int 16h
771 jz .again
772 .kbd:
773 xor ax, ax ; Get keyboard input
774 int 16h
775 .func_key:
776 ret
777
778
779
780
781
782 isolinux_banner db CR, LF, 'Loading IsoBoot...', CR, LF, 0
783 copyright_str db ' Copyright (C) 1994-2002 H. Peter Anvin', CR, LF, 0
784
785 %ifdef DEBUG_MESSAGES
786 startup_msg: db 'Starting up, DL = ', 0
787 spec_ok_msg: db 'Loaded spec packet OK, drive = ', 0
788 secsize_msg: db 'Sector size appears to be ', 0
789 rootloc_msg: db 'Root directory location: ', 0
790 rootlen_msg: db 'Root directory length: ', 0
791 rootsect_msg: db 'Root directory length(sectors): ', 0
792 fileloc_msg: db 'FreeLdr.sys location: ', 0
793 filelen_msg: db 'FreeLdr.sys length: ', 0
794 filesect_msg: db 'FreeLdr.sys length(sectors): ', 0
795 findfail_msg: db 'Failed to find file!', 0
796 %endif
797
798
799 nosecsize_msg: db 'Failed to get sector size, assuming 0800', CR, LF, 0
800 spec_err_msg: db 'Loading spec packet failed, trying to wing it...', CR, LF, 0
801 maybe_msg: db 'Found something at drive = ', 0
802 alright_msg: db 'Looks like it might be right, continuing...', CR, LF, 0
803 nothing_msg: db 'Failed to locate CD-ROM device; boot failed.', CR, LF, 0
804 isolinux_str db 'IsoBoot: ', 0
805 crlf_msg db CR, LF, 0
806 diskerr_msg: db 'Disk error ', 0
807 ondrive_str: db ', drive ', 0
808 err_bootfailed db CR, LF, 'Boot failed: press a key to retry...'
809 ;isolinux_dir db '\bscript', 0
810 isolinux_dir db '\I386', 0
811 ;no_dir_msg db 'Could not find the \bscript directory.', CR, LF, 0
812 no_dir_msg db 'Could not find the I386 directory.', CR, LF, 0
813 ;isolinux_bin db 'isolinux.bin', 0
814 isolinux_bin db 'FREELDR.SYS', 0
815 ;no_isolinux_msg db 'Could not find the file isolinux.bin.', CR, LF, 0
816 no_isolinux_msg db 'Could not find the file FREELDR.SYS.', CR, LF, 0
817
818 ;
819 ; El Torito spec packet
820 ;
821 align 8, db 0
822 spec_packet: db 13h ; Size of packet
823 sp_media: db 0 ; Media type
824 sp_drive: db 0 ; Drive number
825 sp_controller: db 0 ; Controller index
826 sp_lba: dd 0 ; LBA for emulated disk image
827 sp_devspec: dw 0 ; IDE/SCSI information
828 sp_buffer: dw 0 ; User-provided buffer
829 sp_loadseg: dw 0 ; Load segment
830 sp_sectors: dw 0 ; Sector count
831 sp_chs: db 0,0,0 ; Simulated CHS geometry
832 sp_dummy: db 0 ; Scratch, safe to overwrite
833
834 ;
835 ; EBIOS drive parameter packet
836 ;
837 align 8, db 0
838 drive_params: dw 30 ; Buffer size
839 dp_flags: dw 0 ; Information flags
840 dp_cyl: dd 0 ; Physical cylinders
841 dp_head: dd 0 ; Physical heads
842 dp_sec: dd 0 ; Physical sectors/track
843 dp_totalsec: dd 0,0 ; Total sectors
844 dp_secsize: dw 0 ; Bytes per sector
845 dp_dpte: dd 0 ; Device Parameter Table
846 dp_dpi_key: dw 0 ; 0BEDDh if rest valid
847 dp_dpi_len: db 0 ; DPI len
848 db 0
849 dw 0
850 dp_bus: times 4 db 0 ; Host bus type
851 dp_interface: times 8 db 0 ; Interface type
852 db_i_path: dd 0,0 ; Interface path
853 db_d_path: dd 0,0 ; Device path
854 db 0
855 db_dpi_csum: db 0 ; Checksum for DPI info
856
857 ;
858 ; EBIOS disk address packet
859 ;
860 align 8, db 0
861 dapa: dw 16 ; Packet size
862 .count: dw 0 ; Block count
863 .off: dw 0 ; Offset of buffer
864 .seg: dw 0 ; Segment of buffer
865 .lba: dd 0 ; LBA (LSW)
866 dd 0 ; LBA (MSW)
867
868 times 2048-($-$$) nop ; Pad to file offset 2048
869
870
871 ;section .bss
872
873 ;DriveNo resb 1 ; CD-ROM BIOS drive number
874 ;DiskError resb 1 ; Error code for disk I/O
875 ;RetryCount resb 1 ; Used for disk access retries
876 ;ISOFlags resb 1 ; Flags for ISO directory search
877 ;RootDir resb dir_t_size ; Root directory
878 ;CurDir resb dir_t_size ; Current directory
879 ;ISOFileName resb 64 ; ISO filename canonicalization buffer
880 ;ISOFileNameEnd equ $
881
882
883 ; alignb open_file_t_size
884 ;Files resb MAX_OPEN*open_file_t_size
885
886
887
888
889
890
891
892